More ffmpeg5 fixes.

This commit is contained in:
casey langen 2022-02-06 14:37:10 -08:00
parent 6c1870edc3
commit 324d5e8338
4 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,6 @@
0.96.10
* added support for ffmpeg5 libraries.
* fixed race condition in WasapiOut that caused the app to crash.
* fixed `-rpath` for macOS build.

View File

@ -314,7 +314,7 @@ bool FfmpegDecoder::Open(musik::core::sdk::IDataStream *stream) {
if (this->formatContext->iformat) {
if (avformat_open_input(&this->formatContext, "", nullptr, nullptr) == 0) {
AVCodec* codec = nullptr;
const AVCodec* codec = nullptr;
if (avformat_find_stream_info(this->formatContext, nullptr) >= 0) {
this->streamId = av_find_best_stream(
this->formatContext,
@ -576,4 +576,4 @@ AVFrame* FfmpegDecoder::AllocFrame(AVFrame* original, AVSampleFormat format, int
}
}
return original;
}
}

View File

@ -89,7 +89,7 @@ static void logError(const std::string& message) {
}
}
static AVSampleFormat resolveSampleFormat(AVCodec *codec) {
static AVSampleFormat resolveSampleFormat(const AVCodec *codec) {
if (!codec->sample_fmts) {
return AV_SAMPLE_FMT_NONE;
}
@ -105,7 +105,7 @@ static AVSampleFormat resolveSampleFormat(AVCodec *codec) {
return codec->sample_fmts[0];
}
static int resolveSampleRate(AVCodec* codec, int preferredSampleRate) {
static int resolveSampleRate(const AVCodec* codec, int preferredSampleRate) {
const int *p;
int highestRate = 0;
if (!codec->supported_samplerates) {
@ -634,4 +634,4 @@ AVFrame* FfmpegEncoder::ReallocFrame(
return original;
}
#endif // ENABLE_FFMPEG
#endif // ENABLE_FFMPEG

View File

@ -84,7 +84,7 @@ class FfmpegEncoder : public musik::core::sdk::IBlockingEncoder {
IDataStream* out;
int readBufferSize;
AVAudioFifo* outputFifo;
AVCodec* outputCodec;
const AVCodec* outputCodec;
AVCodecContext* outputContext;
AVFormatContext* outputFormatContext;
AVIOContext* ioContext;
@ -98,4 +98,4 @@ class FfmpegEncoder : public musik::core::sdk::IBlockingEncoder {
int inputSampleRate;
};
#endif // ENABLE_FFMPEG
#endif // ENABLE_FFMPEG