diff options
author | Marton Balint <cus@passwd.hu> | 2020-04-28 00:39:40 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-05-07 23:12:24 +0200 |
commit | 8360fd26105f58fbec9fb8edeaa5755160c9994f (patch) | |
tree | 4daf815e8f267048d8f070e9c3f3023f0fd80f67 /libavformat/mxfenc.c | |
parent | c5324d92c5f206dcdc2cf93ae237eaa7c1ad0a40 (diff) | |
download | ffmpeg-8360fd26105f58fbec9fb8edeaa5755160c9994f.tar.gz |
avformat: implement retiming directly in mxfenc and gxfenc
Generic retime functionality is replaced by a few lines of code directly in the
muxers which used it, which seems a lot easier to understand and this way the
retiming is not dependant of the input durations.
Also remove retimeinterleave, since it is not used by anything anymore.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/mxfenc.c')
-rw-r--r-- | libavformat/mxfenc.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 63a2799b08..c3b6809e98 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -52,7 +52,6 @@ #include "libavcodec/h264_ps.h" #include "libavcodec/golomb.h" #include "libavcodec/internal.h" -#include "retimeinterleave.h" #include "avformat.h" #include "avio_internal.h" #include "internal.h" @@ -79,7 +78,7 @@ typedef struct MXFIndexEntry { } MXFIndexEntry; typedef struct MXFStreamContext { - RetimeInterleaveContext aic; + int64_t pkt_cnt; ///< pkt counter for muxed packets UID track_essence_element_key; int index; ///< index in mxf_essence_container_uls table const UID *codec_ul; @@ -2598,7 +2597,6 @@ static int mxf_write_header(AVFormatContext *s) return -1; } } - ff_retime_interleave_init(&sc->aic, av_inv_q(mxf->tc.rate)); if (sc->index == -1) { sc->index = mxf_get_essence_container_ul_index(st->codecpar->codec_id); @@ -3087,8 +3085,14 @@ static int mxf_compare_timestamps(AVFormatContext *s, const AVPacket *next, static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush) { - return ff_retime_interleave(s, out, pkt, flush, - mxf_interleave_get_packet, mxf_compare_timestamps); + int ret; + if (pkt) { + MXFStreamContext *sc = s->streams[pkt->stream_index]->priv_data; + pkt->pts = pkt->dts = sc->pkt_cnt++; + if ((ret = ff_interleave_add_packet(s, pkt, mxf_compare_timestamps)) < 0) + return ret; + } + return mxf_interleave_get_packet(s, out, NULL, flush); } #define MXF_COMMON_OPTIONS \ |