annotate libmpcodecs/vd_vfw.c @ 5100:c1eeb9416fd1

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