avformat/avformat: Add AVFMT_AVOID_NEG_TS_DISABLED

And also don't use explicit constants in the movenc test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
release/5.1
Andreas Rheinhardt 3 years ago
parent 92ed6ea3d7
commit f6d14b1297
  1. 1
      libavformat/avformat.h
  2. 2
      libavformat/mux.c
  3. 2
      libavformat/options_table.h
  4. 4
      libavformat/tests/movenc.c
  5. 2
      libavformat/webm_chunk.c

@ -1533,6 +1533,7 @@ typedef struct AVFormatContext {
*/
int avoid_negative_ts;
#define AVFMT_AVOID_NEG_TS_AUTO -1 ///< Enabled when required by target format
#define AVFMT_AVOID_NEG_TS_DISABLED 0 ///< Do not shift timestamps even when they are negative.
#define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative
#define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0

@ -421,7 +421,7 @@ static int init_pts(AVFormatContext *s)
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;
s->avoid_negative_ts = AVFMT_AVOID_NEG_TS_DISABLED;
} else
s->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE;
}

@ -95,7 +95,7 @@ static const AVOption avformat_options[] = {
{"max_ts_probe", "maximum number of packets to read while waiting for the first timestamp", OFFSET(max_ts_probe), AV_OPT_TYPE_INT, { .i64 = 50 }, 0, INT_MAX, D },
{"avoid_negative_ts", "shift timestamps so they start at 0", OFFSET(avoid_negative_ts), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, E, "avoid_negative_ts"},
{"auto", "enabled when required by target format", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_AVOID_NEG_TS_AUTO }, INT_MIN, INT_MAX, E, "avoid_negative_ts"},
{"disabled", "do not change timestamps", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, INT_MIN, INT_MAX, E, "avoid_negative_ts"},
{"disabled", "do not change timestamps", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_AVOID_NEG_TS_DISABLED }, INT_MIN, INT_MAX, E, "avoid_negative_ts"},
{"make_non_negative", "shift timestamps so they are non negative", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE }, INT_MIN, INT_MAX, E, "avoid_negative_ts"},
{"make_zero", "shift timestamps so they start at 0", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_AVOID_NEG_TS_MAKE_ZERO }, INT_MIN, INT_MAX, E, "avoid_negative_ts"},
{"dump_separator", "set information dump field separator", OFFSET(dump_separator), AV_OPT_TYPE_STRING, {.str = ", "}, 0, 0, D|E},

@ -455,7 +455,7 @@ int main(int argc, char **argv)
init_count_warnings();
init_out("empty-moov-no-elst-no-adjust");
av_dict_set(&opts, "movflags", "frag_keyframe+empty_moov", 0);
av_dict_set(&opts, "avoid_negative_ts", "0", 0);
av_dict_set(&opts, "avoid_negative_ts", "disabled", 0);
init(1, 0);
mux_gops(2);
finish();
@ -578,7 +578,7 @@ int main(int argc, char **argv)
// one before.
av_dict_set(&opts, "movflags", "frag_custom+empty_moov+dash+frag_discont", 0);
av_dict_set(&opts, "fragment_index", "2", 0);
av_dict_set(&opts, "avoid_negative_ts", "0", 0);
av_dict_set(&opts, "avoid_negative_ts", "disabled", 0);
av_dict_set(&opts, "use_editlist", "0", 0);
init(0, 0);
skip_gops(1);

@ -127,7 +127,7 @@ fail:
s->avoid_negative_ts = oc->avoid_negative_ts;
ffformatcontext(s)->avoid_negative_ts_use_pts =
ffformatcontext(oc)->avoid_negative_ts_use_pts;
oc->avoid_negative_ts = 0;
oc->avoid_negative_ts = AVFMT_AVOID_NEG_TS_DISABLED;
return 0;
}

Loading…
Cancel
Save