[FFmpeg-devel] [PATCH] configure: Separate subsystem for Immersive Audio Model
Eugene Zemtsov
ezemtsov at google.com
Wed Apr 3 07:01:56 EEST 2024
From: Eugene Zemtsov <eugene at chromium.org>
This change allows users to link ffmpeg as a library without
support for Immersive Audio Model by specifying --disable-iamf.
It helps to save on binary size in cases where it's important.
Signed-off-by: Eugene Zemtsov <eugene at chromium.org>
---
configure | 7 ++++++-
libavformat/mov.c | 15 ++++++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index d03e7e1631..56cc03f68a 100755
--- a/configure
+++ b/configure
@@ -141,6 +141,7 @@ Component options:
--disable-lsp disable LSP code
--disable-faan disable floating point AAN (I)DCT code
--disable-pixelutils disable pixel utils in libavutil
+ --disable-iamf disable support for Immersive Audio Model
Individual component options:
--disable-everything disable all components listed below
@@ -2018,6 +2019,7 @@ SUBSYSTEM_LIST="
lsp
pixelutils
network
+ iamf
"
# COMPONENT_LIST needs to come last to ensure correct dependency checking
@@ -2806,6 +2808,8 @@ mpegvideoenc_select="aandcttables fdctdsp me_cmp mpegvideo pixblockdsp"
msmpeg4dec_select="h263_decoder"
msmpeg4enc_select="h263_encoder"
vc1dsp_select="h264chroma qpeldsp startcode"
+iamfdec_deps="iamf"
+iamfenc_deps="iamf"
# decoders / encoders
aac_decoder_select="adts_header mpeg4audio sinewin"
@@ -3552,7 +3556,7 @@ matroska_demuxer_suggest="bzlib zlib"
matroska_muxer_select="mpeg4audio riffenc aac_adtstoasc_bsf pgs_frame_merge_bsf vp9_superframe_bsf"
mlp_demuxer_select="mlp_parser"
mmf_muxer_select="riffenc"
-mov_demuxer_select="iso_media riffdec iamfdec"
+mov_demuxer_select="iso_media riffdec"
mov_demuxer_suggest="zlib"
mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser"
mp3_demuxer_select="mpegaudio_parser"
@@ -4029,6 +4033,7 @@ enable safe_bitstream_reader
enable static
enable swscale_alpha
enable valgrind_backtrace
+enable iamf iamfdec iamfenc
sws_max_filter_size_default=256
set_default sws_max_filter_size
diff --git a/libavformat/mov.c b/libavformat/mov.c
index c55778f3ef..662301bf67 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -839,6 +839,7 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
+#if CONFIG_IAMFDEC
static int mov_read_iacb(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
@@ -1015,6 +1016,7 @@ fail:
return ret;
}
+#endif
static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
@@ -4797,6 +4799,7 @@ static void fix_timescale(MOVContext *c, MOVStreamContext *sc)
}
}
+#if CONFIG_IAMFDEC
static int mov_update_iamf_streams(MOVContext *c, const AVStream *st)
{
const MOVStreamContext *sc = st->priv_data;
@@ -4840,6 +4843,7 @@ static int mov_update_iamf_streams(MOVContext *c, const AVStream *st)
return 0;
}
+#endif
static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
@@ -4921,11 +4925,13 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
mov_build_index(c, st);
+#if CONFIG_IAMFDEC
if (sc->iamf) {
ret = mov_update_iamf_streams(c, st);
if (ret < 0)
return ret;
}
+#endif
if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
MOVDref *dref = &sc->drefs[sc->dref_id - 1];
@@ -8457,7 +8463,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('i','p','r','p'), mov_read_iprp },
{ MKTAG('i','i','n','f'), mov_read_iinf },
{ MKTAG('a','m','v','e'), mov_read_amve }, /* ambient viewing environment box */
+#if CONFIG_IAMFDEC
{ MKTAG('i','a','c','b'), mov_read_iacb },
+#endif
{ 0, NULL }
};
@@ -8929,8 +8937,10 @@ static void mov_free_stream_context(AVFormatContext *s, AVStream *st)
av_freep(&sc->coll);
av_freep(&sc->ambient);
+#if CONFIG_IAMFDEC
if (sc->iamf)
ff_iamf_read_deinit(sc->iamf);
+#endif
av_freep(&sc->iamf);
}
@@ -9570,6 +9580,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
if (st->codecpar->codec_id == AV_CODEC_ID_EIA_608 && sample->size > 8)
ret = get_eia608_packet(sc->pb, pkt, sample->size);
+#if CONFIG_IAMFDEC
else if (sc->iamf) {
int64_t pts, dts, pos, duration;
int flags, size = sample->size;
@@ -9592,7 +9603,9 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
}
if (!ret)
return FFERROR_REDO;
- } else
+ }
+#endif
+ else
ret = av_get_packet(sc->pb, pkt, sample->size);
if (ret < 0) {
if (should_retry(sc->pb, ret)) {
--
2.44.0.478.gd926399ef9-goog
More information about the ffmpeg-devel
mailing list