aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avformat.h
diff options
context:
space:
mode:
authorNicolas Gaullier <nicolas.gaullier@cji.paris>2024-03-29 10:26:19 +0100
committerStefano Sabatini <stefasab@gmail.com>2024-04-02 19:53:40 +0200
commited9363052f4b8b89ed2f1415f392d39788dab0d3 (patch)
tree710b11cf226965b1594f0ce92a00e45a62df794c /libavformat/avformat.h
parent13cdef9d450e5a164740a57a92f723b1bd4b41c6 (diff)
downloadffmpeg-ed9363052f4b8b89ed2f1415f392d39788dab0d3.tar.gz
avformat/demux: add duration_probesize AVOption
Yet another probesize used to get the durations when estimate_timings_from_pts is required. It is aimed at users interested in better durations probing for itself, or because using avformat_find_stream_info indirectly and requiring exact values: for concatdec for example, especially if streamcopying above it. The current code is a performance trade-off that can fail to get video stream durations in a scenario with high bitrates and buffering for files ending cleanly (as opposed to live captures): the physical gap between the last video packet and the last audio packet is very high in such a case. Default behaviour is unchanged: 250k up to 250k << 6 (step by step). Setting this new option has two effects: - override the maximum probesize (currently 250k << 6) - reduce the number of steps to 1 instead of 6, this is to avoid detecting the audio "too early" and failing to reach a video packet. Even if a single audio stream duration is found but not the other audio/video stream durations, there will be a retry, so at the end the full user-overriden probesize will be used as expected by the user. Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Diffstat (limited to 'libavformat/avformat.h')
-rw-r--r--libavformat/avformat.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index de40397676..8afdcd9fd0 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1439,7 +1439,7 @@ typedef struct AVFormatContext {
*
* @note this is \e not used for determining the \ref AVInputFormat
* "input format"
- * @sa format_probesize
+ * @see format_probesize
*/
int64_t probesize;
@@ -1667,6 +1667,8 @@ typedef struct AVFormatContext {
* Skip duration calcuation in estimate_timings_from_pts.
* - encoding: unused
* - decoding: set by user
+ *
+ * @see duration_probesize
*/
int skip_estimate_duration_from_pts;
@@ -1729,7 +1731,7 @@ typedef struct AVFormatContext {
*
* Demuxing only, set by the caller before avformat_open_input().
*
- * @sa probesize
+ * @see probesize
*/
int format_probesize;
@@ -1870,6 +1872,16 @@ typedef struct AVFormatContext {
* @return 0 on success, a negative AVERROR code on failure
*/
int (*io_close2)(struct AVFormatContext *s, AVIOContext *pb);
+
+ /**
+ * Maximum number of bytes read from input in order to determine stream durations
+ * when using estimate_timings_from_pts in avformat_find_stream_info().
+ * Demuxing only, set by the caller before avformat_find_stream_info().
+ * Can be set to 0 to let avformat choose using a heuristic.
+ *
+ * @see skip_estimate_duration_from_pts
+ */
+ int64_t duration_probesize;
} AVFormatContext;
/**