Skip to content

Instantly share code, notes, and snippets.

@Katzenwerfer
Last active September 24, 2022 02:36
Show Gist options
  • Save Katzenwerfer/e13d69ca2d5dbdbf0e02bde557dd96fe to your computer and use it in GitHub Desktop.
Save Katzenwerfer/e13d69ca2d5dbdbf0e02bde557dd96fe to your computer and use it in GitHub Desktop.
Force float decoding for libopus and disable the usage of FFopus decoder
diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c
index 31a04df..2857b39 100644
--- a/libavcodec/libopusdec.c
+++ b/libavcodec/libopusdec.c
@@ -63,8 +63,7 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
}
avc->sample_rate = 48000;
- avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
- AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
+ avc->sample_fmt = AV_SAMPLE_FMT_FLT;
av_channel_layout_uninit(&avc->ch_layout);
if (channels > 8) {
avc->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
index c04aa59..a6c43f3 100644
--- a/libavcodec/opusdec.c
+++ b/libavcodec/opusdec.c
@@ -713,6 +713,6 @@ const FFCodec ff_opus_decoder = {
.close = opus_decode_close,
FF_CODEC_DECODE_CB(opus_decode_packet),
.flush = opus_decode_flush,
- .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_CHANNEL_CONF,
+ .p.capabilities = AV_CODEC_CAP_EXPERIMENTAL | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_CHANNEL_CONF,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment