summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/dec_video.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-01 00:26:10 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-01 00:26:10 +0000
commitca3c4888c6d43dbca5a344b37b07f8bd50fbf365 (patch)
treebc76df3ad8102bf2e2621771bb4d2b6f94813278 /libmpcodecs/dec_video.c
parent9ae3af3b341ff861185f1f491630372be442df77 (diff)
downloadmpv-ca3c4888c6d43dbca5a344b37b07f8bd50fbf365.tar.bz2
mpv-ca3c4888c6d43dbca5a344b37b07f8bd50fbf365.tar.xz
implemented basic wrapper functions to new libmpcodecs api
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4903 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/dec_video.c')
-rw-r--r--libmpcodecs/dec_video.c62
1 files changed, 45 insertions, 17 deletions
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c
index 6a0c2fb20d..f116a8d8d2 100644
--- a/libmpcodecs/dec_video.c
+++ b/libmpcodecs/dec_video.c
@@ -25,10 +25,24 @@ extern int verbose; // defined in mplayer.c
#include "libvo/video_out.h"
#include "stheader.h"
+#include "vd.h"
#include "dec_video.h"
// ===================================================================
+// temp hack:
+
+#ifdef FF_POSTPROCESS
+#ifndef MBC
+#define MBC 48
+#define MBR 36
+#endif
+int quant_store[MBR+1][MBC+1]; // [Review]
+#endif
+
+int avcodec_inited=0;
+
+// ===================================================================
extern int benchmark;
extern double video_time_usage;
@@ -45,6 +59,8 @@ extern vo_vaa_t vo_vaa;
int divx_quality=0;
+static vd_functions_t* mpvdec=NULL;
+
int get_video_quality_max(sh_video_t *sh_video){
// switch(sh_video->codec->driver){
return 0;
@@ -111,24 +127,32 @@ int set_video_colors(sh_video_t *sh_video,char *item,int value)
void uninit_video(sh_video_t *sh_video){
if(!sh_video->inited) return;
mp_msg(MSGT_DECVIDEO,MSGL_V,"uninit video: %d \n",sh_video->codec->driver);
-// switch(sh_video->codec->driver){
+ mpvdec->uninit(sh_video);
sh_video->inited=0;
}
int init_video(sh_video_t *sh_video,int *pitches)
{
-unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx];
+//unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx];
+int i;
pitches[0] = pitches[1] =pitches[2] = 0; /* fake unknown */
-sh_video->our_out_buffer=NULL;
-sh_video->our_out_buffer_size=0U;
-
-sh_video->image=new_mp_image(sh_video->disp_w,sh_video->disp_h);
-mp_image_setfmt(sh_video->image,out_fmt);
-
-//switch(sh_video->codec->driver)
-
+//sh_video->our_out_buffer=NULL;
+//sh_video->our_out_buffer_size=0U;
+ for (i=0; mpcodecs_vd_drivers[i] != NULL; i++)
+ if(mpcodecs_vd_drivers[i]->info->id==sh_video->codec->driver){
+ mpvdec=mpcodecs_vd_drivers[i]; break;
+ }
+ if(!mpvdec) return 0; // no such driver
+
+ printf("Selecting Video Decoder: [%s] %s\n",mpvdec->info->short_name,mpvdec->info->name);
+
+ if(!mpvdec->init(sh_video)){
+ printf("VDecoder init failed :(\n");
+ return 0;
+ }
+
sh_video->inited=1;
return 1;
}
@@ -161,7 +185,8 @@ unsigned int t=GetTimer();
unsigned int t2;
double tt;
-
+mpi=mpvdec->decode(sh_video, start, in_size, drop_frame);
+
//------------------------ frame decoded. --------------------
#ifdef ARCH_X86
@@ -175,6 +200,8 @@ else if(gCpuCaps.hasMMX){
}
#endif
+if(!mpi) return 0; // error / skipped frame
+
t2=GetTimer();t=t2-t;
tt = t*0.000001f;
video_time_usage+=tt;
@@ -184,11 +211,13 @@ if(benchmark)
cur_video_time_usage=tt;
}
-if(mpi){
-// if(planar)
-// video_out->draw_slice(mpi->planes,mpi->stride,sh_video->disp_w,sh_video->disp_h,0,0);
-// else
-// video_out->draw_frame(mpi->planes);
+if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALBACK))){
+ // blit frame:
+ if(mpi->flags&MP_IMGFLAG_PLANAR)
+ video_out->draw_slice(mpi->planes,mpi->stride,sh_video->disp_w,sh_video->disp_h,0,0);
+ else
+ video_out->draw_frame(mpi->planes);
+}
t2=GetTimer()-t2;
tt=t2*0.000001f;
@@ -199,7 +228,6 @@ if(mpi){
cur_vout_time_usage=tt;
}
blit_frame=1;
-}
return blit_frame;
}