audio: extended support for planar/packed formats
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
const int ExportAudioTab::kDefaultBitRate = 320;
|
||||
|
||||
ExportAudioTab::ExportAudioTab(QWidget* parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
@@ -40,6 +42,8 @@ ExportAudioTab::ExportAudioTab(QWidget* parent) :
|
||||
layout->addWidget(new QLabel(tr("Codec:")), row, 0);
|
||||
|
||||
codec_combobox_ = new QComboBox();
|
||||
connect(codec_combobox_, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ExportAudioTab::UpdateSampleFormats);
|
||||
connect(codec_combobox_, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ExportAudioTab::UpdateBitRateEnabled);
|
||||
layout->addWidget(codec_combobox_, row, 1);
|
||||
|
||||
row++;
|
||||
@@ -70,7 +74,7 @@ ExportAudioTab::ExportAudioTab(QWidget* parent) :
|
||||
bit_rate_slider_ = new IntegerSlider();
|
||||
bit_rate_slider_->SetMinimum(32);
|
||||
bit_rate_slider_->SetMaximum(320);
|
||||
bit_rate_slider_->SetValue(320);
|
||||
bit_rate_slider_->SetValue(kDefaultBitRate);
|
||||
bit_rate_slider_->SetFormat(tr("%1 kbps"));
|
||||
layout->addWidget(bit_rate_slider_, row, 1);
|
||||
|
||||
@@ -81,11 +85,36 @@ int ExportAudioTab::SetFormat(ExportFormat::Format format)
|
||||
{
|
||||
QList<ExportCodec::Codec> acodecs = ExportFormat::GetAudioCodecs(format);
|
||||
setEnabled(!acodecs.isEmpty());
|
||||
codec_combobox_->blockSignals(true);
|
||||
codec_combobox_->clear();
|
||||
foreach (ExportCodec::Codec acodec, acodecs) {
|
||||
codec_combobox_->addItem(ExportCodec::GetCodecName(acodec), acodec);
|
||||
}
|
||||
codec_combobox_->blockSignals(false);
|
||||
fmt_ = format;
|
||||
|
||||
UpdateSampleFormats();
|
||||
UpdateBitRateEnabled();
|
||||
|
||||
return acodecs.size();
|
||||
}
|
||||
|
||||
void ExportAudioTab::UpdateSampleFormats()
|
||||
{
|
||||
auto fmts = ExportFormat::GetSampleFormatsForCodec(fmt_, GetCodec());
|
||||
sample_format_combobox_->SetAvailableFormats(fmts);
|
||||
}
|
||||
|
||||
void ExportAudioTab::UpdateBitRateEnabled()
|
||||
{
|
||||
bool uses_bitrate = !ExportCodec::IsCodecLossless(GetCodec());
|
||||
bit_rate_slider_->setEnabled(uses_bitrate);
|
||||
|
||||
if (!uses_bitrate) {
|
||||
bit_rate_slider_->SetTristate();
|
||||
} else {
|
||||
bit_rate_slider_->SetValue(kDefaultBitRate );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user