[FFmpeg-devel] [PATCH 2/3] lavc: add pkt_timbase to allow avcodec to adjust pkt_dts/pts when needed
Michael Niedermayer
michaelni at gmx.at
Thu Jul 12 22:32:43 CEST 2012
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavcodec/avcodec.h | 12 ++++++++++++
libavcodec/options_table.h | 1 +
libavcodec/utils.c | 2 ++
3 files changed, 15 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c9419ef..0a36463 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2943,6 +2943,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
@@ -2953,6 +2962,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 a4742d0..8bc7191 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -405,6 +405,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 25267da..e435c05 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));
--
1.7.9.5
More information about the ffmpeg-devel
mailing list