[FFmpeg-devel] [PATCH] Make Immersive Audio Model optional for MOV demuxing

James Almer jamrial at gmail.com
Wed Apr 3 01:59:50 EEST 2024


On 4/2/2024 7:50 PM, Eugene Zemtsov via ffmpeg-devel wrote:
> Is there anything I can do to get this path applied?
> I can make iamfdec optional for mov demuxer in the same change if it's
> something you're willing to do.

This change as is is not ok because CONFIG_IAMFDEC is always true when 
building the mov demuxer. It's a change that very clearly will depend on 
a custom config.h/mak as modified by projects using ffmpeg.

But yes, your suggestion is ok. Simpler way is probably how faan is 
handled in configure: Add a new iamf entry to SUBSYSTEM_LIST and make 
iamfdec and iamfenc depend on it. Also list the relevant --disable-iamf 
option to the output of configure --help, alongside --disable-faan and 
similar.

> 
> On Wed, Mar 27, 2024 at 5:43 PM Eugene Zemtsov <ezemtsov at google.com> wrote:
>>
>>> Can you elaborate why you need this? In configure the mov demuxer
>>> selects iamfdec, so it will always be present and compiled.
>>
>> Chromium doesn't use Immersive Audio, but the code for handling it
>> bloats Android binaries,
>> that's why we disabled it.
>>
>> I have a second patch that disables iamfdec by default for mov demuxer,
>> but I had a feeling that maintainers will be less inclined to accept
>> it and that's why I split it from this one.
>> I will still try to send it if this patch is accepted.
>>
>>
>> On Wed, Mar 27, 2024 at 4:59 PM James Almer <jamrial at gmail.com> wrote:
>>>
>>> On 3/27/2024 8:55 PM, Eugene Zemtsov via ffmpeg-devel wrote:
>>>> From: Eugene Zemtsov <eugene at chromium.org>
>>>>
>>>> Signed-off-by: Eugene Zemtsov <eugene at chromium.org>
>>>> ---
>>>>    libavformat/mov.c | 15 ++++++++++++++-
>>>>    1 file changed, 14 insertions(+), 1 deletion(-)
>>>>
>>>> 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)) {
>>>
>>> Can you elaborate why you need this? In configure the mov demuxer
>>> selects iamfdec, so it will always be present and compiled.
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>>
>>
>>
>> --
>> Thanks,
>> Eugene Zemtsov.
> 
> 
> 


More information about the ffmpeg-devel mailing list