From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH v2 3/6] avformat/avformat: Add AVFMT_AVOID_NEG_TS_DISABLED
Date: Wed, 19 Jan 2022 22:29:37 +0100
Message-ID: <AM7PR03MB66607596F06754DCD91FA8848F599@AM7PR03MB6660.eurprd03.prod.outlook.com> (raw)
In-Reply-To: <20220119212940.1071477-1-andreas.rheinhardt@outlook.com>
And also don't use explicit constants in the movenc test.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/avformat.h | 1 +
libavformat/mux.c | 2 +-
libavformat/options_table.h | 2 +-
libavformat/tests/movenc.c | 4 ++--
libavformat/webm_chunk.c | 2 +-
5 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 6ce367e854..cd253fb28e 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -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
diff --git a/libavformat/mux.c b/libavformat/mux.c
index e34fd88f05..a1917878a5 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -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;
}
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 62c5bb40a3..86d836cfeb 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -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},
diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c
index 2af72f11c7..ddcb053bf2 100644
--- a/libavformat/tests/movenc.c
+++ b/libavformat/tests/movenc.c
@@ -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);
diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index 24390e8e74..9348e6680a 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -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;
}
--
2.32.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-01-19 21:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 21:19 [FFmpeg-devel] [PATCH v2 1/6] avformat/mux: Remove assert based on faulty assumptions Andreas Rheinhardt
2022-01-19 21:29 ` [FFmpeg-devel] [PATCH v2 2/6] fate/matroska: Add test for avoiding negative timestamps Andreas Rheinhardt
[not found] ` <20220119212940.1071477-1-andreas.rheinhardt@outlook.com>
2022-01-19 21:29 ` Andreas Rheinhardt [this message]
2022-01-19 21:29 ` [FFmpeg-devel] [PATCH v2 4/6] avformat/mux: Preserve sync even if later packet has negative ts Andreas Rheinhardt
2022-01-19 21:29 ` [FFmpeg-devel] [PATCH v2 5/6] avformat/mux: Peek into the muxing queue for avoid_negative_ts Andreas Rheinhardt
2022-01-19 21:29 ` [FFmpeg-devel] [PATCH v2 6/6] avformat/hls: Remove redundant cast Andreas Rheinhardt
2022-01-21 12:14 ` [FFmpeg-devel] [PATCH v2 1/6] avformat/mux: Remove assert based on faulty assumptions Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AM7PR03MB66607596F06754DCD91FA8848F599@AM7PR03MB6660.eurprd03.prod.outlook.com \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git