From 27ca0a79c9d68059cdac610cdddb7039e6281529 Mon Sep 17 00:00:00 2001 From: Ivan Schreter Date: Tue, 24 Feb 2009 22:19:09 +0000 Subject: Add timestamp computation if values are exported by decoder. Patch by Ivan Schreter, schreter gmx net Originally committed as revision 17574 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/avcodec.h | 43 ++++++++++++++++++++++++++++++++++++++++++- libavcodec/parser.c | 3 +++ 2 files changed, 45 insertions(+), 1 deletion(-) (limited to 'libavcodec') diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index d4bbe29b82..5a81a379e3 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -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 @@ typedef struct AVCodecParserContext { * 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 { diff --git a/libavcodec/parser.c b/libavcodec/parser.c index a0d604dabe..d738a62b83 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -75,6 +75,9 @@ AVCodecParserContext *av_parser_init(int codec_id) 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; } -- cgit v1.2.3