Fix build with FFmpeg < 5.1.
This commit is contained in:
parent
8975a31597
commit
214b112de0
|
@ -526,9 +526,13 @@ bool AbstractAudioFFMpegLoader::ensureResampleSpaceAvailable(int samples) {
|
||||||
AV_ROUND_UP)));
|
AV_ROUND_UP)));
|
||||||
_resampledFrame->sample_rate = _swrDstRate;
|
_resampledFrame->sample_rate = _swrDstRate;
|
||||||
_resampledFrame->format = _swrDstSampleFormat;
|
_resampledFrame->format = _swrDstSampleFormat;
|
||||||
|
#if DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
av_channel_layout_copy(
|
av_channel_layout_copy(
|
||||||
&_resampledFrame->ch_layout,
|
&_resampledFrame->ch_layout,
|
||||||
&_swrDstChannelLayout);
|
&_swrDstChannelLayout);
|
||||||
|
#else // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
|
_resampledFrame->channel_layout = _swrDstChannelLayout;
|
||||||
|
#endif // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
_resampledFrame->nb_samples = allocate;
|
_resampledFrame->nb_samples = allocate;
|
||||||
if (AvErrorWrap error = av_frame_get_buffer(_resampledFrame.get(), 0)) {
|
if (AvErrorWrap error = av_frame_get_buffer(_resampledFrame.get(), 0)) {
|
||||||
LogError(u"av_frame_get_buffer"_q, error);
|
LogError(u"av_frame_get_buffer"_q, error);
|
||||||
|
@ -587,10 +591,19 @@ void AbstractAudioFFMpegLoader::createSpeedFilter(float64 speed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char layout[64] = { 0 };
|
char layout[64] = { 0 };
|
||||||
|
#if DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
av_channel_layout_describe(
|
av_channel_layout_describe(
|
||||||
&_swrDstChannelLayout,
|
&_swrDstChannelLayout,
|
||||||
layout,
|
layout,
|
||||||
sizeof(layout));
|
sizeof(layout));
|
||||||
|
#else // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
|
av_get_channel_layout_string(
|
||||||
|
layout,
|
||||||
|
sizeof(layout),
|
||||||
|
0,
|
||||||
|
_swrDstChannelLayout);
|
||||||
|
#endif // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
|
|
||||||
av_opt_set(
|
av_opt_set(
|
||||||
_filterSrc,
|
_filterSrc,
|
||||||
"channel_layout",
|
"channel_layout",
|
||||||
|
|
Loading…
Reference in New Issue