* [FFmpeg-devel] [PATCH] lavf: deprecate AVFMT_FLAG_SHORTEST
@ 2023-08-29 9:07 Anton Khirnov
2023-08-29 11:57 ` James Almer
2023-08-29 22:15 ` Andreas Rheinhardt
0 siblings, 2 replies; 3+ messages in thread
From: Anton Khirnov @ 2023-08-29 9:07 UTC (permalink / raw)
To: ffmpeg-devel
It was added in cb114ed4640 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.
---
doc/APIchanges | 3 +++
libavformat/avformat.h | 2 ++
libavformat/internal.h | 2 ++
libavformat/mux.c | 2 ++
libavformat/options.c | 2 ++
libavformat/options_table.h | 4 +++-
libavformat/version_major.h | 1 +
7 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index ad1efe708d..001de4544b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
API changes, most recent first:
+2023-08-xx - xxxxxxxxxx - lavf 60 - avformat.h
+ Deprecate AVFMT_FLAG_SHORTEST without replacement.
+
2023-08-18 - xxxxxxxxxx - lavu 58.17.100 - channel_layout.h
All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and older.
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1916aa2dc5..8a145a8a8b 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1241,7 +1241,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
/**
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 594afd731d..a016ef197d 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -152,10 +152,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
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 415bd3948f..b7ae90f3c4 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -990,6 +990,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) &&
@@ -1025,6 +1026,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt,
flush = 0;
}
}
+#endif
if (stream_count && flush) {
PacketListEntry *pktl = si->packet_buffer.head;
diff --git a/libavformat/options.c b/libavformat/options.c
index e4a3aceed0..194042820e 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -190,7 +190,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
return NULL;
}
+#if FF_API_LAVF_SHORTEST
si->shortest_end = AV_NOPTS_VALUE;
+#endif
return s;
}
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 86d836cfeb..9aacd1ca2b 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -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 (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "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},
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index 293fbd3397..e7e80184f7 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -45,6 +45,7 @@
#define FF_API_GET_END_PTS (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_AVIODIRCONTEXT (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_AVFORMAT_IO_CLOSE (LIBAVFORMAT_VERSION_MAJOR < 61)
+#define FF_API_LAVF_SHORTEST (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_R_FRAME_RATE 1
--
2.40.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavf: deprecate AVFMT_FLAG_SHORTEST
2023-08-29 9:07 [FFmpeg-devel] [PATCH] lavf: deprecate AVFMT_FLAG_SHORTEST Anton Khirnov
@ 2023-08-29 11:57 ` James Almer
2023-08-29 22:15 ` Andreas Rheinhardt
1 sibling, 0 replies; 3+ messages in thread
From: James Almer @ 2023-08-29 11:57 UTC (permalink / raw)
To: ffmpeg-devel
On 8/29/2023 6:07 AM, Anton Khirnov wrote:
> It was added in cb114ed4640 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.
> ---
> doc/APIchanges | 3 +++
> libavformat/avformat.h | 2 ++
> libavformat/internal.h | 2 ++
> libavformat/mux.c | 2 ++
> libavformat/options.c | 2 ++
> libavformat/options_table.h | 4 +++-
> libavformat/version_major.h | 1 +
> 7 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index ad1efe708d..001de4544b 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
>
> API changes, most recent first:
>
> +2023-08-xx - xxxxxxxxxx - lavf 60 - avformat.h
> + Deprecate AVFMT_FLAG_SHORTEST without replacement.
> +
> 2023-08-18 - xxxxxxxxxx - lavu 58.17.100 - channel_layout.h
> All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and older.
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 1916aa2dc5..8a145a8a8b 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1241,7 +1241,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
>
> /**
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 594afd731d..a016ef197d 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -152,10 +152,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
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 415bd3948f..b7ae90f3c4 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -990,6 +990,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) &&
> @@ -1025,6 +1026,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt,
> flush = 0;
> }
> }
> +#endif
>
> if (stream_count && flush) {
> PacketListEntry *pktl = si->packet_buffer.head;
> diff --git a/libavformat/options.c b/libavformat/options.c
> index e4a3aceed0..194042820e 100644
> --- a/libavformat/options.c
> +++ b/libavformat/options.c
> @@ -190,7 +190,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
> return NULL;
> }
>
> +#if FF_API_LAVF_SHORTEST
> si->shortest_end = AV_NOPTS_VALUE;
> +#endif
>
> return s;
> }
> diff --git a/libavformat/options_table.h b/libavformat/options_table.h
> index 86d836cfeb..9aacd1ca2b 100644
> --- a/libavformat/options_table.h
> +++ b/libavformat/options_table.h
> @@ -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 (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" },
Add the deprecated AVOption flag instead of that comment in the option
description.
LGTM with that change.
> +#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},
> diff --git a/libavformat/version_major.h b/libavformat/version_major.h
> index 293fbd3397..e7e80184f7 100644
> --- a/libavformat/version_major.h
> +++ b/libavformat/version_major.h
> @@ -45,6 +45,7 @@
> #define FF_API_GET_END_PTS (LIBAVFORMAT_VERSION_MAJOR < 61)
> #define FF_API_AVIODIRCONTEXT (LIBAVFORMAT_VERSION_MAJOR < 61)
> #define FF_API_AVFORMAT_IO_CLOSE (LIBAVFORMAT_VERSION_MAJOR < 61)
> +#define FF_API_LAVF_SHORTEST (LIBAVFORMAT_VERSION_MAJOR < 61)
>
>
> #define FF_API_R_FRAME_RATE 1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavf: deprecate AVFMT_FLAG_SHORTEST
2023-08-29 9:07 [FFmpeg-devel] [PATCH] lavf: deprecate AVFMT_FLAG_SHORTEST Anton Khirnov
2023-08-29 11:57 ` James Almer
@ 2023-08-29 22:15 ` Andreas Rheinhardt
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Rheinhardt @ 2023-08-29 22:15 UTC (permalink / raw)
To: ffmpeg-devel
Anton Khirnov:
> It was added in cb114ed4640 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.
> ---
> doc/APIchanges | 3 +++
> libavformat/avformat.h | 2 ++
> libavformat/internal.h | 2 ++
> libavformat/mux.c | 2 ++
> libavformat/options.c | 2 ++
> libavformat/options_table.h | 4 +++-
> libavformat/version_major.h | 1 +
> 7 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index ad1efe708d..001de4544b 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
>
> API changes, most recent first:
>
> +2023-08-xx - xxxxxxxxxx - lavf 60 - avformat.h
> + Deprecate AVFMT_FLAG_SHORTEST without replacement.
> +
> 2023-08-18 - xxxxxxxxxx - lavu 58.17.100 - channel_layout.h
> All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and older.
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 1916aa2dc5..8a145a8a8b 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1241,7 +1241,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
>
> /**
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 594afd731d..a016ef197d 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -152,10 +152,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
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 415bd3948f..b7ae90f3c4 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -990,6 +990,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) &&
> @@ -1025,6 +1026,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt,
> flush = 0;
> }
> }
> +#endif
>
> if (stream_count && flush) {
> PacketListEntry *pktl = si->packet_buffer.head;
> diff --git a/libavformat/options.c b/libavformat/options.c
> index e4a3aceed0..194042820e 100644
> --- a/libavformat/options.c
> +++ b/libavformat/options.c
> @@ -190,7 +190,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
> return NULL;
> }
>
> +#if FF_API_LAVF_SHORTEST
> si->shortest_end = AV_NOPTS_VALUE;
> +#endif
>
> return s;
> }
> diff --git a/libavformat/options_table.h b/libavformat/options_table.h
> index 86d836cfeb..9aacd1ca2b 100644
> --- a/libavformat/options_table.h
> +++ b/libavformat/options_table.h
> @@ -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 (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "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},
> diff --git a/libavformat/version_major.h b/libavformat/version_major.h
> index 293fbd3397..e7e80184f7 100644
> --- a/libavformat/version_major.h
> +++ b/libavformat/version_major.h
> @@ -45,6 +45,7 @@
> #define FF_API_GET_END_PTS (LIBAVFORMAT_VERSION_MAJOR < 61)
> #define FF_API_AVIODIRCONTEXT (LIBAVFORMAT_VERSION_MAJOR < 61)
> #define FF_API_AVFORMAT_IO_CLOSE (LIBAVFORMAT_VERSION_MAJOR < 61)
> +#define FF_API_LAVF_SHORTEST (LIBAVFORMAT_VERSION_MAJOR < 61)
>
>
> #define FF_API_R_FRAME_RATE 1
LGTM (with the deprecated flag as noticed by James).
- Andreas
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-29 22:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-29 9:07 [FFmpeg-devel] [PATCH] lavf: deprecate AVFMT_FLAG_SHORTEST Anton Khirnov
2023-08-29 11:57 ` James Almer
2023-08-29 22:15 ` Andreas Rheinhardt
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