diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-12 22:17:10 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-13 20:35:08 +0200 |
commit | 0eb0b310c4409658e3e31c72ea093613f3364f01 (patch) | |
tree | 8c9de57b65d509c4818383f506fc78fa685b71a5 | |
parent | cb59e62abbf0d7a04fecb04ff7dd3463fa73b8ce (diff) | |
download | ffmpeg-0eb0b310c4409658e3e31c72ea093613f3364f01.tar.gz |
lavc: add pkt_timebase to allow avcodec to adjust pkt_dts/pts when needed
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/avcodec.h | 12 | ||||
-rw-r--r-- | libavcodec/options_table.h | 1 | ||||
-rw-r--r-- | libavcodec/utils.c | 2 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
4 files changed, 16 insertions, 1 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 17951b5e4a..045ab8b4b4 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2947,6 +2947,15 @@ typedef struct AVCodecContext { uint64_t vbv_delay; /** + * Timebase in which pkt_dts/pts and AVPacket.dts/pts are. + * Code outside libavcodec should access this field using: + * avcodec_set_pkt_timebase(avctx) + * - encoding unused. + * - decodimg set by user + */ + AVRational pkt_timebase; + + /** * Current statistics for PTS correction. * - decoding: maintained and used by libavcodec, not intended to be used by user apps * - encoding: unused @@ -2957,6 +2966,9 @@ typedef struct AVCodecContext { int64_t pts_correction_last_dts; /// DTS of the last frame } AVCodecContext; +AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); +void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); + /** * AVProfile. */ diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 4021056413..1c2093686c 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -409,6 +409,7 @@ static const AVOption options[]={ {"s32p", "32-bit signed integer planar", 0, AV_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_S32P }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, {"fltp", "32-bit float planar", 0, AV_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_FLTP }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, {"dblp", "64-bit double planar", 0, AV_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_DBLP }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, +{"pkt_timebase", NULL, OFFSET(pkt_timebase), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0, INT_MAX, 0}, {NULL}, }; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 5afa3e7e97..abb5674e7f 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -726,6 +726,8 @@ MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos) MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout) MAKE_ACCESSORS(AVFrame, frame, int, sample_rate) +MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase) + static void avcodec_get_subtitle_defaults(AVSubtitle *sub) { memset(sub, 0, sizeof(*sub)); diff --git a/libavcodec/version.h b/libavcodec/version.h index 5735e4121d..6015a315c2 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -27,7 +27,7 @@ */ #define LIBAVCODEC_VERSION_MAJOR 54 -#define LIBAVCODEC_VERSION_MINOR 35 +#define LIBAVCODEC_VERSION_MINOR 36 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |