Mercurial > mplayer.hg
annotate libmpcodecs/vd_vfwex.c @ 7190:5137e9fb57e7
All RealVideo codecs liste on one line - less wasted space.
author | diego |
---|---|
date | Sat, 31 Aug 2002 13:05:33 +0000 |
parents | 28677d779205 |
children | b4d025d64eb3 |
rev | line source |
---|---|
7175
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
1 #include <stdio.h> |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
2 #include <stdlib.h> |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
3 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
4 #include "config.h" |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
5 #ifdef USE_WIN32DLL |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
6 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
7 #include "mp_msg.h" |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
8 #include "help_mp.h" |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
9 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
10 #include "vd_internal.h" |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
11 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
12 #include "dll_init.h" |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
13 |
7176 | 14 static vd_info_t info = { |
7175
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
15 "Win32/VfWex video codecs", |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
16 "vfwex", |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
17 "A'rpi", |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
18 "based on http://avifile.sf.net", |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
19 "win32 codecs" |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
20 }; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
21 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
22 LIBVD_EXTERN(vfwex) |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
23 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
24 // to set/get/query special features/parameters |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
25 static int control(sh_video_t *sh,int cmd,void* arg,...){ |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
26 switch(cmd){ |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
27 case VDCTRL_QUERY_MAX_PP_LEVEL: |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
28 return 9; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
29 case VDCTRL_SET_PP_LEVEL: |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
30 vfw_set_postproc(sh,10*(*((int*)arg))); |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
31 return CONTROL_OK; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
32 } |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
33 return CONTROL_UNKNOWN; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
34 } |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
35 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
36 // init driver |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
37 static int init(sh_video_t *sh){ |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
38 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
39 if(!init_vfw_video_codec(sh,1)) return 0; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
40 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n"); |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
41 return 1; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
42 } |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
43 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
44 // uninit driver |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
45 static void uninit(sh_video_t *sh){ |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
46 vfw_close_video_codec(sh, 1); |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
47 } |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
48 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
49 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
50 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
51 // decode a frame |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
52 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
53 mp_image_t* mpi; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
54 int ret; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
55 if(len<=0) return NULL; // skipped frame |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
56 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
57 mpi=mpcodecs_get_image(sh, |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
58 (sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_STATIC) ? |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
59 MP_IMGTYPE_STATIC : MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_WIDTH, |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
60 sh->disp_w, sh->disp_h); |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
61 if(!mpi){ // temporary! |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
62 printf("couldn't allocate image for cinepak codec\n"); |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
63 return NULL; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
64 } |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
65 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
66 // set buffer: |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
67 sh->our_out_buffer=mpi->planes[0]; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
68 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
69 // set stride: (trick discovered by Andreas Ackermann - thanx!) |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
70 sh->bih->biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8); |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
71 sh->o_bih.biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8); |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
72 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
73 if((ret=vfw_decode_video(sh,data,len,flags&3,1))){ |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
74 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret); |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
75 return NULL; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
76 } |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
77 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
78 if(mpi->imgfmt==IMGFMT_RGB8 || mpi->imgfmt==IMGFMT_BGR8){ |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
79 // export palette: |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
80 // FIXME: sh->o_bih is cutted down to 40 bytes!!! |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
81 // if(sh->o_bih->biSize>40) |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
82 // mpi->planes[1]=((unsigned char*)&sh->o_bih)+40; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
83 // else |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
84 mpi->planes[1]=NULL; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
85 } |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
86 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
87 return mpi; |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
88 } |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
89 |
f8b147aab1a5
vfwex separated from vfw, to work with new vfm system and dlopen
arpi
parents:
diff
changeset
|
90 #endif |