Mercurial > mplayer.hg
annotate libmpcodecs/vd_vfw.c @ 6372:075cca2558f9
Applying patch from Eric that fixes 6ch resampling
author | anders |
---|---|
date | Mon, 10 Jun 2002 12:10:52 +0000 |
parents | f8e0eac1256c |
children | e69615f1c309 |
rev | line source |
---|---|
4968 | 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 "vd_internal.h" | |
11 | |
12 #include "dll_init.h" | |
13 | |
14 static vd_info_t info_vfw = { | |
15 "Win32/VfW video codecs", | |
16 "vfw", | |
17 VFM_VFW, | |
18 "A'rpi", | |
19 "based on http://avifile.sf.net", | |
20 "win32 codecs" | |
21 }; | |
22 | |
23 static vd_info_t info_vfwex = { | |
24 "Win32/VfWex video codecs", | |
25 "vfwex", | |
26 VFM_VFWEX, | |
27 "A'rpi", | |
28 "based on http://avifile.sf.net", | |
29 "win32 codecs" | |
30 }; | |
31 | |
32 #define info info_vfw | |
33 LIBVD_EXTERN(vfw) | |
34 #undef info | |
35 | |
36 #define info info_vfwex | |
37 LIBVD_EXTERN(vfwex) | |
38 #undef info | |
39 | |
40 // to set/get/query special features/parameters | |
41 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
42 switch(cmd){ | |
43 case VDCTRL_QUERY_MAX_PP_LEVEL: | |
44 return 9; | |
45 case VDCTRL_SET_PP_LEVEL: | |
46 vfw_set_postproc(sh,10*(*((int*)arg))); | |
47 return CONTROL_OK; | |
48 } | |
49 return CONTROL_UNKNOWN; | |
50 } | |
51 | |
52 // init driver | |
53 static int init(sh_video_t *sh){ | |
54 unsigned int out_fmt; | |
5153 | 55 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; |
4968 | 56 if(!init_vfw_video_codec(sh,(sh->codec->driver==VFM_VFWEX))) return 0; |
57 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n"); | |
5153 | 58 return 1; |
4968 | 59 } |
60 | |
61 // uninit driver | |
62 static void uninit(sh_video_t *sh){ | |
5451 | 63 vfw_close_video_codec(sh, (sh->codec->driver==VFM_VFWEX)); |
4968 | 64 } |
65 | |
66 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
67 | |
68 // decode a frame | |
69 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
70 mp_image_t* mpi; | |
71 int ret; | |
72 if(len<=0) return NULL; // skipped frame | |
73 | |
6105
b77b984120f9
iive is right - we shouldn't use IP buffering for vfw. it was changed
arpi
parents:
5769
diff
changeset
|
74 mpi=mpcodecs_get_image(sh, |
b77b984120f9
iive is right - we shouldn't use IP buffering for vfw. it was changed
arpi
parents:
5769
diff
changeset
|
75 (sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_STATIC) ? |
b77b984120f9
iive is right - we shouldn't use IP buffering for vfw. it was changed
arpi
parents:
5769
diff
changeset
|
76 MP_IMGTYPE_STATIC : MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_WIDTH, |
4968 | 77 sh->disp_w, sh->disp_h); |
78 if(!mpi){ // temporary! | |
79 printf("couldn't allocate image for cinepak codec\n"); | |
80 return NULL; | |
81 } | |
82 | |
83 // set buffer: | |
84 sh->our_out_buffer=mpi->planes[0]; | |
85 | |
86 // set stride: (trick discovered by Andreas Ackermann - thanx!) | |
87 sh->bih->biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8); | |
88 sh->o_bih.biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8); | |
89 | |
90 if((ret=vfw_decode_video(sh,data,len,flags&3,(sh->codec->driver==VFM_VFWEX) ))){ | |
91 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret); | |
92 return NULL; | |
93 } | |
94 | |
5769 | 95 if(mpi->imgfmt==IMGFMT_RGB8 || mpi->imgfmt==IMGFMT_BGR8){ |
96 // export palette: | |
6232 | 97 // FIXME: sh->o_bih is cutted down to 40 bytes!!! |
98 // if(sh->o_bih->biSize>40) | |
99 // mpi->planes[1]=((unsigned char*)&sh->o_bih)+40; | |
100 // else | |
101 mpi->planes[1]=NULL; | |
5769 | 102 } |
103 | |
4968 | 104 return mpi; |
105 } | |
106 | |
107 #endif |