试图解决编译错误

This commit is contained in:
Mike Solar
2025-08-03 22:50:24 +08:00
parent 34d44011f2
commit 994ac94ed2
9 changed files with 46 additions and 19 deletions
+1 -1
View File
@@ -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_);
+3 -3
View File
@@ -557,10 +557,10 @@ bool FFmpegDecoder::ConformAudioInternal(const QVector<QString> &filenames, cons
return false;
}
// Create resampling context
std::shared_ptr<AVChannelLayout> 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<QString> &filenames, cons
instance_.avstream()->codecpar->sample_rate,
0,
nullptr);
av_channel_layout_uninit(&layout);
swr_init(resampler);
AVPacket* pkt = av_packet_alloc();
+1 -1
View File
@@ -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());
@@ -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()
@@ -102,6 +102,8 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na
const PixelFormat default_format = static_cast<PixelFormat::Format>(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<SequencePreset>(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<SequencePreset>(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;
}
+3 -1
View File
@@ -219,9 +219,11 @@ void ViewerOutput::set_default_parameters()
OLIVE_CONFIG("DefaultSequenceInterlacing").value<VideoParams::Interlacing>(),
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
));
}
@@ -24,7 +24,7 @@
#include "node/factory.h"
#include "node/group/group.h"
#include "node/serializeddata.h"
#include <QtCore>
namespace olive {
ProjectSerializer230220::LoadData ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const
@@ -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()));
@@ -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<AVChannelLayout> &ch)
void SetChannelLayout(uint64_t ch)
{
for (int i=0; i<this->count(); 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; i<this->count(); i++) {
if (this->itemData(i).toULongLong() == ch.u.mask) {
this->setCurrentIndex(i);
break;
}
}
}
void SetChannelLayout(AVChannelLayout &&ch)
{
for (int i=0; i<this->count(); i++) {
if (this->itemData(i).toULongLong() == ch.u.mask) {
this->setCurrentIndex(i);
break;
}