Mercurial > mplayer.hg
comparison libmpcodecs/vd_vfw.c @ 4968:236b06410b03
vfw, vfwex, odivx, divx4 added
author | arpi |
---|---|
date | Thu, 07 Mar 2002 00:44:58 +0000 |
parents | |
children | eb57973314ae |
comparison
equal
deleted
inserted
replaced
4967:f88dfc3de52c | 4968:236b06410b03 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 | |
4 #include "config.h" | |
5 #ifdef USE_WIN32DLL | |
6 | |
7 #include "mp_msg.h" | |
8 #include "help_mp.h" | |
9 | |
10 #include "codec-cfg.h" | |
11 #include "../libvo/img_format.h" | |
12 | |
13 #include "stream.h" | |
14 #include "demuxer.h" | |
15 #include "stheader.h" | |
16 | |
17 #include "vd.h" | |
18 #include "vd_internal.h" | |
19 | |
20 #include "dll_init.h" | |
21 | |
22 static vd_info_t info_vfw = { | |
23 "Win32/VfW video codecs", | |
24 "vfw", | |
25 VFM_VFW, | |
26 "A'rpi", | |
27 "based on http://avifile.sf.net", | |
28 "win32 codecs" | |
29 }; | |
30 | |
31 static vd_info_t info_vfwex = { | |
32 "Win32/VfWex video codecs", | |
33 "vfwex", | |
34 VFM_VFWEX, | |
35 "A'rpi", | |
36 "based on http://avifile.sf.net", | |
37 "win32 codecs" | |
38 }; | |
39 | |
40 #define info info_vfw | |
41 LIBVD_EXTERN(vfw) | |
42 #undef info | |
43 | |
44 #define info info_vfwex | |
45 LIBVD_EXTERN(vfwex) | |
46 #undef info | |
47 | |
48 // to set/get/query special features/parameters | |
49 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
50 switch(cmd){ | |
51 case VDCTRL_QUERY_MAX_PP_LEVEL: | |
52 return 9; | |
53 case VDCTRL_SET_PP_LEVEL: | |
54 vfw_set_postproc(sh,10*(*((int*)arg))); | |
55 return CONTROL_OK; | |
56 } | |
57 return CONTROL_UNKNOWN; | |
58 } | |
59 | |
60 // init driver | |
61 static int init(sh_video_t *sh){ | |
62 unsigned int out_fmt; | |
63 if(!init_vfw_video_codec(sh,(sh->codec->driver==VFM_VFWEX))) return 0; | |
64 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n"); | |
65 mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2); | |
66 // out_fmt=sh->codec->outfmt[sh->outfmtidx]; | |
67 return 1; | |
68 } | |
69 | |
70 // uninit driver | |
71 static void uninit(sh_video_t *sh){ | |
72 | |
73 } | |
74 | |
75 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
76 | |
77 // decode a frame | |
78 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
79 mp_image_t* mpi; | |
80 int ret; | |
81 if(len<=0) return NULL; // skipped frame | |
82 | |
83 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_WIDTH, | |
84 sh->disp_w, sh->disp_h); | |
85 if(!mpi){ // temporary! | |
86 printf("couldn't allocate image for cinepak codec\n"); | |
87 return NULL; | |
88 } | |
89 | |
90 // set buffer: | |
91 sh->our_out_buffer=mpi->planes[0]; | |
92 | |
93 // set stride: (trick discovered by Andreas Ackermann - thanx!) | |
94 sh->bih->biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8); | |
95 sh->o_bih.biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8); | |
96 | |
97 if((ret=vfw_decode_video(sh,data,len,flags&3,(sh->codec->driver==VFM_VFWEX) ))){ | |
98 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret); | |
99 return NULL; | |
100 } | |
101 | |
102 return mpi; | |
103 } | |
104 | |
105 #endif |