Skip to content

Commit

Permalink
avformat/mux: add ff_get_muxer_ts_offset()
Browse files Browse the repository at this point in the history
Will be useful in the next patch

Signed-off-by: James Almer <[email protected]>
  • Loading branch information
jamrial committed Feb 13, 2021
1 parent a80fbbd commit 93e2fa9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions libavformat/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf
int ff_interleaved_peek(AVFormatContext *s, int stream,
AVPacket *pkt, int add_offset);

int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset);

int ff_lock_avformat(void);
int ff_unlock_avformat(void);
Expand Down
16 changes: 16 additions & 0 deletions libavformat/mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 93e2fa9

Please sign in to comment.