diff --git a/app/audio/audioprocessor.cpp b/app/audio/audioprocessor.cpp index 6cc04d171..1e3eb9218 100644 --- a/app/audio/audioprocessor.cpp +++ b/app/audio/audioprocessor.cpp @@ -125,7 +125,7 @@ bool AudioProcessor::Open(const AudioParams &from, const AudioParams &to, double snprintf(filter_args, 200, "sample_fmts=%s:sample_rates=%d:channel_layouts=0x%" PRIx64, av_get_sample_fmt_name(to_fmt_), to.sample_rate(), - to.channel_layout()); + to.channel_layout().u.mask); AVFilterContext *c; r = avfilter_graph_create_filter(&c, avfilter_get_by_name("aformat"), "fmt", filter_args, nullptr, filter_graph_); diff --git a/app/codec/ffmpeg/ffmpegdecoder.cpp b/app/codec/ffmpeg/ffmpegdecoder.cpp index 14f61abf6..035793f11 100644 --- a/app/codec/ffmpeg/ffmpegdecoder.cpp +++ b/app/codec/ffmpeg/ffmpegdecoder.cpp @@ -557,10 +557,10 @@ bool FFmpegDecoder::ConformAudioInternal(const QVector &filenames, cons return false; } // Create resampling context - std::shared_ptr layout=params.channel_layout(); + AVChannelLayout layout=params.channel_layout(); SwrContext* resampler; swr_alloc_set_opts2(&resampler, - layout.get(), + &layout, FFmpegUtils::GetFFmpegSampleFormat(params.format()), params.sample_rate(), &channel_layout, @@ -568,7 +568,7 @@ bool FFmpegDecoder::ConformAudioInternal(const QVector &filenames, cons instance_.avstream()->codecpar->sample_rate, 0, nullptr); - + av_channel_layout_uninit(&layout); swr_init(resampler); AVPacket* pkt = av_packet_alloc(); diff --git a/app/dialog/export/export.cpp b/app/dialog/export/export.cpp index 552a9d0a1..c5cfa2a17 100644 --- a/app/dialog/export/export.cpp +++ b/app/dialog/export/export.cpp @@ -749,7 +749,7 @@ void ExportDialog::SetParams(const EncodingParams &e) audio_enabled_->setChecked(e.audio_enabled()); if (e.audio_enabled()) { audio_tab_->sample_rate_combobox()->SetSampleRate(e.audio_params().sample_rate()); - audio_tab_->channel_layout_combobox()->SetChannelLayout(e.audio_params().channel_layout().u.mask()); + audio_tab_->channel_layout_combobox()->SetChannelLayout(e.audio_params().channel_layout()); audio_tab_->sample_format_combobox()->SetSampleFormat(e.audio_params().format()); audio_tab_->SetCodec(e.audio_codec()); diff --git a/app/dialog/sequence/sequencedialogparametertab.cpp b/app/dialog/sequence/sequencedialogparametertab.cpp index aab63923b..4f25e176a 100644 --- a/app/dialog/sequence/sequencedialogparametertab.cpp +++ b/app/dialog/sequence/sequencedialogparametertab.cpp @@ -124,6 +124,7 @@ void SequenceDialogParameterTab::PresetChanged(const SequencePreset &preset) void SequenceDialogParameterTab::SavePresetClicked() { + AVChannelLayout layout=GetSelectedAudioChannelLayout(); emit SaveParametersAsPreset(SequencePreset(QString(), GetSelectedVideoWidth(), GetSelectedVideoHeight(), @@ -131,10 +132,11 @@ void SequenceDialogParameterTab::SavePresetClicked() GetSelectedVideoPixelAspect(), GetSelectedVideoInterlacingMode(), GetSelectedAudioSampleRate(), - GetSelectedAudioChannelLayout(), + layout, GetSelectedPreviewResolution(), GetSelectedPreviewFormat(), GetSelectedPreviewAutoCache())); + av_channel_layout_uninit(&layout); } void SequenceDialogParameterTab::UpdatePreviewResolutionLabel() diff --git a/app/dialog/sequence/sequencedialogpresettab.cpp b/app/dialog/sequence/sequencedialogpresettab.cpp index b027066c1..d0fa8b80e 100644 --- a/app/dialog/sequence/sequencedialogpresettab.cpp +++ b/app/dialog/sequence/sequencedialogpresettab.cpp @@ -102,6 +102,8 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na const PixelFormat default_format = static_cast(OLIVE_CONFIG("OfflinePixelFormat").toInt()); const bool default_autocache = false; QTreeWidgetItem* parent = CreateFolder(name); + AVChannelLayout layout; + av_channel_layout_from_mask(&layout, AV_CH_LAYOUT_STEREO); AddStandardItem(parent, std::make_shared(tr("%1 23.976 FPS").arg(name), width, height, @@ -109,7 +111,7 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na VideoParams::kPixelAspectSquare, VideoParams::kInterlaceNone, 48000, - AV_CH_LAYOUT_STEREO, + layout, divider, default_format, default_autocache)); @@ -120,7 +122,7 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na VideoParams::kPixelAspectSquare, VideoParams::kInterlaceNone, 48000, - AV_CH_LAYOUT_STEREO, + layout, divider, default_format, default_autocache)); @@ -131,7 +133,7 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na VideoParams::kPixelAspectSquare, VideoParams::kInterlaceNone, 48000, - AV_CH_LAYOUT_STEREO, + layout, divider, default_format, default_autocache)); @@ -142,7 +144,7 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na VideoParams::kPixelAspectSquare, VideoParams::kInterlaceNone, 48000, - AV_CH_LAYOUT_STEREO, + layout, divider, default_format, default_autocache)); @@ -153,10 +155,11 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na VideoParams::kPixelAspectSquare, VideoParams::kInterlaceNone, 48000, - AV_CH_LAYOUT_STEREO, + layout, divider, default_format, default_autocache)); + av_channel_layout_uninit(&layout); return parent; } @@ -166,6 +169,8 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &na const bool default_autocache = false; QTreeWidgetItem* parent = CreateFolder(name); preset_tree_->addTopLevelItem(parent); + AVChannelLayout layout; + av_channel_layout_from_mask(&layout,AV_CH_LAYOUT_STEREO); AddStandardItem(parent, std::make_shared(tr("%1 Standard").arg(name), width, height, @@ -173,7 +178,7 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &na standard_par, VideoParams::kInterlacedBottomFirst, 48000, - AV_CH_LAYOUT_STEREO, + layout, divider, default_format, default_autocache)); @@ -184,10 +189,11 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &na wide_par, VideoParams::kInterlacedBottomFirst, 48000, - AV_CH_LAYOUT_STEREO, + layout, divider, default_format, default_autocache)); + av_channel_layout_uninit(&layout); return parent; } diff --git a/app/node/output/viewer/viewer.cpp b/app/node/output/viewer/viewer.cpp index adada2aa5..d55b71b65 100644 --- a/app/node/output/viewer/viewer.cpp +++ b/app/node/output/viewer/viewer.cpp @@ -219,9 +219,11 @@ void ViewerOutput::set_default_parameters() OLIVE_CONFIG("DefaultSequenceInterlacing").value(), VideoParams::generate_auto_divider(width, height) )); + AVChannelLayout layout; + av_channel_layout_from_mask(&layout, OLIVE_CONFIG("DefaultSequenceAudioLayout").toULongLong()); SetAudioParams(AudioParams( OLIVE_CONFIG("DefaultSequenceAudioFrequency").toInt(), - OLIVE_CONFIG("DefaultSequenceAudioLayout").toULongLong(), + layout, kDefaultSampleFormat )); } diff --git a/app/node/project/serializer/serializer230220.cpp b/app/node/project/serializer/serializer230220.cpp index 06e140ad6..66f807ff6 100644 --- a/app/node/project/serializer/serializer230220.cpp +++ b/app/node/project/serializer/serializer230220.cpp @@ -24,7 +24,7 @@ #include "node/factory.h" #include "node/group/group.h" #include "node/serializeddata.h" - +#include namespace olive { ProjectSerializer230220::LoadData ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const diff --git a/app/node/project/serializer/typeserializer.cpp b/app/node/project/serializer/typeserializer.cpp index 003613597..e832daf4d 100644 --- a/app/node/project/serializer/typeserializer.cpp +++ b/app/node/project/serializer/typeserializer.cpp @@ -52,7 +52,7 @@ AudioParams TypeSerializer::LoadAudioParams(QXmlStreamReader *reader) void TypeSerializer::SaveAudioParams(QXmlStreamWriter *writer, const AudioParams &a) { writer->writeTextElement(QStringLiteral("samplerate"), QString::number(a.sample_rate())); - writer->writeTextElement(QStringLiteral("channellayout"), QString::number(a.channel_layout())); + writer->writeTextElement(QStringLiteral("channellayout"), QString::number(a.channel_layout().u.mask)); writer->writeTextElement(QStringLiteral("format"), QString::fromStdString(a.format().to_string())); writer->writeTextElement(QStringLiteral("enabled"), QString::number(a.enabled())); writer->writeTextElement(QStringLiteral("streamindex"), QString::number(a.stream_index())); diff --git a/app/widget/standardcombos/channellayoutcombobox.h b/app/widget/standardcombos/channellayoutcombobox.h index 575ae12d9..444e21ccf 100644 --- a/app/widget/standardcombos/channellayoutcombobox.h +++ b/app/widget/standardcombos/channellayoutcombobox.h @@ -50,11 +50,28 @@ public: av_channel_layout_from_mask(&audio_channel_layout_, this->currentData().toULongLong()); return audio_channel_layout_; } - - void SetChannelLayout(std::shared_ptr &ch) + void SetChannelLayout(uint64_t ch) { for (int i=0; icount(); i++) { - if (this->itemData(i).toULongLong() == ch->u.mask) { + if (this->itemData(i).toULongLong() == ch) { + this->setCurrentIndex(i); + break; + } + } + } + void SetChannelLayout(AVChannelLayout &ch) + { + for (int i=0; icount(); i++) { + if (this->itemData(i).toULongLong() == ch.u.mask) { + this->setCurrentIndex(i); + break; + } + } + } + void SetChannelLayout(AVChannelLayout &&ch) + { + for (int i=0; icount(); i++) { + if (this->itemData(i).toULongLong() == ch.u.mask) { this->setCurrentIndex(i); break; } diff --git a/ext/core b/ext/core index 354933488..327f66582 160000 --- a/ext/core +++ b/ext/core @@ -1 +1 @@ -Subproject commit 35493348802324dbe881a4ef556ec9f9179ba113 +Subproject commit 327f66582cba63434ec6ac19053613e70943ec2d