summaryrefslogtreecommitdiff
path: root/libavformat/mux.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-07 22:59:00 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-07 23:09:30 +0100
commit66e49ff3b923c6feee8e6e3d73ae3c76708aa5f2 (patch)
tree5bb39ad7b744235495831856d4c1d5aa4635c3d0 /libavformat/mux.c
parented736890d6a71606e1833a9707da52322f4e046e (diff)
parent1384df641994bf3d6cb51084290aa94752737bae (diff)
Merge commit '1384df641994bf3d6cb51084290aa94752737bae'
* commit '1384df641994bf3d6cb51084290aa94752737bae': lavf: Add an option for avoiding negative timestamps Conflicts: libavformat/avformat.h libavformat/mux.c libavformat/options_table.h libavformat/version.h See: 3ba0dab76ac32f0c9f50c916a73bc64e43c1fdf9 See: a89c01253190b9eb9de8e28a3252423bf7732511 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r--libavformat/mux.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 6c77f3b526..8c3360ad92 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -419,10 +419,11 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
return ret;
if (s->avoid_negative_ts < 0) {
+ av_assert2(s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO);
if (s->oformat->flags & (AVFMT_TS_NEGATIVE | AVFMT_NOTIMESTAMPS)) {
s->avoid_negative_ts = 0;
} else
- s->avoid_negative_ts = 1;
+ s->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE;
}
return 0;
@@ -556,7 +557,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
AVStream *st = s->streams[pkt->stream_index];
int64_t offset = st->mux_ts_offset;
- if ((pkt->dts < 0 || s->avoid_negative_ts == 2) && pkt->dts != AV_NOPTS_VALUE && !s->offset) {
+ if (!s->offset && pkt->dts != AV_NOPTS_VALUE &&
+ (pkt->dts < 0 || s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO)) {
s->offset = -pkt->dts;
s->offset_timebase = st->time_base;
}