[MPlayer-cvslog] r32036 - in trunk/libmpcodecs: dec_video.c mp_image.h vd_ffmpeg.c

cehoyos subversion at mplayerhq.hu
Tue Aug 31 01:24:57 CEST 2010


Author: cehoyos
Date: Tue Aug 31 01:24:56 2010
New Revision: 32036

Log:
Improve correct-pts with PAFF streams.

Patch by Pásztor Szilárd, bartosteka freemail hu

Modified:
   trunk/libmpcodecs/dec_video.c
   trunk/libmpcodecs/mp_image.h
   trunk/libmpcodecs/vd_ffmpeg.c

Modified: trunk/libmpcodecs/dec_video.c
==============================================================================
--- trunk/libmpcodecs/dec_video.c	Mon Aug 30 22:07:34 2010	(r32035)
+++ trunk/libmpcodecs/dec_video.c	Tue Aug 31 01:24:56 2010	(r32036)
@@ -394,8 +394,21 @@ void *decode_video(sh_video_t *sh_video,
     unsigned int t = GetTimer();
     unsigned int t2;
     double tt;
+    int delay;
+    int got_picture = 1;
 
-    if (correct_pts && pts != MP_NOPTS_VALUE) {
+    mpi = mpvdec->decode(sh_video, start, in_size, drop_frame);
+
+    //------------------------ frame decoded. --------------------
+
+    if (mpi && mpi->type == MP_IMGTYPE_INCOMPLETE) {
+	got_picture = 0;
+	mpi = NULL;
+    }
+
+    delay = get_current_video_decoder_lag(sh_video);
+    if (correct_pts && pts != MP_NOPTS_VALUE
+        && (got_picture || sh_video->num_buffered_pts < delay)) {
         if (sh_video->num_buffered_pts ==
             sizeof(sh_video->buffered_pts) / sizeof(double))
             mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n");
@@ -411,10 +424,6 @@ void *decode_video(sh_video_t *sh_video,
         }
     }
 
-    mpi = mpvdec->decode(sh_video, start, in_size, drop_frame);
-
-    //------------------------ frame decoded. --------------------
-
 #if HAVE_MMX
     // some codecs are broken, and doesn't restore MMX state :(
     // it happens usually with broken/damaged files.
@@ -439,7 +448,6 @@ void *decode_video(sh_video_t *sh_video,
         mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
 
     if (correct_pts) {
-        int delay = get_current_video_decoder_lag(sh_video);
         if (sh_video->num_buffered_pts) {
             sh_video->num_buffered_pts--;
             sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts];

Modified: trunk/libmpcodecs/mp_image.h
==============================================================================
--- trunk/libmpcodecs/mp_image.h	Mon Aug 30 22:07:34 2010	(r32035)
+++ trunk/libmpcodecs/mp_image.h	Tue Aug 31 01:24:56 2010	(r32036)
@@ -86,6 +86,10 @@
 #define MP_IMGTYPE_IPB 4
 // Upper 16 bits give desired buffer number, -1 means get next available
 #define MP_IMGTYPE_NUMBERED 5
+// Doesn't need any buffer, incomplete image (probably a first field only)
+// we need this type to be able to differentiate between half frames and
+// all other cases
+#define MP_IMGTYPE_INCOMPLETE 6
 
 #define MP_MAX_PLANES	4
 

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Mon Aug 30 22:07:34 2010	(r32035)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Tue Aug 31 01:24:56 2010	(r32036)
@@ -103,6 +103,11 @@ static int lavc_param_threads=1;
 static int lavc_param_bitexact=0;
 static char *lavc_avopt = NULL;
 
+static const mp_image_t mpi_no_picture =
+{
+	.type = MP_IMGTYPE_INCOMPLETE
+};
+
 const m_option_t lavc_decode_opts_conf[]={
     {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, -1, 999999, NULL},
     {"er", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
@@ -901,7 +906,12 @@ static mp_image_t *decode(sh_video_t *sh
     }
 //--
 
-    if(!got_picture) return NULL;        // skipped image
+    if(!got_picture) {
+	if (avctx->codec->id == CODEC_ID_H264)
+	    return &mpi_no_picture; // H.264 first field only
+	else
+	    return NULL;    // skipped image
+    }
 
     if(init_vo(sh, avctx->pix_fmt) < 0) return NULL;
 


More information about the MPlayer-cvslog mailing list