changeset 7175:f8b147aab1a5

vfwex separated from vfw, to work with new vfm system and dlopen
author arpi
date Fri, 30 Aug 2002 20:47:18 +0000
parents 7672615cc811
children 42222161de9b
files libmpcodecs/Makefile libmpcodecs/vd_vfw.c libmpcodecs/vd_vfwex.c
diffstat 3 files changed, 95 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/Makefile	Fri Aug 30 20:06:22 2002 +0000
+++ b/libmpcodecs/Makefile	Fri Aug 30 20:47:18 2002 +0000
@@ -5,7 +5,7 @@
 LIBNAME2 = libmpencoders.a
 
 AUDIO_SRCS=dec_audio.c ad.c ad_liba52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3lib.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c ad_msgsm.c ad_faad.c ad_libvorbis.c ad_libmad.c ad_realaud.c ad_libdv.c
-VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_realvid.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c vd_mpegpes.c vd_svq1.c vd_xvid.c vd_libdv.c
+VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_realvid.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_vfwex.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c vd_mpegpes.c vd_svq1.c vd_xvid.c vd_libdv.c
 VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_lavcdeint.c vf_eq.c vf_halfpack.c
 ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c
 NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/cyuv.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c native/svq1.c
--- a/libmpcodecs/vd_vfw.c	Fri Aug 30 20:06:22 2002 +0000
+++ b/libmpcodecs/vd_vfw.c	Fri Aug 30 20:47:18 2002 +0000
@@ -20,22 +20,7 @@
 	"win32 codecs"
 };
 
-static vd_info_t info_vfwex = {
-	"Win32/VfWex video codecs",
-	"vfwex",
-	VFM_VFWEX,
-	"A'rpi",
-	"based on http://avifile.sf.net",
-	"win32 codecs"
-};
-
-#define info info_vfw
 LIBVD_EXTERN(vfw)
-#undef info
-
-#define info info_vfwex
-LIBVD_EXTERN(vfwex)
-#undef info
 
 // to set/get/query special features/parameters
 static int control(sh_video_t *sh,int cmd,void* arg,...){
@@ -52,18 +37,16 @@
 // 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,(sh->codec->driver==VFM_VFWEX))) return 0;
+    if(!init_vfw_video_codec(sh,0)) 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, (sh->codec->driver==VFM_VFWEX));
+    vfw_close_video_codec(sh, 0);
 }
 
-//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;
@@ -86,7 +69,7 @@
     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,(sh->codec->driver==VFM_VFWEX) ))){
+    if((ret=vfw_decode_video(sh,data,len,flags&3,0))){
       mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret);
       return NULL;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libmpcodecs/vd_vfwex.c	Fri Aug 30 20:47:18 2002 +0000
@@ -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