annotate libmpcodecs/vd_vfw.c @ 5213:b40644bb0e61

oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think MPlayer is basically complete now...:)
author melanson
date Wed, 20 Mar 2002 05:09:38 +0000
parents 7091d4c46685
children b716977c47d9
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;
5153
7091d4c46685 fixed colorspace detection
arpi
parents: 5124
diff changeset
55 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
4968
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
56 if(!init_vfw_video_codec(sh,(sh->codec->driver==VFM_VFWEX))) return 0;
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
57 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n");
5153
7091d4c46685 fixed colorspace detection
arpi
parents: 5124
diff changeset
58 return 1;
4968
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
59 }
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
60
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
61 // uninit driver
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
62 static void uninit(sh_video_t *sh){
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
63
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 //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
67
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
68 // decode a frame
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
69 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
70 mp_image_t* mpi;
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
71 int ret;
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
72 if(len<=0) return NULL; // skipped frame
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
73
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
74 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_WIDTH,
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
75 sh->disp_w, sh->disp_h);
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
76 if(!mpi){ // temporary!
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
77 printf("couldn't allocate image for cinepak codec\n");
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
78 return NULL;
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
79 }
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
80
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
81 // set buffer:
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
82 sh->our_out_buffer=mpi->planes[0];
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
83
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
84 // set stride: (trick discovered by Andreas Ackermann - thanx!)
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
85 sh->bih->biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8);
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
86 sh->o_bih.biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8);
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
87
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
88 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
89 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret);
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
90 return NULL;
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
91 }
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
92
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
93 return mpi;
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
94 }
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
95
236b06410b03 vfw, vfwex, odivx, divx4 added
arpi
parents:
diff changeset
96 #endif