Mercurial > mplayer.hg
annotate libmpcodecs/vd_vfw.c @ 7180:28677d779205
-afm/-vfm migration from ID (int) to NAME (string) - simplifies code and makes dlopen()'ing possible
author | arpi |
---|---|
date | Fri, 30 Aug 2002 21:44:20 +0000 |
parents | 42222161de9b |
children | b4d025d64eb3 |
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 | |
7176 | 14 static vd_info_t info = { |
4968 | 15 "Win32/VfW video codecs", |
16 "vfw", | |
17 "A'rpi", | |
18 "based on http://avifile.sf.net", | |
19 "win32 codecs" | |
20 }; | |
21 | |
22 LIBVD_EXTERN(vfw) | |
23 | |
24 // to set/get/query special features/parameters | |
25 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
26 switch(cmd){ | |
27 case VDCTRL_QUERY_MAX_PP_LEVEL: | |
28 return 9; | |
29 case VDCTRL_SET_PP_LEVEL: | |
30 vfw_set_postproc(sh,10*(*((int*)arg))); | |
31 return CONTROL_OK; | |
32 } | |
33 return CONTROL_UNKNOWN; | |
34 } | |
35 | |
36 // init driver | |
37 static int init(sh_video_t *sh){ | |
5153 | 38 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; |
7175
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
6844
diff
changeset
|
39 if(!init_vfw_video_codec(sh,0)) return 0; |
4968 | 40 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n"); |
5153 | 41 return 1; |
4968 | 42 } |
43 | |
44 // uninit driver | |
45 static void uninit(sh_video_t *sh){ | |
7175
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
6844
diff
changeset
|
46 vfw_close_video_codec(sh, 0); |
4968 | 47 } |
48 | |
49 // decode a frame | |
50 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
51 mp_image_t* mpi; | |
52 int ret; | |
53 if(len<=0) return NULL; // skipped frame | |
54 | |
6105
b77b984120f9
iive is right - we shouldn't use IP buffering for vfw. it was changed
arpi
parents:
5769
diff
changeset
|
55 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
|
56 (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
|
57 MP_IMGTYPE_STATIC : MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_WIDTH, |
4968 | 58 sh->disp_w, sh->disp_h); |
59 if(!mpi){ // temporary! | |
60 printf("couldn't allocate image for cinepak codec\n"); | |
61 return NULL; | |
62 } | |
63 | |
64 // set buffer: | |
65 sh->our_out_buffer=mpi->planes[0]; | |
66 | |
67 // set stride: (trick discovered by Andreas Ackermann - thanx!) | |
68 sh->bih->biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8); | |
69 sh->o_bih.biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8); | |
70 | |
7175
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
6844
diff
changeset
|
71 if((ret=vfw_decode_video(sh,data,len,flags&3,0))){ |
4968 | 72 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret); |
73 return NULL; | |
74 } | |
75 | |
5769 | 76 if(mpi->imgfmt==IMGFMT_RGB8 || mpi->imgfmt==IMGFMT_BGR8){ |
77 // export palette: | |
6232 | 78 // FIXME: sh->o_bih is cutted down to 40 bytes!!! |
79 // if(sh->o_bih->biSize>40) | |
80 // mpi->planes[1]=((unsigned char*)&sh->o_bih)+40; | |
81 // else | |
82 mpi->planes[1]=NULL; | |
5769 | 83 } |
84 | |
4968 | 85 return mpi; |
86 } | |
87 | |
88 #endif |