]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
a52 plugin: AVSampleFormat fix for FFMPEG 9 HEAD master
authorJaroslav Kysela <perex@perex.cz>
Thu, 3 Sep 2026 12:38:05 +0000 (14:38 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 3 Sep 2026 12:46:03 +0000 (14:46 +0200)
Fixes: https://github.com/alsa-project/alsa-plugins/issues/64
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
a52/pcm_a52.c

index cd56abb24569265e1a76caea6afd8e61fe5bb852..bbd4f54ffef513155ff1e23a267e77b234ae042b 100644 (file)
@@ -1202,7 +1202,22 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
        rec->io.flags = SND_PCM_IOPLUG_FLAG_BOUNDARY_WA;
 #endif
 #ifdef USE_AVCODEC_FRAME
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100)
+       {
+               const enum AVSampleFormat *sample_fmts = NULL;
+               err = avcodec_get_supported_config(NULL, rec->codec,
+                                                  AV_CODEC_CONFIG_SAMPLE_FORMAT,
+                                                  0, (const void **)&sample_fmts,
+                                                  NULL);
+               if (err < 0 || !sample_fmts) {
+                       err = -EINVAL;
+                       goto error;
+               }
+               rec->av_format = sample_fmts[0];
+       }
+#else
        rec->av_format = rec->codec->sample_fmts[0];
+#endif
        rec->is_planar = av_sample_fmt_is_planar(rec->av_format);
 #else
        rec->av_format = AV_SAMPLE_FMT_S16;