[MPlayer-dev-eng] vo_yuv4mpeg first green frames patch proposal

Stéphane BERTHELOT sberthelot at hybridperception.com
Thu Aug 31 14:26:54 CEST 2006


Hi everyone,

I reviewed some posts from 2003 that talked about this problem but using 
the recent 1.0pre8 the patch does not "do it" anymore.
I don't know exactly why I get 2 green (all 0x00) frames playing from a 
dvd source (vob) that has been split in the middle of the movie (not in 
a blank or scene change so it's really annoying on playback).
To be able to put the whole movie again without having this very 
annoying first green frame in a sequence I investigated in vo_yuv4mpeg.c 
code.

The decoder seems to somehow call the control function with 
VOCTRL_DUPLICATE_FRAME as first argument (request).

Then this patch simply tests if we are trying to duplicate frames before 
having ever displayed any non-duplicate frame and thus discards them.
I don't know if it's really the right thing to do (tm) but reading again 
last posts on this problem it seems some decoders actually start with a 
real frame and some with an empty one.
At least it seems to do it right for me now.

Feel free to comment or modify code as I am no mplayer decoder engine 
nor libvo expert but I'm really annoyed with those first green frames 
every time I do yuv4mpeg.

Regards,
Stéphane.


diff -Nrup libvo/vo_yuv4mpeg.c.orig libvo/vo_yuv4mpeg.c
--- libvo/vo_yuv4mpeg.c.orig    2006-08-31 14:14:27.000000000 +0200
+++ libvo/vo_yuv4mpeg.c 2006-08-31 14:03:16.000000000 +0200
@@ -70,6 +70,8 @@ static int using_format = 0;
 static FILE *yuv_out;
 static int write_bytes;

+static int first_frame = 1;
+
 #define Y4M_ILACE_NONE         'p'  /* non-interlaced, progressive frame */
 #define Y4M_ILACE_TOP_FIRST    't'  /* interlaced, top-field first       */
 #define Y4M_ILACE_BOTTOM_FIRST 'b'  /* interlaced, bottom-field first    */
@@ -305,6 +307,9 @@ static void flip_page (void)
        int rgb_stride, uv_stride, field_height;
        unsigned int i, low_ofs;

+        // We are writing the first non empty frame
+        first_frame=0;
+
        fprintf(yuv_out, "FRAME\n");

        if (using_format != IMGFMT_YV12)
@@ -542,7 +547,14 @@ static int control(uint32_t request, voi
   case VOCTRL_QUERY_FORMAT:
     return query_format(*((uint32_t*)data));
   case VOCTRL_DUPLICATE_FRAME:
-    return write_last_frame();
+    if (first_frame)
+      {
+       return VO_TRUE;
+      }
+    else
+      {
+       return write_last_frame();
+      }
   }
   return VO_NOTIMPL;
 }

-- 
Stéphane BERTHELOT
Hybrid Perception
- Réseau : Sécurité et Serveurs , Développements métier et spécifiques -
38-40 rue Emile Bertin, 54000 NANCY, France
http://www.hybridperception.com
Tel/Fax. 03 83 27 21 61
Portable 06 70 23 97 60
Rédacteur sur le Blog Numérique Lorrain <http://www.le-bnl.info>




More information about the MPlayer-dev-eng mailing list