[FFmpeg-devel] av_packet_get_side_data() declaration in libavcodec/packet.h

Gerd Röthig dac324 at yahoo.de
Mon Jun 28 18:45:26 EEST 2021


Hello all,

Trying to compile the Chromium browser by myself, I encountered that compile fails due to variable
declarations in ffmpeg_demuxer.cc in Chromium's source code. 

In the file, the following call to av_packet_get_side_data() is made:

    size_t id_size = 0;
    uint8_t* id_data = av_packet_get_side_data(
        packet.get(), AV_PKT_DATA_WEBVTT_IDENTIFIER, &id_size);

    size_t settings_size = 0;
    uint8_t* settings_data = av_packet_get_side_data(
        packet.get(), AV_PKT_DATA_WEBVTT_SETTINGS, &settings_size);

Compilation fails, however, with the error "no matching function found for av_packet_get_side_data",
and the reason appears to be the following code in libavcodec/packet.h, line 626:

uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
#if FF_API_BUFFER_SIZE_T
                                 int *size);
#else
                                 size_t *size);
#endif                                       

If FF_API_BUFFER_SIZE_T is defined, this declaration expects *size to be of type int instead of
size_t - because the size_t declaration sits in the #else branch of that declaration (instead of the
#if branch as I (and apparently the Chromium developers) would have expected). 

But FF_API_BUFFER_SIZE_T, in my understanding, by its name should mean that size_t is used, however,
the code in libavcodec/packet.h just handles it the other way round (ffmpeg version n4.4).

This means you can only have *size of type size_t when FF_API_BUFFER_SIZE_T is NOT defined. 

Is this behavior intended? Or am I simply understanding something wrong here?

Thank you very much for your help in advance and kind regards,

Gerd 




More information about the ffmpeg-devel mailing list