mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Fix compilation with ffmpeg-4.x
This commit is contained in:
parent
3b0bd9d1d1
commit
0d7175058b
3 changed files with 13 additions and 6 deletions
|
@ -546,9 +546,10 @@ SwresamplePointer MakeSwresamplePointer(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize audio resampler
|
// Initialize audio resampler
|
||||||
|
AvErrorWrap error;
|
||||||
#if DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
#if DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
auto result = (SwrContext*)nullptr;
|
auto result = (SwrContext*)nullptr;
|
||||||
auto error = AvErrorWrap(swr_alloc_set_opts2(
|
error = AvErrorWrap(swr_alloc_set_opts2(
|
||||||
&result,
|
&result,
|
||||||
dstLayout,
|
dstLayout,
|
||||||
dstFormat,
|
dstFormat,
|
||||||
|
@ -564,7 +565,7 @@ SwresamplePointer MakeSwresamplePointer(
|
||||||
}
|
}
|
||||||
#else // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
#else // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
auto result = swr_alloc_set_opts(
|
auto result = swr_alloc_set_opts(
|
||||||
existing ? existing.get() : nullptr,
|
existing ? existing->get() : nullptr,
|
||||||
dstLayout,
|
dstLayout,
|
||||||
dstFormat,
|
dstFormat,
|
||||||
dstRate,
|
dstRate,
|
||||||
|
|
|
@ -44,7 +44,13 @@ constexpr auto kFrameSize = 4096;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(58, 79, 100)
|
||||||
auto inCodec = (const AVCodec*)nullptr;
|
auto inCodec = (const AVCodec*)nullptr;
|
||||||
|
#else
|
||||||
|
auto inCodec = (AVCodec*)nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
const auto streamId = av_find_best_stream(
|
const auto streamId = av_find_best_stream(
|
||||||
input.get(),
|
input.get(),
|
||||||
AVMEDIA_TYPE_AUDIO,
|
AVMEDIA_TYPE_AUDIO,
|
||||||
|
@ -152,10 +158,10 @@ constexpr auto kFrameSize = 4096;
|
||||||
inCodecContext->sample_rate,
|
inCodecContext->sample_rate,
|
||||||
&outCodecContext->ch_layout,
|
&outCodecContext->ch_layout,
|
||||||
#else // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
#else // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
&inCodecContext->channel_layout,
|
inCodecContext->channel_layout,
|
||||||
inCodecContext->sample_fmt,
|
inCodecContext->sample_fmt,
|
||||||
inCodecContext->sample_rate,
|
inCodecContext->sample_rate,
|
||||||
&outCodecContext->channel_layout,
|
outCodecContext->channel_layout,
|
||||||
#endif // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
#endif // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
outCodecContext->sample_fmt,
|
outCodecContext->sample_fmt,
|
||||||
outCodecContext->sample_rate);
|
outCodecContext->sample_rate);
|
||||||
|
|
|
@ -341,10 +341,10 @@ bool RoundVideoRecorder::Private::initAudio() {
|
||||||
&_swrContext);
|
&_swrContext);
|
||||||
#else // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
#else // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
_swrContext = MakeSwresamplePointer(
|
_swrContext = MakeSwresamplePointer(
|
||||||
&_audioCodec->channel_layout,
|
_audioCodec->channel_layout,
|
||||||
AV_SAMPLE_FMT_S16,
|
AV_SAMPLE_FMT_S16,
|
||||||
_audioCodec->sample_rate,
|
_audioCodec->sample_rate,
|
||||||
&_audioCodec->channel_layout,
|
_audioCodec->channel_layout,
|
||||||
_audioCodec->sample_fmt,
|
_audioCodec->sample_fmt,
|
||||||
_audioCodec->sample_rate,
|
_audioCodec->sample_rate,
|
||||||
&_swrContext);
|
&_swrContext);
|
||||||
|
|
Loading…
Add table
Reference in a new issue