[FFmpeg-cvslog] r21562 - in trunk/libavformat: avformat.h options.c utils.c

michael subversion
Sat Jan 30 23:55:12 CET 2010


Author: michael
Date: Sat Jan 30 23:55:12 2010
New Revision: 21562

Log:
Flag to ignore dts on frames that contain pts.
This works around common issues with mpeg-ps files with broken timestamps.
Also allows playing the broken sample from issue1024.

Modified:
   trunk/libavformat/avformat.h
   trunk/libavformat/options.c
   trunk/libavformat/utils.c

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	Sat Jan 30 23:47:08 2010	(r21561)
+++ trunk/libavformat/avformat.h	Sat Jan 30 23:55:12 2010	(r21562)
@@ -604,6 +604,7 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_GENPTS       0x0001 ///< Generate missing pts even if it requires parsing future frames.
 #define AVFMT_FLAG_IGNIDX       0x0002 ///< Ignore index.
 #define AVFMT_FLAG_NONBLOCK     0x0004 ///< Do not block when reading packets from input.
+#define AVFMT_FLAG_IGNDTS       0x0008 ///< Ignore DTS on frames that contain both DTS & PTS
 
     int loop_input;
     /** decoding: size of data to probe; encoding: unused. */

Modified: trunk/libavformat/options.c
==============================================================================
--- trunk/libavformat/options.c	Sat Jan 30 23:47:08 2010	(r21561)
+++ trunk/libavformat/options.c	Sat Jan 30 23:55:12 2010	(r21562)
@@ -46,6 +46,7 @@ static const AVOption options[]={
 {"fflags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, D|E, "fflags"},
 {"ignidx", "ignore index", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNIDX, INT_MIN, INT_MAX, D, "fflags"},
 {"genpts", "generate pts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_GENPTS, INT_MIN, INT_MAX, D, "fflags"},
+{"igndts", "ingore dts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNDTS, INT_MIN, INT_MAX, D, "fflags"},
 #if LIBAVFORMAT_VERSION_INT < (53<<16)
 {"track", " set the track number", OFFSET(track), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
 {"year", "set the year", OFFSET(year), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, E},

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Sat Jan 30 23:47:08 2010	(r21561)
+++ trunk/libavformat/utils.c	Sat Jan 30 23:55:12 2010	(r21562)
@@ -808,6 +808,9 @@ static void compute_pkt_fields(AVFormatC
     int num, den, presentation_delayed, delay, i;
     int64_t offset;
 
+    if((s->flags & AVFMT_FLAG_IGNDTS) && pkt->pts != AV_NOPTS_VALUE)
+        pkt->dts= AV_NOPTS_VALUE;
+
     if (st->codec->codec_id != CODEC_ID_H264 && pc && pc->pict_type == FF_B_TYPE)
         //FIXME Set low_delay = 0 when has_b_frames = 1
         st->codec->has_b_frames = 1;



More information about the ffmpeg-cvslog mailing list