Allows user to disable codec auto-detection. Probe requests are ignored, including spdif/s337m submux detection in wavdec.
Note: this option is required to pass-through dolby_e data from a wav file. --- doc/formats.texi | 3 +++ libavformat/avformat.h | 9 ++++++++- libavformat/options_table.h | 1 + libavformat/utils.c | 2 ++ libavformat/version.h | 2 +- libavformat/wavdec.c | 2 +- 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/formats.texi b/doc/formats.texi index fc80ce1d2b..7de49503e8 100644 --- a/doc/formats.texi +++ b/doc/formats.texi @@ -31,6 +31,9 @@ latency. Must be an integer not lesser than 32. It is 5000000 by default. Set the maximum number of buffered packets when probing a codec. Default is 2500 packets. +@item probe_streams @var{bool} (@emph{input}) +Enable codec auto-detection if set to 1. Default is 1. + @item packetsize @var{integer} (@emph{output}) Set packet size. diff --git a/libavformat/avformat.h b/libavformat/avformat.h index c8c0b6c08d..a146daa21c 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1118,7 +1118,7 @@ typedef struct AVStream { /** * stream probing state * -1 -> probing finished - * 0 -> no probing requested + * 0 -> no probing requested or request cancelled by probe_streams being set to 0 * rest -> perform probing with request_probe being the minimum score to accept. */ int request_probe; @@ -1951,6 +1951,13 @@ typedef struct AVFormatContext { * - decoding: set by user */ int max_probe_packets; + + /** + * Enable codec auto-detect. + * - encoding: unused + * - decoding: set by user + */ + int probe_streams; } AVFormatContext; #if FF_API_FORMAT_GET_SET diff --git a/libavformat/options_table.h b/libavformat/options_table.h index b4141564c8..1a75ad7f93 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -112,6 +112,7 @@ static const AVOption avformat_options[] = { {"max_streams", "maximum number of streams", OFFSET(max_streams), AV_OPT_TYPE_INT, { .i64 = 1000 }, 0, INT_MAX, D }, {"skip_estimate_duration_from_pts", "skip duration calculation in estimate_timings_from_pts", OFFSET(skip_estimate_duration_from_pts), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, D}, {"max_probe_packets", "Maximum number of packets to probe a codec", OFFSET(max_probe_packets), AV_OPT_TYPE_INT, { .i64 = 2500 }, 0, INT_MAX, D }, +{"probe_streams", "codec auto-detection", OFFSET(probe_streams), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, D}, {NULL}, }; diff --git a/libavformat/utils.c b/libavformat/utils.c index a2e701ea1a..1c08081e21 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -675,6 +675,8 @@ static void force_codec_ids(AVFormatContext *s, AVStream *st) static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt) { + if (!s->probe_streams) + st->request_probe = 0; if (st->request_probe>0) { AVProbeData *pd = &st->probe_data; int end; diff --git a/libavformat/version.h b/libavformat/version.h index 40f84a220d..9bde0c37f9 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 58 -#define LIBAVFORMAT_VERSION_MINOR 59 +#define LIBAVFORMAT_VERSION_MINOR 60 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index 9f48ff067b..00cf8c9ab2 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -69,7 +69,7 @@ typedef struct WAVDemuxContext { static void set_spdif_s337m(AVFormatContext *s, WAVDemuxContext *wav) { AVCodecParameters *par = s->streams[0]->codecpar; - if ((CONFIG_SPDIF_DEMUXER || CONFIG_S337M_DEMUXER) && par->codec_tag == 1) { + if ((CONFIG_SPDIF_DEMUXER || CONFIG_S337M_DEMUXER) && par->codec_tag == 1 && s->probe_streams) { enum AVCodecID codec; int len = 1<<16; int ret = ffio_ensure_seekback(s->pb, len); -- 2.27.0.windows.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-requ...@ffmpeg.org with subject "unsubscribe".