changeset 9038:d4c12f2d226b libavcodec

Add timestamp computation if values are exported by decoder. Patch by Ivan Schreter, schreter gmx net
author cehoyos
date Tue, 24 Feb 2009 22:19:09 +0000
parents e2f94ff2f2e3
children d4002371b3d2
files avcodec.h parser.c
diffstat 2 files changed, 45 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/avcodec.h	Tue Feb 24 22:19:02 2009 +0000
+++ b/avcodec.h	Tue Feb 24 22:19:09 2009 +0000
@@ -30,7 +30,7 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 18
+#define LIBAVCODEC_VERSION_MINOR 19
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -3147,6 +3147,47 @@
      * subtitles are correctly displayed after seeking.
      */
     int64_t convergence_duration;
+
+    // Timestamp generation support:
+    /**
+     * Synchronization point for start of timestamp generation.
+     *
+     * Set to >0 for sync point, 0 for no sync point and <0 for undefined
+     * (default).
+     *
+     * For example, this corresponds to presence of H.264 buffering period
+     * SEI message.
+     */
+    int dts_sync_point;
+
+    /**
+     * Offset of the current timestamp against last timestamp sync point in
+     * units of AVCodecContext.time_base.
+     *
+     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
+     * contain a valid timestamp offset.
+     *
+     * Note that the timestamp of sync point has usually a nonzero
+     * dts_ref_dts_delta, which refers to the previous sync point. Offset of
+     * the next frame after timestamp sync point will be usually 1.
+     *
+     * For example, this corresponds to H.264 cpb_removal_delay.
+     */
+    int dts_ref_dts_delta;
+
+    /**
+     * Presentation delay of current frame in units of AVCodecContext.time_base.
+     *
+     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
+     * contain valid non-negative timestamp delta (presentation time of a frame
+     * must not lie in the past).
+     *
+     * This delay represents the difference between decoding and presentation
+     * time of the frame.
+     *
+     * For example, this corresponds to H.264 dpb_output_delay.
+     */
+    int pts_dts_delta;
 } AVCodecParserContext;
 
 typedef struct AVCodecParser {
--- a/parser.c	Tue Feb 24 22:19:02 2009 +0000
+++ b/parser.c	Tue Feb 24 22:19:09 2009 +0000
@@ -75,6 +75,9 @@
     s->pict_type = FF_I_TYPE;
     s->key_frame = -1;
     s->convergence_duration = AV_NOPTS_VALUE;
+    s->dts_sync_point       = INT_MIN;
+    s->dts_ref_dts_delta    = INT_MIN;
+    s->pts_dts_delta        = INT_MIN;
     return s;
 }