diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-11-26 22:55:32 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-11-26 22:55:32 +0000 |
commit | f482d214a7a1549203b7eca30d275a06341a892c (patch) | |
tree | b37bbc4665253f81b66393424e84b66f13085bee /libmpcodecs/vd_dmo.c | |
parent | c989ead81b1629d601fbc25975a33a28952485e7 (diff) | |
download | mpv-f482d214a7a1549203b7eca30d275a06341a892c.tar.bz2 mpv-f482d214a7a1549203b7eca30d275a06341a892c.tar.xz |
DMO support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8296 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vd_dmo.c')
-rw-r--r-- | libmpcodecs/vd_dmo.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/libmpcodecs/vd_dmo.c b/libmpcodecs/vd_dmo.c new file mode 100644 index 0000000000..654520e005 --- /dev/null +++ b/libmpcodecs/vd_dmo.c @@ -0,0 +1,90 @@ +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> + +#include "config.h" +#ifdef USE_DIRECTSHOW + +#include "mp_msg.h" +#include "help_mp.h" + +#include "vd_internal.h" + +#include "loader/dmo/DMO_VideoDecoder.h" + +static vd_info_t info = { + "DMO video codecs", + "dmo", + "A'rpi", + "based on http://avifile.sf.net", + "win32 codecs" +}; + +LIBVD_EXTERN(dmo) + +// to set/get/query special features/parameters +static int control(sh_video_t *sh,int cmd,void* arg,...){ + return CONTROL_UNKNOWN; +} + +// init driver +static int init(sh_video_t *sh){ + unsigned int out_fmt; + if(!(sh->context=DMO_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; + } + if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; + out_fmt=sh->codec->outfmt[sh->outfmtidx]; + switch(out_fmt){ + case IMGFMT_YUY2: + case IMGFMT_UYVY: + DMO_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + DMO_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV + case IMGFMT_YVU9: + DMO_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break; + default: + DMO_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR + } + DMO_VideoDecoder_StartInternal(sh->context); + mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DMOhow video codec init OK!\n"); + return 1; +} + +// uninit driver +static void uninit(sh_video_t *sh){ + DMO_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: + DMO_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; + } + + DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 1, mpi->planes[0]); + + return mpi; +} + +#endif |