mirror of
https://github.com/isledecomp/SIEdit.git
synced 2025-02-17 00:40:42 -05:00
app: add support for ffmpeg 5.1+
This commit is contained in:
parent
fef643b1a7
commit
f37b321b7d
1 changed files with 16 additions and 0 deletions
|
@ -725,6 +725,21 @@ bool MediaInstance::StartPlayingAudio(const QAudioDeviceInfo &output_dev, const
|
|||
m_playbackFormat = fmt;
|
||||
m_AudioOutputSampleFmt = smp_fmt;
|
||||
|
||||
#if LIBSWRESAMPLE_VERSION_INT >= AV_VERSION_INT(4, 7, 0)
|
||||
AVChannelLayout out;
|
||||
av_channel_layout_default(&out, fmt.channelCount());
|
||||
|
||||
int r = swr_alloc_set_opts2(&m_SwrCtx,
|
||||
&out,
|
||||
smp_fmt,
|
||||
fmt.sampleRate(),
|
||||
&m_Stream->codecpar->ch_layout,
|
||||
static_cast<AVSampleFormat>(m_Stream->codecpar->format),
|
||||
m_Stream->codecpar->sample_rate,
|
||||
0, nullptr);
|
||||
if (r < 0) {
|
||||
qCritical() << "Failed to alloc swr ctx:" << r;
|
||||
#else
|
||||
m_SwrCtx = swr_alloc_set_opts(nullptr,
|
||||
av_get_default_channel_layout(fmt.channelCount()),
|
||||
smp_fmt,
|
||||
|
@ -735,6 +750,7 @@ bool MediaInstance::StartPlayingAudio(const QAudioDeviceInfo &output_dev, const
|
|||
0, nullptr);
|
||||
if (!m_SwrCtx) {
|
||||
qCritical() << "Failed to alloc swr ctx";
|
||||
#endif
|
||||
} else {
|
||||
if (swr_init(m_SwrCtx) < 0) {
|
||||
qCritical() << "Failed to init swr ctx";
|
||||
|
|
Loading…
Reference in a new issue