summaryrefslogtreecommitdiff
path: root/libavformat/mux.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-02-08 18:30:47 -0300
committerJames Almer <jamrial@gmail.com>2021-02-13 13:01:48 -0300
commit93e2fa933f1625f488a2d88f9d50254ef13401d2 (patch)
tree0a97fdf898e0efbcf1e67e9e5b3d00d577eab79f /libavformat/mux.c
parenta80fbbdab5becb82de11983f1ee61014ce2d85b0 (diff)
downloadffmpeg-93e2fa933f1625f488a2d88f9d50254ef13401d2.tar.gz
avformat/mux: add ff_get_muxer_ts_offset()
Will be useful in the next patch Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r--libavformat/mux.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 84c56ac6ba..ae46844c66 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1046,6 +1046,22 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
}
}
+int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset)
+{
+ AVStream *st;
+
+ if (stream_index < 0 || stream_index >= s->nb_streams)
+ return AVERROR(EINVAL);
+
+ st = s->streams[stream_index];
+ *offset = st->internal->mux_ts_offset;
+
+ if (s->output_ts_offset)
+ *offset += av_rescale_q(s->output_ts_offset, AV_TIME_BASE_Q, st->time_base);
+
+ return 0;
+}
+
int ff_interleaved_peek(AVFormatContext *s, int stream,
AVPacket *pkt, int add_offset)
{