changeset 4460:7de7c849dccf

Use DIRECT RENDERING WITH DSHOW codecs
author nick
date Fri, 01 Feb 2002 10:59:06 +0000
parents 71b864031c3f
children daf81b7e8b3d
files dec_video.c
diffstat 1 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dec_video.c	Fri Feb 01 10:20:00 2002 +0000
+++ b/dec_video.c	Fri Feb 01 10:59:06 2002 +0000
@@ -733,6 +733,11 @@
 unsigned int out_fmt=mpi->imgfmt; //sh_video->codec->outfmt[sh_video->outfmtidx];
 int planar=(mpi->flags&MP_IMGFLAG_PLANAR)!=0; //(out_fmt==IMGFMT_YV12||out_fmt==IMGFMT_IYUV||out_fmt==IMGFMT_I420);
 int blit_frame=0;
+bes_da_t bda;
+void *vmem;
+int use_dr;
+int painted;
+static int double_buff_num = 0;
 
 //uint8_t* planes_[3];
 //uint8_t** planes=planes_;
@@ -742,6 +747,10 @@
 unsigned int t=GetTimer();
 unsigned int t2;
 
+memset(&bda,0,sizeof(bes_da_t));
+painted = 0;
+  if(vo_vaa.query_bes_da)
+    use_dr = vo_vaa.query_bes_da(&bda) ? 0 : 1;
 #ifdef USE_MP_IMAGE
 if(mpi->type!=MP_IMGTYPE_EXPORT)
 if( !(mpi->flags&MP_IMGFLAG_ALLOCATED) && !(mpi->flags&MP_IMGFLAG_DIRECT) ){
@@ -859,7 +868,22 @@
 #ifdef USE_DIRECTSHOW
   case VFM_DSHOW: {        // W32/DirectShow
     if(drop_frame<2)
-	DS_VideoDecoder_DecodeInternal(ds_vdec, start, in_size, 0, drop_frame ? 0 : sh_video->our_out_buffer);
+    {
+	/* FIXME: WILL WORK ONLY FOR PACKED FOURCC. BUT WHAT ABOUT PLANAR? */
+        vmem = 0;
+	if(use_dr && bda.dest.pitch.y == 16)
+	{
+	    vmem = bda.dga_addr + bda.offsets[0] + bda.offset.y;
+	    if(vo_doublebuffering && bda.num_frames>1)
+	    {
+		if(double_buff_num) vmem = bda.dga_addr + bda.offsets[1] + bda.offset.y;
+		else		    vmem = bda.dga_addr + bda.offsets[0] + bda.offset.y;
+		double_buff_num = double_buff_num ? 0 : 1;
+	    }
+	}
+	DS_VideoDecoder_DecodeInternal(ds_vdec, start, in_size, 0, drop_frame ? 0 : vmem ? vmem : sh_video->our_out_buffer);
+	if(vmem) painted = 1;
+    }
     if(!drop_frame && sh_video->our_out_buffer) blit_frame=3;
     break;
   }
@@ -1070,7 +1094,7 @@
 #endif
 
 t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f;
-
+if(painted) return 1;
 switch(blit_frame){
 case 3:
       if(planar){