summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-26 11:52:51 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-26 14:51:47 +0200
commiteba33396f007dc373678adea6c1a4b1a50373263 (patch)
tree382ac0d8e1569344058cf0f0c3b259405514d0b4 /libavformat
parente5891a23372d542c81a8ee7e15844ed444ffc962 (diff)
avformat/mux: set avoid_negative_ts based on flags if not overridden by user or muxer
This changes the default to avoid negative timestamps. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avformat.h5
-rw-r--r--libavformat/mux.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d26964a165..c8f4912fd5 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -370,7 +370,10 @@ typedef struct AVProbeData {
timestamps. If not set the timestamp
will be shifted in av_write_frame and
av_interleaved_write_frame so they
- start from 0. */
+ start from 0.
+ The user or muxer can override this through
+ AVFormatContext.avoid_negative_ts
+ */
#define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 4781a3e8de..eba4ec3c5a 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -398,6 +398,13 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
if ((ret = init_pts(s)) < 0)
return ret;
+ if (s->avoid_negative_ts < 0) {
+ if (s->oformat->flags & (AVFMT_TS_NEGATIVE | AVFMT_NOTIMESTAMPS)) {
+ s->avoid_negative_ts = 0;
+ } else
+ s->avoid_negative_ts = 1;
+ }
+
return 0;
}