summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-06 22:03:46 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-06 22:03:46 +0000
commit233da95fea76a807830f590b37affc3868f3c393 (patch)
tree014b4ec5c0a61c972814583ee44e4104780c8b62 /libmpcodecs
parentf180847af72a028ce0f8220ec4f7de296e569383 (diff)
downloadmpv-233da95fea76a807830f590b37affc3868f3c393.tar.bz2
mpv-233da95fea76a807830f590b37affc3868f3c393.tar.xz
vd_dshow added
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4959 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/Makefile2
-rw-r--r--libmpcodecs/vd.c4
-rw-r--r--libmpcodecs/vd_dshow.c109
3 files changed, 114 insertions, 1 deletions
diff --git a/libmpcodecs/Makefile b/libmpcodecs/Makefile
index e745918269..f5c5ce510a 100644
--- a/libmpcodecs/Makefile
+++ b/libmpcodecs/Makefile
@@ -3,7 +3,7 @@ include ../config.mak
LIBNAME = libmpcodecs.a
-SRCS=dec_video.c vd.c vd_null.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c
+SRCS=dec_video.c vd.c vd_null.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c
OBJS=$(SRCS:.c=.o)
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index baf38540b6..05604677cf 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -25,6 +25,7 @@ extern vd_functions_t mpcodecs_vd_null;
extern vd_functions_t mpcodecs_vd_cinepak;
extern vd_functions_t mpcodecs_vd_qtrpza;
extern vd_functions_t mpcodecs_vd_ffmpeg;
+extern vd_functions_t mpcodecs_vd_dshow;
vd_functions_t* mpcodecs_vd_drivers[] = {
&mpcodecs_vd_null,
@@ -33,6 +34,9 @@ vd_functions_t* mpcodecs_vd_drivers[] = {
#ifdef USE_LIBAVCODEC
&mpcodecs_vd_ffmpeg,
#endif
+#ifdef USE_DIRECTSHOW
+ &mpcodecs_vd_dshow,
+#endif
NULL
};
diff --git a/libmpcodecs/vd_dshow.c b/libmpcodecs/vd_dshow.c
new file mode 100644
index 0000000000..9d44219a11
--- /dev/null
+++ b/libmpcodecs/vd_dshow.c
@@ -0,0 +1,109 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "config.h"
+#ifdef USE_DIRECTSHOW
+
+#include "mp_msg.h"
+#include "help_mp.h"
+
+
+#include "codec-cfg.h"
+#include "../libvo/img_format.h"
+
+#include "stream.h"
+#include "demuxer.h"
+#include "stheader.h"
+
+#include "vd.h"
+#include "vd_internal.h"
+
+#include "loader/dshow/DS_VideoDecoder.h"
+
+static vd_info_t info = {
+ "DirectShow video codecs",
+ "dshow",
+ VFM_DSHOW,
+ "A'rpi",
+ "based on http://avifile.sf.net",
+ "win32 codecs"
+};
+
+LIBVD_EXTERN(dshow)
+
+// 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 4;
+ case VDCTRL_SET_PP_LEVEL:
+ if(!sh->context) return CONTROL_ERROR;
+ DS_VideoDecoder_SetValue(sh->context,"Quality",*((int*)arg));
+ return CONTROL_OK;
+
+// TODO: query/set video options (brightness contrast etc)
+// DS_VideoDecoder_SetValue(ds_vdec,item,value);
+
+ }
+ return CONTROL_UNKNOWN;
+}
+
+// init driver
+static int init(sh_video_t *sh){
+ unsigned int out_fmt;
+ if(!(sh->context=DS_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
+ mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
+ mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n");
+ mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n");
+ return 0;
+ }
+ mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2);
+ out_fmt=sh->codec->outfmt[sh->outfmtidx];
+ switch(out_fmt){
+ case IMGFMT_YUY2:
+ case IMGFMT_UYVY:
+ DS_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ DS_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV
+ default:
+ DS_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR
+ }
+ DS_VideoDecoder_StartInternal(sh->context);
+ mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n");
+ return 1;
+}
+
+// uninit driver
+static void uninit(sh_video_t *sh){
+ DS_VideoDecoder_Destroy(sh->context);
+}
+
+//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;
+ if(len<=0) return NULL; // skipped frame
+
+ if(flags&3){
+ // framedrop:
+ DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0);
+ return NULL;
+ }
+
+ mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/,
+ sh->disp_w, sh->disp_h);
+
+ if(!mpi){ // temporary!
+ printf("couldn't allocate image for cinepak codec\n");
+ return NULL;
+ }
+
+ DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, mpi->planes[0]);
+
+ return mpi;
+}
+
+#endif