This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit c9b5e145b71b5415b742f687cdeb9c611201a047 Author: Martin Storsjö <[email protected]> AuthorDate: Thu Oct 23 13:49:15 2025 +0300 Commit: Martin Storsjö <[email protected]> CommitDate: Fri Dec 12 18:40:00 2025 +0200 avformat: Add av_mime_codec_str public API Add a public API for producing RFC 4281/6381 codecs trings for MIME types. This can be required for providing alternative video files to a web browser, letting the browser pick the best file it supports. Such strings also allow querying a browser whether it supports a certain codec combination. Finally, if implementing a DASH/HLS segmenter outside of libavformat, one also has to generate such strings. Generating such strings for H264/AAC is very simple, but for more modern codecs, it can require a lot of nontrivial codec specific parsing of extradata. As libavformat already implements this, expose it for users as well. The old, internal function ff_make_codec_str is kept and used by the HLS and DASH muxers; the old function takes a logging context which can be used for logging auxillary info about how the string generation worked out. --- doc/APIchanges | 3 +++ libavformat/Makefile | 12 ++++++++---- libavformat/avformat.h | 15 +++++++++++++++ libavformat/codecstring.c | 6 ++++++ libavformat/version.h | 4 ++-- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index e670a08cf9..82977be159 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28 API changes, most recent first: +2025-12-xx - xxxxxxxxxx - lavf 62.x.xxx - avformat.h + Add av_mime_codec_str + 2025-12-xx - xxxxxxxxxx - lavu 60.20.100 - hwcontext_vulkan.h Add av_vk_get_optional_instance_extensions(). Add av_vk_get_optional_device_extensions(). diff --git a/libavformat/Makefile b/libavformat/Makefile index 86177af2f4..f78f673e58 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -7,9 +7,11 @@ HEADERS = avformat.h \ version_major.h \ OBJS = allformats.o \ + av1.o \ avformat.o \ avio.o \ aviobuf.o \ + codecstring.o \ demux.o \ demux_utils.o \ dump.o \ @@ -21,6 +23,7 @@ OBJS = allformats.o \ metadata.o \ mux.o \ mux_utils.o \ + nal.o \ options.o \ os_support.o \ protocols.o \ @@ -31,12 +34,13 @@ OBJS = allformats.o \ urldecode.o \ utils.o \ version.o \ + vpcc.o \ OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o # subsystems OBJS-$(CONFIG_ISO_MEDIA) += isom.o -OBJS-$(CONFIG_ISO_WRITER) += av1.o avc.o hevc.o nal.o vvc.o vpcc.o +OBJS-$(CONFIG_ISO_WRITER) += avc.o hevc.o vvc.o OBJS-$(CONFIG_IAMFDEC) += iamf_reader.o iamf_parse.o iamf.o OBJS-$(CONFIG_IAMFENC) += iamf_writer.o iamf.o OBJS-$(CONFIG_NETWORK) += network.o @@ -179,7 +183,7 @@ OBJS-$(CONFIG_CONCAT_DEMUXER) += concatdec.o OBJS-$(CONFIG_CRC_MUXER) += crcenc.o OBJS-$(CONFIG_DATA_DEMUXER) += rawdec.o OBJS-$(CONFIG_DATA_MUXER) += rawenc.o -OBJS-$(CONFIG_DASH_MUXER) += dash.o dashenc.o hlsplaylist.o codecstring.o +OBJS-$(CONFIG_DASH_MUXER) += dash.o dashenc.o hlsplaylist.o OBJS-$(CONFIG_DASH_DEMUXER) += dash.o dashdec.o OBJS-$(CONFIG_DAUD_DEMUXER) += dauddec.o OBJS-$(CONFIG_DAUD_MUXER) += daudenc.o @@ -267,7 +271,7 @@ OBJS-$(CONFIG_HEVC_MUXER) += rawenc.o OBJS-$(CONFIG_EVC_DEMUXER) += evcdec.o rawdec.o OBJS-$(CONFIG_EVC_MUXER) += rawenc.o OBJS-$(CONFIG_HLS_DEMUXER) += hls.o hls_sample_encryption.o -OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o codecstring.o +OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o OBJS-$(CONFIG_HNM_DEMUXER) += hnm.o OBJS-$(CONFIG_HXVS_DEMUXER) += hxvs.o OBJS-$(CONFIG_IAMF_DEMUXER) += iamfdec.o @@ -634,7 +638,7 @@ OBJS-$(CONFIG_WAV_DEMUXER) += wavdec.o pcm.o OBJS-$(CONFIG_WAV_MUXER) += wavenc.o OBJS-$(CONFIG_WC3_DEMUXER) += wc3movie.o OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ - av1.o avlanguage.o + avlanguage.o OBJS-$(CONFIG_WEBM_DASH_MANIFEST_MUXER) += webmdashenc.o OBJS-$(CONFIG_WEBM_CHUNK_MUXER) += webm_chunk.o OBJS-$(CONFIG_WEBP_MUXER) += webpenc.o diff --git a/libavformat/avformat.h b/libavformat/avformat.h index a7446546e5..cee845b308 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2890,6 +2890,21 @@ int av_match_ext(const char *filename, const char *extensions); int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance); +struct AVBPrint; +/** + * Make a RFC 4281/6381 like string describing a codec for MIME types. + * + * @param par pointer to an AVCodecParameters struct describing the codec + * @param frame_rate an AVRational for the frame rate, for deciding the + * right profile for video codecs. Pass an invalid + * AVRational (1/0) to indicate that it is unknown. + * @param str the output string buffer + * @param size the size of the string pointed to by str + * @return <0 on error + */ +int av_mime_codec_str(const AVCodecParameters *par, + AVRational frame_rate, struct AVBPrint *out); + /** * @defgroup riff_fourcc RIFF FourCCs * @{ diff --git a/libavformat/codecstring.c b/libavformat/codecstring.c index acd2ea3a4e..c6672b7244 100644 --- a/libavformat/codecstring.c +++ b/libavformat/codecstring.c @@ -220,3 +220,9 @@ int ff_make_codec_str(void *logctx, const AVCodecParameters *par, } return 0; } + +int av_mime_codec_str(const AVCodecParameters *par, + AVRational frame_rate, struct AVBPrint *out) +{ + return ff_make_codec_str(NULL, par, &frame_rate, out); +} diff --git a/libavformat/version.h b/libavformat/version.h index 8c1af81917..70c554c19c 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -31,8 +31,8 @@ #include "version_major.h" -#define LIBAVFORMAT_VERSION_MINOR 6 -#define LIBAVFORMAT_VERSION_MICRO 103 +#define LIBAVFORMAT_VERSION_MINOR 7 +#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
