lavf: deprecate AVFMT_FLAG_SHORTEST

It was added in cb114ed464 with the comment
"This will allow fixing several bugs with the -shortest option".

Since
* there is no explanation of what these bugs are
* libavformat is not the place to work around ffmpeg CLI bugs
* there is no indication that this feature is actually in use
deprecate it without replacement.
This commit is contained in:
Anton Khirnov 2023-08-29 10:56:42 +02:00
parent 9b454fdaef
commit 85e075587d
7 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
API changes, most recent first:
2023-09-xx - xxxxxxxxxx - lavf 60 - avformat.h
Deprecate AVFMT_FLAG_SHORTEST without replacement.
2023-09-07 - xxxxxxxxxx - lavu 58.24.100 - imgutils.h
Add av_image_copy2(), a wrapper around the av_image_copy()
to overcome limitations of automatic conversions.

View File

@ -1242,7 +1242,9 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_BITEXACT 0x0400
#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down)
#define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats
#if FF_API_LAVF_SHORTEST
#define AVFMT_FLAG_SHORTEST 0x100000 ///< Stop muxing when the shortest stream stops.
#endif
#define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Add bitstream filters as requested by the muxer
/**

View File

@ -151,10 +151,12 @@ typedef struct FFFormatContext {
int avoid_negative_ts_use_pts;
#if FF_API_LAVF_SHORTEST
/**
* Timestamp of the end of the shortest stream.
*/
int64_t shortest_end;
#endif
/**
* Whether or not avformat_init_output has already been called

View File

@ -992,6 +992,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt,
}
}
#if FF_API_LAVF_SHORTEST
if (si->packet_buffer.head &&
eof &&
(s->flags & AVFMT_FLAG_SHORTEST) &&
@ -1027,6 +1028,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt,
flush = 0;
}
}
#endif
if (stream_count && flush) {
PacketListEntry *pktl = si->packet_buffer.head;

View File

@ -190,7 +190,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
return NULL;
}
#if FF_API_LAVF_SHORTEST
si->shortest_end = AV_NOPTS_VALUE;
#endif
return s;
}

View File

@ -51,7 +51,9 @@ static const AVOption avformat_options[] = {
{"fastseek", "fast but inaccurate seeks", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_FAST_SEEK }, INT_MIN, INT_MAX, D, "fflags"},
{"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
{"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" },
{"shortest", "stop muxing with the shortest stream", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" },
#if FF_API_LAVF_SHORTEST
{"shortest", "stop muxing with the shortest stream", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E | AV_OPT_FLAG_DEPRECATED, "fflags" },
#endif
{"autobsf", "add needed bsfs automatically", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_AUTO_BSF }, 0, 0, E, "fflags" },
{"seek2any", "allow seeking to non-keyframes on demuxer level when supported", OFFSET(seek2any), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, D},
{"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, D},

View File

@ -46,6 +46,7 @@
#define FF_API_AVIODIRCONTEXT (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_AVFORMAT_IO_CLOSE (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_AVIO_WRITE_NONCONST (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_LAVF_SHORTEST (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_R_FRAME_RATE 1