moved supported channel layout functions to the core for wider use
This commit is contained in:
+33
-1
@@ -233,9 +233,13 @@ void Core::DialogProjectPropertiesShow()
|
||||
|
||||
void Core::DialogExportShow()
|
||||
{
|
||||
ExportDialog ed(main_window_);
|
||||
ViewerPanel* latest_viewer = olive::panel_manager->MostRecentlyFocused<ViewerPanel>();
|
||||
|
||||
if (latest_viewer && latest_viewer->GetConnectedViewer()) {
|
||||
ExportDialog ed(latest_viewer->GetConnectedViewer(), main_window_);
|
||||
ed.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void Core::CreateNewFolder()
|
||||
{
|
||||
@@ -446,6 +450,18 @@ QList<int> Core::SupportedSampleRates()
|
||||
return sample_rates;
|
||||
}
|
||||
|
||||
QList<uint64_t> Core::SupportedChannelLayouts()
|
||||
{
|
||||
QList<uint64_t> channel_layouts;
|
||||
|
||||
channel_layouts.append(AV_CH_LAYOUT_MONO);
|
||||
channel_layouts.append(AV_CH_LAYOUT_STEREO);
|
||||
channel_layouts.append(AV_CH_LAYOUT_5POINT1);
|
||||
channel_layouts.append(AV_CH_LAYOUT_7POINT1);
|
||||
|
||||
return channel_layouts;
|
||||
}
|
||||
|
||||
QString Core::FrameRateToString(const rational &frame_rate)
|
||||
{
|
||||
return tr("%1 FPS").arg(frame_rate.toDouble());
|
||||
@@ -455,3 +471,19 @@ QString Core::SampleRateToString(const int &sample_rate)
|
||||
{
|
||||
return tr("%1 Hz").arg(sample_rate);
|
||||
}
|
||||
|
||||
QString Core::ChannelLayoutToString(const uint64_t &layout)
|
||||
{
|
||||
switch (layout) {
|
||||
case AV_CH_LAYOUT_MONO:
|
||||
return tr("Mono");
|
||||
case AV_CH_LAYOUT_STEREO:
|
||||
return tr("Stereo");
|
||||
case AV_CH_LAYOUT_5POINT1:
|
||||
return tr("5.1");
|
||||
case AV_CH_LAYOUT_7POINT1:
|
||||
return tr("7.1");
|
||||
default:
|
||||
return tr("Unknown (0x%1)").arg(layout, 1, 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +139,10 @@ public:
|
||||
* @brief Return a list of supported sample rates in integer form
|
||||
*/
|
||||
static QList<int> SupportedSampleRates();
|
||||
/**
|
||||
* @brief Return a list of supported channel layouts as or'd flags
|
||||
*/
|
||||
static QList<uint64_t> SupportedChannelLayouts();
|
||||
|
||||
/**
|
||||
* @brief Convert rational frame rate (i.e. flipped timebase) to a user-friendly string
|
||||
@@ -150,6 +154,11 @@ public:
|
||||
*/
|
||||
static QString SampleRateToString(const int &sample_rate);
|
||||
|
||||
/**
|
||||
* @brief Convert channel layout to a user-friendly string
|
||||
*/
|
||||
static QString ChannelLayoutToString(const uint64_t &layout);
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Set the current application-wide tool
|
||||
|
||||
@@ -114,10 +114,10 @@ SequenceDialog::SequenceDialog(Sequence* s, Type t, QWidget* parent) :
|
||||
}
|
||||
|
||||
// Set up available channel layouts
|
||||
AddChannelLayout(AV_CH_LAYOUT_MONO);
|
||||
AddChannelLayout(AV_CH_LAYOUT_STEREO);
|
||||
AddChannelLayout(AV_CH_LAYOUT_5POINT1);
|
||||
AddChannelLayout(AV_CH_LAYOUT_7POINT1);
|
||||
QList<uint64_t> channel_layouts = Core::SupportedChannelLayouts();
|
||||
foreach (const uint64_t& layout, channel_layouts) {
|
||||
audio_channels_field_->addItem(Core::ChannelLayoutToString(layout), layout);
|
||||
}
|
||||
|
||||
// Set values based on input sequence
|
||||
video_width_field_->setValue(sequence_->video_params().width());
|
||||
@@ -189,30 +189,6 @@ void SequenceDialog::accept()
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void SequenceDialog::AddChannelLayout(int layout)
|
||||
{
|
||||
QString layout_name;
|
||||
|
||||
switch (layout) {
|
||||
case AV_CH_LAYOUT_MONO:
|
||||
layout_name = tr("Mono");
|
||||
break;
|
||||
case AV_CH_LAYOUT_STEREO:
|
||||
layout_name = tr("Stereo");
|
||||
break;
|
||||
case AV_CH_LAYOUT_5POINT1:
|
||||
layout_name = tr("5.1");
|
||||
break;
|
||||
case AV_CH_LAYOUT_7POINT1:
|
||||
layout_name = tr("7.1");
|
||||
break;
|
||||
default:
|
||||
layout_name = tr("Unknown (0x%1)").arg(layout, 1, 16);
|
||||
}
|
||||
|
||||
audio_channels_field_->addItem(layout_name, layout);
|
||||
}
|
||||
|
||||
SequenceDialog::SequenceParamCommand::SequenceParamCommand(Sequence* s,
|
||||
const VideoParams& video_params,
|
||||
const AudioParams& audio_params,
|
||||
|
||||
@@ -82,11 +82,6 @@ public slots:
|
||||
virtual void accept() override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Internal function for adding a selectable channel layout
|
||||
*/
|
||||
void AddChannelLayout(int layout);
|
||||
|
||||
Sequence* sequence_;
|
||||
|
||||
bool make_undoable_;
|
||||
|
||||
Reference in New Issue
Block a user