On Thu, 6 Nov 2014, Anton Khirnov wrote:

Quoting Martin Storsjö (2014-11-06 09:43:08)
From: Michael Niedermayer <[email protected]>

This is the same logic as is invoked on AVFMT_TS_NEGATIVE,
but which can be enabled/disabled manually, or can be enabled
in muxers which only need it in certain conditions.

Also allow using the same mechanis to force streams to start
at 0.

This includes documentation by Stefano Sabatini, Clément Bœsch
and Michael Niedermayer.
---
Removed the enum and option for disabling it, added an APIchanges
entry.
---
 doc/APIchanges              |  3 +++
 doc/muxers.texi             | 24 ++++++++++++++++++++++++
 libavformat/avformat.h      | 12 ++++++++++++
 libavformat/mux.c           | 12 ++++++++++--
 libavformat/options_table.h |  4 ++++
 libavformat/version.h       |  2 +-
 6 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 69da442..44af215 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2014-08-09

 API changes, most recent first:

+2014-11-xx - xxxxxxx - lavf 56.06.3 - avformat.h
+  Add AVFormatContext.avoid_negative_ts.
+
 2014-11-xx - xxxxxxx - lavc 56.6.0 - vorbis_parser.h
   Add a public API for parsing vorbis packets.

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 6d2c495..0dee8f9 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -16,6 +16,30 @@ with the options @code{--enable-muxer=@var{MUXER}} /
 The option @code{-formats} of the av* tools will display the list of
 enabled muxers.

+Some of the generic, muxer independent options are:
+
+@table @option
+@item avoid_negative_ts @var{integer} (@emph{output})
+
+Possible values:
+@table @samp
+@item make_non_negative
+Shift timestamps to make them non-negative.
+Also note that this affects only leading negative timestamps, and not
+non-monotonic negative timestamps.
+@item make_zero
+Shift timestamps so that the first timestamp is 0.
+@item auto (default)
+Enables shifting when required by the target format.
+@end table
+
+When shifting is enabled, all output timestamps are shifted by the
+same amount. Audio, video, and subtitles desynching and relative
+timestamp differences are preserved compared to how they would have
+been without shifting.
+@end table
+
+
 A description of some of the currently available muxers follows.

 @anchor{crc}
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f28186f..8ca02c8 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1198,6 +1198,18 @@ typedef struct AVFormatContext {
      */
     int max_ts_probe;

+    /**
+     * Avoid negative timestamps during muxing.
+     * Any value of the AVFMT_AVOID_NEG_TS_* constants.
+     * Note, this only works when interleave_packet_per_dts is in use.

One last nit: i think this sentence will only confuse the API users, as
they don't need to know anything about lavf internals. So I'd drop it.

I think it can be made more concrete to users by changing like this:

"Note, this only works when using av_interleaved_write_frame"

Because if you use av_write_frame directly (doing the interleaving, or choosing to do bad interleaving) you can't really expect this to work (and also triggering the warning in the other commit).

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to