diff --git a/src/filescanner_ffmpeg.c b/src/filescanner_ffmpeg.c index 5a50b611..08063e54 100644 --- a/src/filescanner_ffmpeg.c +++ b/src/filescanner_ffmpeg.c @@ -410,7 +410,9 @@ scan_metadata_ffmpeg(char *file, struct media_file_info *mfi) mfi->samplerate = audio_stream->codec->sample_rate; /* Try sample format first */ -#if LIBAVCODEC_VERSION_MAJOR >= 53 +#if LIBAVUTIL_VERSION_MAJOR >= 51 || (LIBAVUTIL_VERSION_MAJOR == 51 && LIBAVUTIL_VERSION_MINOR >= 4) + mfi->bits_per_sample = 8 * av_get_bytes_per_sample(audio_stream->codec->sample_fmt); +#elif LIBAVCODEC_VERSION_MAJOR >= 53 mfi->bits_per_sample = av_get_bits_per_sample_fmt(audio_stream->codec->sample_fmt); #else mfi->bits_per_sample = av_get_bits_per_sample_format(audio_stream->codec->sample_fmt); diff --git a/src/transcode.c b/src/transcode.c index 2d704ed5..feb2ccbd 100644 --- a/src/transcode.c +++ b/src/transcode.c @@ -454,7 +454,9 @@ transcode_setup(struct media_file_info *mfi, off_t *est_size, int wavhdr) } ctx->need_resample = 1; -#if LIBAVCODEC_VERSION_MAJOR >= 53 +#if LIBAVUTIL_VERSION_MAJOR >= 51 || (LIBAVUTIL_VERSION_MAJOR == 51 && LIBAVUTIL_VERSION_MINOR >= 4) + ctx->input_size = ctx->acodec->channels * av_get_bytes_per_sample(ctx->acodec->sample_fmt); +#elif LIBAVCODEC_VERSION_MAJOR >= 53 ctx->input_size = ctx->acodec->channels * av_get_bits_per_sample_fmt(ctx->acodec->sample_fmt) / 8; #else ctx->input_size = ctx->acodec->channels * av_get_bits_per_sample_format(ctx->acodec->sample_fmt) / 8;