summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vd_divx4.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-07 00:44:58 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-07 00:44:58 +0000
commit15222e9be6f4200bedb966db3ff5cf64a1866345 (patch)
tree6633667b05e50518ef51287e9a6adf083e5f8fc4 /libmpcodecs/vd_divx4.c
parentc14ad3978a8593f7899b20618cd4e11da921068f (diff)
downloadmpv-15222e9be6f4200bedb966db3ff5cf64a1866345.tar.bz2
mpv-15222e9be6f4200bedb966db3ff5cf64a1866345.tar.xz
vfw, vfwex, odivx, divx4 added
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4969 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vd_divx4.c')
-rw-r--r--libmpcodecs/vd_divx4.c127
1 files changed, 127 insertions, 0 deletions
diff --git a/libmpcodecs/vd_divx4.c b/libmpcodecs/vd_divx4.c
new file mode 100644
index 0000000000..edb3bed0c8
--- /dev/null
+++ b/libmpcodecs/vd_divx4.c
@@ -0,0 +1,127 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
+
+#ifdef USE_DIVX
+#ifdef NEW_DECORE
+
+#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"
+
+static vd_info_t info = {
+#ifdef DECORE_DIVX5
+ "DivX5Linux lib (divx4 mode)",
+#else
+ "DivX4Linux lib (divx4 mode)",
+#endif
+ "divx4",
+ VFM_DIVX4,
+ "A'rpi",
+ "http://www.divx.com",
+ "native codecs"
+};
+
+LIBVD_EXTERN(divx4)
+
+#include <decore.h>
+
+// 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; // for divx4linux
+ case VDCTRL_SET_PP_LEVEL: {
+ DEC_SET dec_set;
+ int quality=*((int*)arg);
+ if(quality<0 || quality>9) quality=9;
+ dec_set.postproc_level=quality*10;
+ decore(0x123,DEC_OPT_SETPP,&dec_set,NULL);
+ return CONTROL_OK;
+ }
+
+ }
+
+ return CONTROL_UNKNOWN;
+}
+
+// init driver
+static int init(sh_video_t *sh){
+ DEC_PARAM dec_param;
+// DEC_SET dec_set;
+ int bits=16;
+ memset(&dec_param,0,sizeof(dec_param));
+
+ mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2);
+
+ switch(sh->codec->outfmt[sh->outfmtidx]){
+ case IMGFMT_YV12: dec_param.output_format=DEC_YV12;bits=12;break;
+ case IMGFMT_YUY2: dec_param.output_format=DEC_YUY2;break;
+ case IMGFMT_UYVY: dec_param.output_format=DEC_UYVY;break;
+ case IMGFMT_I420: dec_param.output_format=DEC_420;bits=12;break;
+ case IMGFMT_BGR15: dec_param.output_format=DEC_RGB555_INV;break;
+ case IMGFMT_BGR16: dec_param.output_format=DEC_RGB565_INV;break;
+ case IMGFMT_BGR24: dec_param.output_format=DEC_RGB24_INV;bits=24;break;
+ case IMGFMT_BGR32: dec_param.output_format=DEC_RGB32_INV;bits=32;break;
+ default:
+ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",sh->codec->outfmt[sh->outfmtidx]);
+ return 0;
+ }
+ dec_param.x_dim = sh->disp_w;
+ dec_param.y_dim = sh->disp_h;
+ decore(0x123, DEC_OPT_INIT, &dec_param, NULL);
+// dec_set.postproc_level = divx_quality;
+// decore(0x123, DEC_OPT_SETPP, &dec_set, NULL);
+
+ mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: DivX4Linux video codec init OK!\n");
+
+ return 1;
+}
+
+// uninit driver
+static void uninit(sh_video_t *sh){
+ decore(0x123,DEC_OPT_RELEASE,NULL,NULL);
+}
+
+//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;
+ DEC_FRAME dec_frame;
+
+ if(len<=0) return NULL; // skipped frame
+
+ dec_frame.length = len;
+ dec_frame.bitstream = data;
+ dec_frame.render_flag = (flags&3)?0:1;
+
+ mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_PRESERVE | MP_IMGFLAG_ACCEPT_WIDTH,
+ sh->disp_w, sh->disp_h);
+ if(!mpi) return NULL;
+
+ dec_frame.bmp=mpi->planes[0];
+ dec_frame.stride=mpi->width;
+
+#ifdef DECORE_DIVX5
+ decore(0x123, DEC_OPT_FRAME, &dec_frame, NULL);
+#else
+ decore(0x123, (sh->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL);
+#endif
+
+ return mpi;
+}
+
+#endif
+#endif
+