Remove deprecated APIs to support ffmpeg5.

This commit is contained in:
casey langen 2022-02-06 14:24:02 -08:00
parent 6f7b86f930
commit 6c1870edc3
2 changed files with 3 additions and 9 deletions

View File

@ -85,8 +85,6 @@ class FfmpegDecoderFactory : public musik::core::sdk::IDecoderFactory {
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
#endif
av_register_all();
typeToCodecId = {
{ ".mp3", AV_CODEC_ID_MP3 },
{ "audio/mpeg", AV_CODEC_ID_MP3 },
@ -117,13 +115,13 @@ class FfmpegDecoderFactory : public musik::core::sdk::IDecoderFactory {
".wav", ".wave", ".aif", ".aiff"
};
AVCodec* codec = av_codec_next(nullptr);
while (codec != nullptr) {
void* iterator = nullptr;
const AVCodec* codec = nullptr;
while ((codec = av_codec_iterate(&iterator))) {
const AVCodecDescriptor* descriptor = avcodec_descriptor_get(codec->id);
if (descriptor != nullptr && descriptor->type == AVMEDIA_TYPE_AUDIO) {
supported.insert(descriptor->id);
}
codec = av_codec_next(codec);
}
}

View File

@ -361,10 +361,6 @@ bool FfmpegEncoder::OpenOutputContext() {
}
bool FfmpegEncoder::Initialize(IDataStream* out, size_t rate, size_t channels, size_t bitrate) {
#ifndef WIN32
av_register_all();
#endif
this->out = out;
if (this->OpenOutputContext()) {