Build fails with FFmpeg 9.0

The place to discuss linux version of MakeMKV
Post Reply
Toad King
Posts: 137
Joined: Sun Jul 03, 2022 6:46 pm

Build fails with FFmpeg 9.0

Post by Toad King »

New version of FFmpeg removed some APIs MakeMKV was using.

Code: Select all

libffabi/src/ffabi.c: In function ‘set_codec_info_extended’:
libffabi/src/ffabi.c:542:22: error: ‘AVCodec’ has no member named ‘ch_layouts’
  542 |     if (NULL != codec->ch_layouts) {
      |                      ^~
libffabi/src/ffabi.c:543:26: error: ‘AVCodec’ has no member named ‘ch_layouts’
  543 |         while (0 != codec->ch_layouts[count_ch_layouts_in].nb_channels)
      |                          ^~
libffabi/src/ffabi.c:561:45: error: ‘AVCodec’ has no member named ‘ch_layouts’
  561 |         if (AV_CHANNEL_ORDER_NATIVE != codec->ch_layouts[i].order) continue;
      |                                             ^~
libffabi/src/ffabi.c:562:56: error: ‘AVCodec’ has no member named ‘ch_layouts’
  562 |         channel_layouts[count_ch_layouts_out++] = codec->ch_layouts[i].u.mask;
      |                                                        ^~
libffabi/src/ffabi.c: In function ‘ffm_audio_get_codec_information’:
libffabi/src/ffabi.c:589:31: error: ‘AVCodec’ has no member named ‘supported_samplerates’
  589 |     info->sample_rates = codec->supported_samplerates;
      |                               ^~
libffabi/src/ffabi.c:593:22: error: ‘AVCodec’ has no member named ‘ch_layouts’
  593 |     if (NULL == codec->ch_layouts) {
      |                      ^~
libffabi/src/ffabi.c:612:14: error: ‘AVCodec’ has no member named ‘sample_fmts’
  612 |     if (codec->sample_fmts) {
      |              ^~
libffabi/src/ffabi.c:614:22: error: ‘AVCodec’ has no member named ‘sample_fmts’
  614 |             if (codec->sample_fmts[i]==AV_SAMPLE_FMT_NONE)
      |                      ^~
libffabi/src/ffabi.c:616:77: error: ‘AVCodec’ has no member named ‘sample_fmts’
  616 |             info->sample_formats[i]=(uint8_t)back_translate_sample_fmt(codec->sample_fmts[i]);
      |                                                                             ^~
echo_x
Posts: 1
Joined: Tue Aug 11, 2026 5:17 pm

Re: Build fails with FFmpeg 9.0

Post by echo_x »

I ran into the same issue.
I downloaded both tarballs and extracted them to their own folders.
While running make:
I received this error message:

Code: Select all

objcopy --strip-all --strip-debug --strip-unneeded --discard-all out/libdriveio.so.0.full out/libdriveio.so.0
mkdir -p tmp/libffabi/src/
gcc -c -g -O2 -D_linux_ -Wno-deprecated-declarations  -D_GNU_SOURCE -D_REENTRANT -otmp/libffabi/src/ffabi.c.o -I./libabi/inc -I.
/libffabi/inc \
-DHAVE_BUILDINFO_H -Itmp  -fPIC libffabi/src/ffabi.c
libffabi/src/ffabi.c: In function ‘set_codec_info_extended’:
libffabi/src/ffabi.c:542:22: error: ‘AVCodec’ has no member named ‘ch_layouts’
 542 |     if (NULL != codec**->ch_layouts) {
     |                      ^~
libffabi/src/ffabi.c:543:26: error: ‘AVCodec’ has no member named ‘ch_layouts’
 543 |         while (0 != codec->ch_layouts[count_ch_layouts_in].nb_channels)
     |                          ^~
libffabi/src/ffabi.c:561:45: error: ‘AVCodec’ has no member named ‘ch_layouts’
 561 |         if (AV_CHANNEL_ORDER_NATIVE != codec->ch_layouts[i].order) continue;
     |                                             ^~
libffabi/src/ffabi.c:562:56: error: ‘AVCodec’ has no member named ‘ch_layouts’
 562 |         channel_layouts[count_ch_layouts_out++] = codec->ch_layouts[i].u.mask;
     |                                                        ^~
libffabi/src/ffabi.c: In function ‘ffm_audio_get_codec_information’:
libffabi/src/ffabi.c:589:31: error: ‘AVCodec’ has no member named ‘supported_samplerates’
 589 |     info->sample_rates = codec->supported_samplerates;
     |                               ^~
libffabi/src/ffabi.c:593:22: error: ‘AVCodec’ has no member named ‘ch_layouts’
 593 |     if (NULL == codec->ch_layouts) {
     |                      ^~
libffabi/src/ffabi.c:612:14: error: ‘AVCodec’ has no member named ‘sample_fmts’
 612 |     if (codec->sample_fmts) {
     |              ^~
libffabi/src/ffabi.c:614:22: error: ‘AVCodec’ has no member named ‘sample_fmts’
 614 |             if (codec->sample_fmts[i]==AV_SAMPLE_FMT_NONE)
     |                      ^~
libffabi/src/ffabi.c:616:77: error: ‘AVCodec’ has no member named ‘sample_fmts’
 616 |             info->sample_formats[i]=(uint8_t)back_translate_sample_fmt(codec->**sample_fmts[i]);
     |                                                                             ^~
make: *** [Makefile:84: tmp/libffabi/src/ffabi.c.o] Error 1
I used Python to modify libffabi/src/ffabi.c to change the API calls

Code: Select all

python - <<'PY'
from pathlib import Path

p = Path("libffabi/src/ffabi.c")
s = p.read_text()

start = s.index("#ifndef FFABI_HAVE_OLD_CHANNEL_LAYOUT\nstatic int set_codec_info_extended")
end = s.index("\nFFM_AudioConvert* __cdecl ffm_audio_convert_alloc", start)

replacement = r'''#ifndef FFABI_HAVE_OLD_CHANNEL_LAYOUT
static int set_codec_info_extended(FFM_CodecInfo* info, const AVCodec* codec)
{
    char* exinfo;
    size_t len;
    int count_ch_layouts_in = 0;
    unsigned int count_ch_layouts_out = 0;
    uint64_t* channel_layouts;
    const AVChannelLayout* ch_layouts = NULL;
    unsigned int i;
    int ret;

    len = strlen(codec->name);
    if (len >= FFM_CODEC_INFO_NAME_MAX_LENGTH) return -1;

    ret = avcodec_get_supported_config(
        NULL, codec, AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0,
        (const void**)&ch_layouts, &count_ch_layouts_in
    );

    if (ret < 0) return -1;

    exinfo = (char*)ffabi_memalign(
        sizeof(uint64_t),
        FFM_CODEC_INFO_NAME_MAX_LENGTH +
        FFM_CODEC_INFO_EXMARK_LENGTH +
        ((count_ch_layouts_in + 1) * sizeof(uint64_t))
    );

    if (NULL == exinfo) return -1;

    memcpy(exinfo, codec->name, len + 1);
    memcpy(exinfo + FFM_CODEC_INFO_NAME_MAX_LENGTH,
           FFM_CODEC_INFO_EXMARK_MAGIC,
           FFM_CODEC_INFO_EXMARK_LENGTH);

    channel_layouts = (uint64_t*)(
        exinfo +
        FFM_CODEC_INFO_NAME_MAX_LENGTH +
        FFM_CODEC_INFO_EXMARK_LENGTH
    );

    info->name = exinfo;
    info->channel_layouts = channel_layouts;

    for (i = 0; i < (unsigned int)count_ch_layouts_in; i++) {
        if (AV_CHANNEL_ORDER_NATIVE != ch_layouts[i].order)
            continue;

        channel_layouts[count_ch_layouts_out++] =
            ch_layouts[i].u.mask;
    }

    channel_layouts[count_ch_layouts_out] = 0;

    return 0;
}
#endif

int __cdecl ffm_audio_get_codec_information(
    FFM_CodecInfo* info,
    const char* name,
    int encode)
{
    AVCodec* codec;
    const int* sample_rates = NULL;
    const enum AVSampleFormat* sample_fmts = NULL;
#ifndef FFABI_HAVE_OLD_CHANNEL_LAYOUT
    const AVChannelLayout* ch_layouts = NULL;
#endif
    int num_sample_rates = 0;
    int num_sample_fmts = 0;
#ifndef FFABI_HAVE_OLD_CHANNEL_LAYOUT
    int num_ch_layouts = 0;
#endif
    int ret;
    int i;

    memset(info, 0, sizeof(*info));

    if (encode) {
        codec = (AVCodec*)avcodec_find_encoder_by_name(name);
    } else {
        codec = (AVCodec*)avcodec_find_decoder_by_name(name);
    }

    if (!codec)
        return ffmerr(1, encode);

    info->name = codec->name;
    info->long_name = codec->long_name;

    ret = avcodec_get_supported_config(
        NULL, codec, AV_CODEC_CONFIG_SAMPLE_RATE, 0,
        (const void**)&sample_rates, &num_sample_rates
    );

    if (ret < 0)
        return ffmerr(2, 0);

    info->sample_rates = sample_rates;

#ifdef FFABI_HAVE_OLD_CHANNEL_LAYOUT
    info->channel_layouts = codec->channel_layouts;
#else
    ret = avcodec_get_supported_config(
        NULL, codec, AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0,
        (const void**)&ch_layouts, &num_ch_layouts
    );

    if (ret < 0)
        return ffmerr(2, 0);

    if (NULL == ch_layouts) {
        info->channel_layouts = NULL;
    } else {
        if (set_codec_info_extended(info, codec))
            return ffmerr(2, 0);
    }
#endif

    info->id = codec->id;
    info->capabilities = codec->capabilities;

    if (codec->profiles) {
        for (i = 0; i < 32; i++) {
            if (codec->profiles[i].profile == AV_PROFILE_UNKNOWN)
                break;

            info->profiles_names[i] = codec->profiles[i].name;
            info->profiles_values[i] = codec->profiles[i].profile;
            info->profiles_count = i + 1;
        }
    }

    ret = avcodec_get_supported_config(
        NULL, codec, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
        (const void**)&sample_fmts, &num_sample_fmts
    );

    if (ret < 0)
        return ffmerr(2, 0);

    if (sample_fmts) {
        for (i = 0; i < num_sample_fmts && i < 16; i++) {
            info->sample_formats[i] =
                (uint8_t)back_translate_sample_fmt(sample_fmts[i]);
            info->sample_formats_count = i + 1;
        }
    }

    return 0;
}
'''

p.write_text(s[:start] + replacement + s[end:])
print("Patched:", p)
PY
I then used make clean and continued through the install.
Afterwards, I was able to open the software
Post Reply