summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vd_vfwex.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-30 20:47:18 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-30 20:47:18 +0000
commit21c2e043717e1deec8b3c68149151b62cf5759e0 (patch)
treee15b9bd3f4f2aaceb48e80d829f2d291a96cb563 /libmpcodecs/vd_vfwex.c
parent26c9b4ee5edfb50dd4684a19aa97ad7651c42a7c (diff)
downloadmpv-21c2e043717e1deec8b3c68149151b62cf5759e0.tar.bz2
mpv-21c2e043717e1deec8b3c68149151b62cf5759e0.tar.xz
vfwex separated from vfw, to work with new vfm system and dlopen
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7176 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vd_vfwex.c')
-rw-r--r--libmpcodecs/vd_vfwex.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/libmpcodecs/vd_vfwex.c b/libmpcodecs/vd_vfwex.c
new file mode 100644
index 0000000000..8c48871a1f
--- /dev/null
+++ b/libmpcodecs/vd_vfwex.c
@@ -0,0 +1,91 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "config.h"
+#ifdef USE_WIN32DLL
+
+#include "mp_msg.h"
+#include "help_mp.h"
+
+#include "vd_internal.h"
+
+#include "dll_init.h"
+
+static vd_info_t info_vfwex = {
+ "Win32/VfWex video codecs",
+ "vfwex",
+ VFM_VFWEX,
+ "A'rpi",
+ "based on http://avifile.sf.net",
+ "win32 codecs"
+};
+
+LIBVD_EXTERN(vfwex)
+
+// to set/get/query special features/parameters
+static int control(sh_video_t *sh,int cmd,void* arg,...){
+ switch(cmd){
+ case VDCTRL_QUERY_MAX_PP_LEVEL:
+ return 9;
+ case VDCTRL_SET_PP_LEVEL:
+ vfw_set_postproc(sh,10*(*((int*)arg)));
+ return CONTROL_OK;
+ }
+ return CONTROL_UNKNOWN;
+}
+
+// init driver
+static int init(sh_video_t *sh){
+ if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
+ if(!init_vfw_video_codec(sh,1)) return 0;
+ mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n");
+ return 1;
+}
+
+// uninit driver
+static void uninit(sh_video_t *sh){
+ vfw_close_video_codec(sh, 1);
+}
+
+//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
+
+// decode a frame
+static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
+ mp_image_t* mpi;
+ int ret;
+ if(len<=0) return NULL; // skipped frame
+
+ mpi=mpcodecs_get_image(sh,
+ (sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_STATIC) ?
+ MP_IMGTYPE_STATIC : MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_WIDTH,
+ sh->disp_w, sh->disp_h);
+ if(!mpi){ // temporary!
+ printf("couldn't allocate image for cinepak codec\n");
+ return NULL;
+ }
+
+ // set buffer:
+ sh->our_out_buffer=mpi->planes[0];
+
+ // set stride: (trick discovered by Andreas Ackermann - thanx!)
+ sh->bih->biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8);
+ sh->o_bih.biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8);
+
+ if((ret=vfw_decode_video(sh,data,len,flags&3,1))){
+ mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret);
+ return NULL;
+ }
+
+ if(mpi->imgfmt==IMGFMT_RGB8 || mpi->imgfmt==IMGFMT_BGR8){
+ // export palette:
+// FIXME: sh->o_bih is cutted down to 40 bytes!!!
+// if(sh->o_bih->biSize>40)
+// mpi->planes[1]=((unsigned char*)&sh->o_bih)+40;
+// else
+ mpi->planes[1]=NULL;
+ }
+
+ return mpi;
+}
+
+#endif