various: implement sequence pixel aspect ratios and interlacing settings

Implements the following:
- Sequences have pixel aspect ratios that work in tandem with footage PARs
  to render footage correctly. Viewer and export also acknowledge PARs
- Sequences can have interlacing settings. This doesn't do anything yet,
  eventually the renderer will need to interlace/deinterlace/reinterlace
  appropriately in order to conform all the footage to the sequence. Export
  acknowledges interlacing, but this only affects metadata, not the image.
This commit is contained in:
itsmattkc
2020-08-10 01:47:26 +10:00
parent 901f1001af
commit 28dcff10c0
51 changed files with 1201 additions and 605 deletions
+46
View File
@@ -24,8 +24,31 @@ extern "C" {
#include <libavformat/avformat.h>
}
#include <QCoreApplication>
OLIVE_NAMESPACE_ENTER
const QVector<int> AudioParams::kSupportedSampleRates = {
8000, // 8000 Hz
11025, // 11025 Hz
16000, // 16000 Hz
22050, // 22050 Hz
24000, // 24000 Hz
32000, // 32000 Hz
44100, // 44100 Hz
48000, // 48000 Hz
88200, // 88200 Hz
96000 // 96000 Hz
};
const QVector<uint64_t> AudioParams::kSupportedChannelLayouts = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_2_1,
AV_CH_LAYOUT_5POINT1,
AV_CH_LAYOUT_7POINT1
};
int AudioParams::time_to_bytes(const double &time) const
{
Q_ASSERT(is_valid());
@@ -127,4 +150,27 @@ bool AudioParams::is_valid() const
&& format_ != SampleFormat::SAMPLE_FMT_COUNT);
}
QString AudioParams::SampleRateToString(const int &sample_rate)
{
return QCoreApplication::translate("AudioParams", "%1 Hz").arg(sample_rate);
}
QString AudioParams::ChannelLayoutToString(const uint64_t &layout)
{
switch (layout) {
case AV_CH_LAYOUT_MONO:
return QCoreApplication::translate("AudioParams", "Mono");
case AV_CH_LAYOUT_STEREO:
return QCoreApplication::translate("AudioParams", "Stereo");
case AV_CH_LAYOUT_2_1:
return QCoreApplication::translate("AudioParams", "2.1");
case AV_CH_LAYOUT_5POINT1:
return QCoreApplication::translate("AudioParams", "5.1");
case AV_CH_LAYOUT_7POINT1:
return QCoreApplication::translate("AudioParams", "7.1");
default:
return QCoreApplication::translate("AudioParams", "Unknown (0x%1)").arg(layout, 1, 16);
}
}
OLIVE_NAMESPACE_EXIT