diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-01 14:19:07 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-05 20:36:22 +0200 |
commit | bca4fef46a6b0a6f5c31840c4c03303a329dbbe9 (patch) | |
tree | 3f83cfe4dd4702c0b8416a3f8aceef1c560f74c3 /libavformat | |
parent | 1a8309e954b894675aa450db5c117240195385a9 (diff) |
avformat/matroskaenc: Use custom min timestamp
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/matroskaenc.c | 1 | ||||
-rw-r--r-- | libavformat/webm_chunk.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 0ded53dc21..97dcff5607 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1841,6 +1841,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, track->ts_offset = av_rescale_q(par->initial_padding, (AVRational){ 1, par->sample_rate }, st->time_base); + ffstream(st)->lowest_ts_allowed = -track->ts_offset; } if (par->codec_id == AV_CODEC_ID_OPUS) put_ebml_uint(pb, MATROSKA_ID_SEEKPREROLL, OPUS_SEEK_PREROLL); diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c index 9e71a1209d..916ed0cbab 100644 --- a/libavformat/webm_chunk.c +++ b/libavformat/webm_chunk.c @@ -127,6 +127,7 @@ fail: ffformatcontext(s)->avoid_negative_ts_use_pts = ffformatcontext(oc)->avoid_negative_ts_use_pts; oc->avoid_negative_ts = AVFMT_AVOID_NEG_TS_DISABLED; + ffformatcontext(oc)->avoid_negative_ts_status = AVOID_NEGATIVE_TS_DISABLED; return 0; } @@ -149,10 +150,13 @@ static int webm_chunk_write_header(AVFormatContext *s) { WebMChunkContext *wc = s->priv_data; AVFormatContext *oc = wc->avf; + AVStream *st = s->streams[0], *ost = oc->streams[0]; int ret; ret = avformat_write_header(oc, NULL); ff_format_io_close(s, &oc->pb); + ffstream(st)->lowest_ts_allowed = ffstream(ost)->lowest_ts_allowed; + ffstream(ost)->lowest_ts_allowed = 0; wc->header_written = 1; if (ret < 0) return ret; |