sequence: made divider a sequence parameter rather than a viewer parameter
Doing this makes the preview resolution an explicit project setting rather than a temporary UI setting. This will allow more consistency when caching.
This commit is contained in:
@@ -148,7 +148,7 @@ void AudioManager::SetOutputDevice(const QAudioDeviceInfo &info)
|
||||
}
|
||||
}
|
||||
|
||||
void AudioManager::SetOutputParams(const AudioRenderingParams ¶ms)
|
||||
void AudioManager::SetOutputParams(const AudioParams ¶ms)
|
||||
{
|
||||
if (output_params_ != params) {
|
||||
output_params_ = params;
|
||||
@@ -156,7 +156,7 @@ void AudioManager::SetOutputParams(const AudioRenderingParams ¶ms)
|
||||
QMetaObject::invokeMethod(&output_manager_,
|
||||
"SetParameters",
|
||||
Qt::QueuedConnection,
|
||||
OLIVE_NS_ARG(AudioRenderingParams, params));
|
||||
OLIVE_NS_ARG(AudioParams, params));
|
||||
|
||||
// Refresh output device
|
||||
SetOutputDevice(output_device_info_);
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
void SetOutputDevice(const QAudioDeviceInfo& info);
|
||||
|
||||
void SetOutputParams(const AudioRenderingParams& params);
|
||||
void SetOutputParams(const AudioParams& params);
|
||||
|
||||
void SetInputDevice(const QAudioDeviceInfo& info);
|
||||
|
||||
@@ -88,7 +88,7 @@ signals:
|
||||
|
||||
void OutputDeviceStarted(const QString& filename, qint64 offset, int playback_speed);
|
||||
|
||||
void AudioParamsChanged(const AudioRenderingParams& params);
|
||||
void AudioParamsChanged(const AudioParams& params);
|
||||
|
||||
void OutputPushed(const QByteArray& data);
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
bool output_is_set_;
|
||||
|
||||
QAudioDeviceInfo output_device_info_;
|
||||
AudioRenderingParams output_params_;
|
||||
AudioParams output_params_;
|
||||
|
||||
std::unique_ptr<QAudioInput> input_;
|
||||
QAudioDeviceInfo input_device_info_;
|
||||
|
||||
@@ -31,7 +31,7 @@ AudioOutputDeviceProxy::~AudioOutputDeviceProxy()
|
||||
}
|
||||
}
|
||||
|
||||
void AudioOutputDeviceProxy::SetParameters(const AudioRenderingParams ¶ms)
|
||||
void AudioOutputDeviceProxy::SetParameters(const AudioParams ¶ms)
|
||||
{
|
||||
params_ = params;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
virtual ~AudioOutputDeviceProxy() override;
|
||||
|
||||
void SetParameters(const AudioRenderingParams& params);
|
||||
void SetParameters(const AudioParams& params);
|
||||
|
||||
void SetDevice(const QString &filename, qint64 offset, int playback_speed);
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
|
||||
TempoProcessor tempo_processor_;
|
||||
|
||||
AudioRenderingParams params_;
|
||||
AudioParams params_;
|
||||
|
||||
int playback_speed_;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ void AudioOutputManager::ResetToPushMode()
|
||||
}
|
||||
}
|
||||
|
||||
void AudioOutputManager::SetParameters(AudioRenderingParams params)
|
||||
void AudioOutputManager::SetParameters(AudioParams params)
|
||||
{
|
||||
device_proxy_.SetParameters(params);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public slots:
|
||||
void ResetToPushMode();
|
||||
|
||||
// Queued
|
||||
void SetParameters(OLIVE_NAMESPACE::AudioRenderingParams params);
|
||||
void SetParameters(OLIVE_NAMESPACE::AudioParams params);
|
||||
|
||||
// Queued
|
||||
void Close();
|
||||
|
||||
@@ -52,7 +52,7 @@ const double &TempoProcessor::GetSpeed() const
|
||||
return speed_;
|
||||
}
|
||||
|
||||
bool TempoProcessor::Open(const AudioRenderingParams ¶ms, const double& speed)
|
||||
bool TempoProcessor::Open(const AudioParams ¶ms, const double& speed)
|
||||
{
|
||||
if (open_) {
|
||||
return true;
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
const double& GetSpeed() const;
|
||||
|
||||
bool Open(const AudioRenderingParams& params, const double &speed);
|
||||
bool Open(const AudioParams& params, const double &speed);
|
||||
|
||||
void Push(const char *data, int length);
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
int processed_frame_byte_index_;
|
||||
int processed_frame_max_bytes_;
|
||||
|
||||
AudioRenderingParams params_;
|
||||
AudioParams params_;
|
||||
|
||||
int64_t timestamp_;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ FramePtr Decoder::RetrieveVideo(const rational &/*timecode*/, const int &/*divid
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SampleBufferPtr Decoder::RetrieveAudio(const rational &/*timecode*/, const rational &/*length*/, const AudioRenderingParams &/*params*/)
|
||||
SampleBufferPtr Decoder::RetrieveAudio(const rational &/*timecode*/, const rational &/*length*/, const AudioParams &/*params*/)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ DecoderPtr Decoder::CreateFromID(const QString &id)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString Decoder::GetConformedFilename(const AudioRenderingParams ¶ms)
|
||||
QString Decoder::GetConformedFilename(const AudioParams ¶ms)
|
||||
{
|
||||
QString index_fn = GetIndexFilename();
|
||||
|
||||
@@ -180,12 +180,12 @@ bool Decoder::ProxyVideo(const QAtomicInt *, int )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Decoder::ConformAudio(const QAtomicInt *, const AudioRenderingParams& )
|
||||
bool Decoder::ConformAudio(const QAtomicInt *, const AudioParams& )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Decoder::HasConformedVersion(const AudioRenderingParams ¶ms)
|
||||
bool Decoder::HasConformedVersion(const AudioParams ¶ms)
|
||||
{
|
||||
if (stream()->type() != Stream::kAudio) {
|
||||
return false;
|
||||
|
||||
+4
-4
@@ -164,7 +164,7 @@ public:
|
||||
* A FramePtr of valid data at this timecode of the requested length or nullptr if there was nothing to retrieve at
|
||||
* the provided timecode or the media could not be opened.
|
||||
*/
|
||||
virtual SampleBufferPtr RetrieveAudio(const rational& timecode, const rational& length, const AudioRenderingParams& params);
|
||||
virtual SampleBufferPtr RetrieveAudio(const rational& timecode, const rational& length, const AudioParams& params);
|
||||
|
||||
virtual bool SupportsVideo();
|
||||
virtual bool SupportsAudio();
|
||||
@@ -229,13 +229,13 @@ public:
|
||||
* All audio decoders must override this. It's not pure since video decoders don't need to use
|
||||
* this, but default behavior will abort since it should never be called.
|
||||
*/
|
||||
virtual bool ConformAudio(const QAtomicInt* cancelled, const AudioRenderingParams ¶ms);
|
||||
virtual bool ConformAudio(const QAtomicInt* cancelled, const AudioParams ¶ms);
|
||||
|
||||
/**
|
||||
* @brief AUDIO ONLY: Returns whether a transcode of this audio matching the specified params
|
||||
* already exists
|
||||
*/
|
||||
bool HasConformedVersion(const AudioRenderingParams& params);
|
||||
bool HasConformedVersion(const AudioParams& params);
|
||||
|
||||
signals:
|
||||
/**
|
||||
@@ -258,7 +258,7 @@ protected:
|
||||
/**
|
||||
* @brief Get the destination filename of an audio stream conformed to a set of parameters
|
||||
*/
|
||||
QString GetConformedFilename(const AudioRenderingParams ¶ms);
|
||||
QString GetConformedFilename(const AudioParams ¶ms);
|
||||
|
||||
bool open_;
|
||||
|
||||
|
||||
@@ -49,14 +49,14 @@ void EncodingParams::SetFilename(const QString &filename)
|
||||
filename_ = filename;
|
||||
}
|
||||
|
||||
void EncodingParams::EnableVideo(const VideoRenderingParams &video_params, const ExportCodec::Codec &vcodec)
|
||||
void EncodingParams::EnableVideo(const VideoParams &video_params, const ExportCodec::Codec &vcodec)
|
||||
{
|
||||
video_enabled_ = true;
|
||||
video_params_ = video_params;
|
||||
video_codec_ = vcodec;
|
||||
}
|
||||
|
||||
void EncodingParams::EnableAudio(const AudioRenderingParams &audio_params, const ExportCodec::Codec &acodec)
|
||||
void EncodingParams::EnableAudio(const AudioParams &audio_params, const ExportCodec::Codec &acodec)
|
||||
{
|
||||
audio_enabled_ = true;
|
||||
audio_params_ = audio_params;
|
||||
@@ -103,7 +103,7 @@ const ExportCodec::Codec &EncodingParams::video_codec() const
|
||||
return video_codec_;
|
||||
}
|
||||
|
||||
const VideoRenderingParams &EncodingParams::video_params() const
|
||||
const VideoParams &EncodingParams::video_params() const
|
||||
{
|
||||
return video_params_;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ const ExportCodec::Codec &EncodingParams::audio_codec() const
|
||||
return audio_codec_;
|
||||
}
|
||||
|
||||
const AudioRenderingParams &EncodingParams::audio_params() const
|
||||
const AudioParams &EncodingParams::audio_params() const
|
||||
{
|
||||
return audio_params_;
|
||||
}
|
||||
|
||||
+7
-7
@@ -42,8 +42,8 @@ public:
|
||||
|
||||
void SetFilename(const QString& filename);
|
||||
|
||||
void EnableVideo(const VideoRenderingParams& video_params, const ExportCodec::Codec& vcodec);
|
||||
void EnableAudio(const AudioRenderingParams& audio_params, const ExportCodec::Codec &acodec);
|
||||
void EnableVideo(const VideoParams& video_params, const ExportCodec::Codec& vcodec);
|
||||
void EnableAudio(const AudioParams& audio_params, const ExportCodec::Codec &acodec);
|
||||
|
||||
void set_video_option(const QString& key, const QString& value);
|
||||
void set_video_bit_rate(const int64_t& rate);
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
bool video_enabled() const;
|
||||
const ExportCodec::Codec& video_codec() const;
|
||||
const VideoRenderingParams& video_params() const;
|
||||
const VideoParams& video_params() const;
|
||||
const QHash<QString, QString>& video_opts() const;
|
||||
const int64_t& video_bit_rate() const;
|
||||
const int64_t& video_max_bit_rate() const;
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
bool audio_enabled() const;
|
||||
const ExportCodec::Codec &audio_codec() const;
|
||||
const AudioRenderingParams& audio_params() const;
|
||||
const AudioParams& audio_params() const;
|
||||
|
||||
const rational& GetExportLength() const;
|
||||
void SetExportLength(const rational& GetExportLength);
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
|
||||
bool video_enabled_;
|
||||
ExportCodec::Codec video_codec_;
|
||||
VideoRenderingParams video_params_;
|
||||
VideoParams video_params_;
|
||||
QHash<QString, QString> video_opts_;
|
||||
int64_t video_bit_rate_;
|
||||
int64_t video_max_bit_rate_;
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
|
||||
bool audio_enabled_;
|
||||
ExportCodec::Codec audio_codec_;
|
||||
AudioRenderingParams audio_params_;
|
||||
AudioParams audio_params_;
|
||||
|
||||
rational export_length_;
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
virtual bool Open() = 0;
|
||||
|
||||
virtual bool WriteFrame(OLIVE_NAMESPACE::FramePtr frame, OLIVE_NAMESPACE::rational time) = 0;
|
||||
virtual void WriteAudio(OLIVE_NAMESPACE::AudioRenderingParams pcm_info,
|
||||
virtual void WriteAudio(OLIVE_NAMESPACE::AudioParams pcm_info,
|
||||
const QString& pcm_filename) = 0;
|
||||
|
||||
virtual void Close() = 0;
|
||||
|
||||
@@ -169,10 +169,10 @@ FramePtr FFmpegDecoder::RetrieveVideo(const rational &timecode, const int &divid
|
||||
|
||||
if (in) {
|
||||
FramePtr copy = Frame::Create();
|
||||
copy->set_video_params(VideoRenderingParams(vs->width(),
|
||||
vs->height(),
|
||||
native_pix_fmt_,
|
||||
vs->using_proxy()));
|
||||
copy->set_video_params(VideoParams(vs->width(),
|
||||
vs->height(),
|
||||
native_pix_fmt_,
|
||||
vs->using_proxy()));
|
||||
copy->set_timestamp(Timecode::timestamp_to_time(target_ts, time_base_));
|
||||
copy->set_sample_aspect_ratio(aspect_ratio_);
|
||||
copy->allocate();
|
||||
@@ -315,10 +315,10 @@ FramePtr FFmpegDecoder::RetrieveVideo(const rational &timecode, const int &divid
|
||||
|
||||
// Create frame to return
|
||||
FramePtr copy = Frame::Create();
|
||||
copy->set_video_params(VideoRenderingParams(vs->width(),
|
||||
vs->height(),
|
||||
native_pix_fmt_,
|
||||
divider));
|
||||
copy->set_video_params(VideoParams(vs->width(),
|
||||
vs->height(),
|
||||
native_pix_fmt_,
|
||||
divider));
|
||||
copy->set_timestamp(Timecode::timestamp_to_time(target_ts, time_base_));
|
||||
copy->set_sample_aspect_ratio(aspect_ratio_);
|
||||
copy->allocate();
|
||||
@@ -353,7 +353,7 @@ FramePtr FFmpegDecoder::RetrieveVideo(const rational &timecode, const int &divid
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SampleBufferPtr FFmpegDecoder::RetrieveAudio(const rational &timecode, const rational &length, const AudioRenderingParams ¶ms)
|
||||
SampleBufferPtr FFmpegDecoder::RetrieveAudio(const rational &timecode, const rational &length, const AudioParams ¶ms)
|
||||
{
|
||||
QMutexLocker locker(&mutex_);
|
||||
|
||||
@@ -370,7 +370,7 @@ SampleBufferPtr FFmpegDecoder::RetrieveAudio(const rational &timecode, const rat
|
||||
WaveInput input(wav_fn);
|
||||
|
||||
if (input.open()) {
|
||||
const AudioRenderingParams& input_params = input.params();
|
||||
const AudioParams& input_params = input.params();
|
||||
|
||||
// Read bytes from wav
|
||||
QByteArray packed_data = input.read(input_params.time_to_bytes(timecode), input_params.time_to_bytes(length));
|
||||
@@ -639,7 +639,7 @@ QMutex scaler_lock;
|
||||
void SaveCacheFrame(FFmpegDecoder* decoder,
|
||||
SwsContext* scaler,
|
||||
AVFrame* frame,
|
||||
VideoRenderingParams params,
|
||||
VideoParams params,
|
||||
QString dst_fn)
|
||||
{
|
||||
QByteArray converted_buffer(PixelFormat::GetBufferSize(params.format(),
|
||||
@@ -722,9 +722,9 @@ bool FFmpegDecoder::ProxyVideo(const QAtomicInt *cancelled, int divider)
|
||||
QVector< QFuture<void> > futures;
|
||||
int finished_futures = 0;
|
||||
|
||||
VideoRenderingParams converted_params(divided_width,
|
||||
divided_height,
|
||||
native_fmt);
|
||||
VideoParams converted_params(divided_width,
|
||||
divided_height,
|
||||
native_fmt);
|
||||
|
||||
bool succeeded = false;
|
||||
|
||||
@@ -798,7 +798,7 @@ bool FFmpegDecoder::ProxyVideo(const QAtomicInt *cancelled, int divider)
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
bool FFmpegDecoder::ConformAudio(const QAtomicInt *cancelled, const AudioRenderingParams &p)
|
||||
bool FFmpegDecoder::ConformAudio(const QAtomicInt *cancelled, const AudioParams &p)
|
||||
{
|
||||
// Iterate through each audio frame and extract the PCM data
|
||||
AudioStreamPtr audio_stream = std::static_pointer_cast<AudioStream>(stream());
|
||||
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
|
||||
virtual bool Open() override;
|
||||
virtual FramePtr RetrieveVideo(const rational &timecode, const int& divider, bool use_proxies) override;
|
||||
virtual SampleBufferPtr RetrieveAudio(const rational &timecode, const rational &length, const AudioRenderingParams& params) override;
|
||||
virtual SampleBufferPtr RetrieveAudio(const rational &timecode, const rational &length, const AudioParams& params) override;
|
||||
virtual void Close() override;
|
||||
|
||||
virtual QString id() override;
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
virtual bool SupportsAudio() override;
|
||||
|
||||
virtual bool ProxyVideo(const QAtomicInt* cancelled, int divider) override;
|
||||
virtual bool ConformAudio(const QAtomicInt* cancelled, const AudioRenderingParams& p) override;
|
||||
virtual bool ConformAudio(const QAtomicInt* cancelled, const AudioParams& p) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -170,7 +170,7 @@ fail:
|
||||
return success;
|
||||
}
|
||||
|
||||
void FFmpegEncoder::WriteAudio(AudioRenderingParams pcm_info, const QString &pcm_filename)
|
||||
void FFmpegEncoder::WriteAudio(AudioParams pcm_info, const QString &pcm_filename)
|
||||
{
|
||||
QFile pcm(pcm_filename);
|
||||
if (pcm.open(QFile::ReadOnly)) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
virtual bool WriteFrame(OLIVE_NAMESPACE::FramePtr frame, OLIVE_NAMESPACE::rational time) override;
|
||||
|
||||
virtual void WriteAudio(OLIVE_NAMESPACE::AudioRenderingParams pcm_info,
|
||||
virtual void WriteAudio(OLIVE_NAMESPACE::AudioParams pcm_info,
|
||||
const QString& pcm_filename) override;
|
||||
|
||||
virtual void Close() override;
|
||||
|
||||
+2
-2
@@ -37,12 +37,12 @@ FramePtr Frame::Create()
|
||||
return std::make_shared<Frame>();
|
||||
}
|
||||
|
||||
const VideoRenderingParams &Frame::video_params() const
|
||||
const VideoParams &Frame::video_params() const
|
||||
{
|
||||
return params_;
|
||||
}
|
||||
|
||||
void Frame::set_video_params(const VideoRenderingParams ¶ms)
|
||||
void Frame::set_video_params(const VideoParams ¶ms)
|
||||
{
|
||||
params_ = params;
|
||||
|
||||
|
||||
+3
-3
@@ -44,8 +44,8 @@ public:
|
||||
|
||||
static FramePtr Create();
|
||||
|
||||
const VideoRenderingParams& video_params() const;
|
||||
void set_video_params(const VideoRenderingParams& params);
|
||||
const VideoParams& video_params() const;
|
||||
void set_video_params(const VideoParams& params);
|
||||
|
||||
int linesize_pixels() const;
|
||||
int linesize_bytes() const;
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
int allocated_size() const;
|
||||
|
||||
private:
|
||||
VideoRenderingParams params_;
|
||||
VideoParams params_;
|
||||
|
||||
QByteArray data_;
|
||||
|
||||
|
||||
@@ -174,10 +174,10 @@ FramePtr OIIODecoder::RetrieveVideo(const rational &timecode, const int& divider
|
||||
|
||||
FramePtr frame = Frame::Create();
|
||||
|
||||
frame->set_video_params(VideoRenderingParams(buffer_->spec().width,
|
||||
buffer_->spec().height,
|
||||
pix_fmt_,
|
||||
divider));
|
||||
frame->set_video_params(VideoParams(buffer_->spec().width,
|
||||
buffer_->spec().height,
|
||||
pix_fmt_,
|
||||
divider));
|
||||
frame->allocate();
|
||||
|
||||
if (divider == 1) {
|
||||
|
||||
@@ -38,7 +38,7 @@ SampleBufferPtr SampleBuffer::Create()
|
||||
return std::make_shared<SampleBuffer>();
|
||||
}
|
||||
|
||||
SampleBufferPtr SampleBuffer::CreateAllocated(const AudioRenderingParams &audio_params, int samples_per_channel)
|
||||
SampleBufferPtr SampleBuffer::CreateAllocated(const AudioParams &audio_params, int samples_per_channel)
|
||||
{
|
||||
SampleBufferPtr buffer = Create();
|
||||
|
||||
@@ -49,7 +49,7 @@ SampleBufferPtr SampleBuffer::CreateAllocated(const AudioRenderingParams &audio_
|
||||
return buffer;
|
||||
}
|
||||
|
||||
SampleBufferPtr SampleBuffer::CreateFromPackedData(const AudioRenderingParams &audio_params, const QByteArray &bytes)
|
||||
SampleBufferPtr SampleBuffer::CreateFromPackedData(const AudioParams &audio_params, const QByteArray &bytes)
|
||||
{
|
||||
if (!audio_params.is_valid()) {
|
||||
qWarning() << "Tried to create from packed data with invalid parameters";
|
||||
@@ -73,12 +73,12 @@ SampleBufferPtr SampleBuffer::CreateFromPackedData(const AudioRenderingParams &a
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const AudioRenderingParams &SampleBuffer::audio_params() const
|
||||
const AudioParams &SampleBuffer::audio_params() const
|
||||
{
|
||||
return audio_params_;
|
||||
}
|
||||
|
||||
void SampleBuffer::set_audio_params(const AudioRenderingParams ¶ms)
|
||||
void SampleBuffer::set_audio_params(const AudioParams ¶ms)
|
||||
{
|
||||
if (data_) {
|
||||
qWarning() << "Tried to set parameters on allocated sample buffer";
|
||||
|
||||
@@ -46,13 +46,13 @@ public:
|
||||
virtual ~SampleBuffer();
|
||||
|
||||
static SampleBufferPtr Create();
|
||||
static SampleBufferPtr CreateAllocated(const AudioRenderingParams& audio_params, int samples_per_channel);
|
||||
static SampleBufferPtr CreateFromPackedData(const AudioRenderingParams& audio_params, const QByteArray& bytes);
|
||||
static SampleBufferPtr CreateAllocated(const AudioParams& audio_params, int samples_per_channel);
|
||||
static SampleBufferPtr CreateFromPackedData(const AudioParams& audio_params, const QByteArray& bytes);
|
||||
|
||||
DISABLE_COPY_MOVE(SampleBuffer)
|
||||
|
||||
const AudioRenderingParams& audio_params() const;
|
||||
void set_audio_params(const AudioRenderingParams& params);
|
||||
const AudioParams& audio_params() const;
|
||||
void set_audio_params(const AudioParams& params);
|
||||
|
||||
const int &sample_count() const;
|
||||
void set_sample_count(const int &sample_count);
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
|
||||
static void destroy_sample_buffer(float*** data, int nb_channels);
|
||||
|
||||
AudioRenderingParams audio_params_;
|
||||
AudioParams audio_params_;
|
||||
|
||||
int sample_count_per_channel_;
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ bool WaveInput::open()
|
||||
}
|
||||
|
||||
// We're good to go!
|
||||
params_ = AudioRenderingParams(sample_rate, channel_layout, format);
|
||||
params_ = AudioParams(sample_rate, channel_layout, format);
|
||||
|
||||
if (!find_str(&file_, "data")) {
|
||||
close();
|
||||
@@ -197,7 +197,7 @@ bool WaveInput::at_end() const
|
||||
return file_.pos() == (data_position_ + data_size_);
|
||||
}
|
||||
|
||||
const AudioRenderingParams &WaveInput::params() const
|
||||
const AudioParams &WaveInput::params() const
|
||||
{
|
||||
return params_;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
bool at_end() const;
|
||||
|
||||
const AudioRenderingParams& params() const;
|
||||
const AudioParams& params() const;
|
||||
|
||||
void close();
|
||||
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
|
||||
qint64 calculate_max_read() const;
|
||||
|
||||
AudioRenderingParams params_;
|
||||
AudioParams params_;
|
||||
|
||||
QFile file_;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ const int16_t kWAVIntegerFormat = 1;
|
||||
const int16_t kWAVFloatFormat = 3;
|
||||
|
||||
WaveOutput::WaveOutput(const QString &f,
|
||||
const AudioRenderingParams& params) :
|
||||
const AudioParams& params) :
|
||||
file_(f),
|
||||
params_(params)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ const int& WaveOutput::data_length() const
|
||||
return data_length_;
|
||||
}
|
||||
|
||||
const AudioRenderingParams &WaveOutput::params() const
|
||||
const AudioParams &WaveOutput::params() const
|
||||
{
|
||||
return params_;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class WaveOutput
|
||||
{
|
||||
public:
|
||||
WaveOutput(const QString& f,
|
||||
const AudioRenderingParams& params);
|
||||
const AudioParams& params);
|
||||
|
||||
~WaveOutput();
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
const int& data_length() const;
|
||||
|
||||
const AudioRenderingParams& params() const;
|
||||
const AudioParams& params() const;
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
|
||||
QFile file_;
|
||||
|
||||
AudioRenderingParams params_;
|
||||
AudioParams params_;
|
||||
|
||||
int data_length_;
|
||||
|
||||
|
||||
@@ -84,7 +84,9 @@ QString FileFunctions::GetConfigurationLocation()
|
||||
if (IsPortable()) {
|
||||
return GetApplicationPath();
|
||||
} else {
|
||||
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
||||
QString s = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
QDir(s).mkpath(".");
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,6 @@ void Config::SetDefaults()
|
||||
config_map_["AddDefaultEffectsToClips"] = true;
|
||||
config_map_["AutoscaleByDefault"] = false;
|
||||
config_map_["Autoscroll"] = AutoScroll::kPage;
|
||||
config_map_["DefaultViewerDivider"] = 2;
|
||||
config_map_["AutoSelectDivider"] = true;
|
||||
config_map_["SetNameWithMarker"] = false;
|
||||
config_map_["RectifiedWaveforms"] = false;
|
||||
@@ -110,6 +109,8 @@ void Config::SetDefaults()
|
||||
config_map_["DefaultSequenceFrameRate"] = QVariant::fromValue(rational(1001, 30000));
|
||||
config_map_["DefaultSequenceAudioFrequency"] = 48000;
|
||||
config_map_["DefaultSequenceAudioLayout"] = QVariant::fromValue(static_cast<uint64_t>(AV_CH_LAYOUT_STEREO));
|
||||
config_map_["DefaultSequencePreviewFormat"] = PixelFormat::PIX_FMT_RGBA16F;
|
||||
config_map_["DefaultSequencePreviewDivider"] = 3;
|
||||
|
||||
// Online/offline settings
|
||||
config_map_["OnlinePixelFormat"] = PixelFormat::PIX_FMT_RGBA32F;
|
||||
@@ -211,6 +212,7 @@ void Config::Save()
|
||||
}
|
||||
|
||||
QXmlStreamWriter writer(&config_file);
|
||||
writer.setAutoFormatting(true);
|
||||
|
||||
writer.writeStartDocument();
|
||||
|
||||
|
||||
+3
-13
@@ -546,7 +546,7 @@ void Core::DeclareTypesForQt()
|
||||
qRegisterMetaType<NodeValueDatabase>();
|
||||
qRegisterMetaType<FramePtr>();
|
||||
qRegisterMetaType<SampleBufferPtr>();
|
||||
qRegisterMetaType<AudioRenderingParams>();
|
||||
qRegisterMetaType<AudioParams>();
|
||||
qRegisterMetaType<NodeKeyframe::Type>();
|
||||
qRegisterMetaType<Decoder::RetrieveState>();
|
||||
qRegisterMetaType<OLIVE_NAMESPACE::TimeRange>();
|
||||
@@ -1121,19 +1121,9 @@ void Core::CacheActiveSequence(bool in_out_only)
|
||||
TimeBasedPanel* p = PanelManager::instance()->MostRecentlyFocused<TimeBasedPanel>();
|
||||
|
||||
if (p && p->GetConnectedViewer()) {
|
||||
// FIXME: Hardcoded divider...
|
||||
// FIXME: Consider preventing caching the footage viewer
|
||||
VideoRenderingParams vrp(p->GetConnectedViewer()->video_params(),
|
||||
PixelFormat::instance()->GetConfiguredFormatForMode(RenderMode::kOffline),
|
||||
RenderMode::kOffline,
|
||||
2);
|
||||
|
||||
AudioRenderingParams arp(p->GetConnectedViewer()->audio_params(),
|
||||
SampleFormat::kInternalFormat);
|
||||
|
||||
CacheTask* task = new CacheTask(p->GetConnectedViewer(),
|
||||
vrp,
|
||||
arp,
|
||||
p->GetConnectedViewer()->video_params(),
|
||||
p->GetConnectedViewer()->audio_params(),
|
||||
in_out_only);
|
||||
|
||||
// Stop any current auto-cache tasks
|
||||
|
||||
@@ -438,15 +438,15 @@ ExportParams ExportDialog::GenerateParams() const
|
||||
{
|
||||
RenderMode::Mode render_mode = RenderMode::kOnline;
|
||||
|
||||
VideoRenderingParams video_render_params(static_cast<int>(video_tab_->width_slider()->GetValue()),
|
||||
static_cast<int>(video_tab_->height_slider()->GetValue()),
|
||||
video_tab_->frame_rate().flipped(),
|
||||
PixelFormat::instance()->GetConfiguredFormatForMode(render_mode),
|
||||
render_mode);
|
||||
VideoParams video_render_params(static_cast<int>(video_tab_->width_slider()->GetValue()),
|
||||
static_cast<int>(video_tab_->height_slider()->GetValue()),
|
||||
video_tab_->frame_rate().flipped(),
|
||||
PixelFormat::instance()->GetConfiguredFormatForMode(render_mode),
|
||||
render_mode);
|
||||
|
||||
AudioRenderingParams audio_render_params(audio_tab_->sample_rate_combobox()->currentData().toInt(),
|
||||
audio_tab_->channel_layout_combobox()->currentData().toULongLong(),
|
||||
SampleFormat::kInternalFormat);
|
||||
AudioParams audio_render_params(audio_tab_->sample_rate_combobox()->currentData().toInt(),
|
||||
audio_tab_->channel_layout_combobox()->currentData().toULongLong(),
|
||||
SampleFormat::kInternalFormat);
|
||||
|
||||
ExportParams params;
|
||||
params.SetFilename(filename_edit_->text());
|
||||
|
||||
@@ -114,10 +114,13 @@ void SequenceDialog::accept()
|
||||
// Generate video and audio parameter structs from data
|
||||
VideoParams video_params = VideoParams(parameter_tab_->GetSelectedVideoWidth(),
|
||||
parameter_tab_->GetSelectedVideoHeight(),
|
||||
video_time_base);
|
||||
video_time_base,
|
||||
parameter_tab_->GetSelectedPreviewFormat(),
|
||||
parameter_tab_->GetSelectedPreviewResolution());
|
||||
|
||||
AudioParams audio_params = AudioParams(audio_sample_rate,
|
||||
channels);
|
||||
channels,
|
||||
SampleFormat::kInternalFormat);
|
||||
|
||||
if (make_undoable_) {
|
||||
|
||||
@@ -141,7 +144,7 @@ void SequenceDialog::accept()
|
||||
|
||||
SequenceDialog::SequenceParamCommand::SequenceParamCommand(Sequence* s,
|
||||
const VideoParams& video_params,
|
||||
const AudioParams& audio_params,
|
||||
const AudioParams &audio_params,
|
||||
const QString& name,
|
||||
QUndoCommand* parent) :
|
||||
UndoCommand(parent),
|
||||
|
||||
@@ -14,37 +14,63 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence* sequence, QWidg
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
int row = 0;
|
||||
|
||||
// Set up video section
|
||||
QGroupBox* video_group = new QGroupBox();
|
||||
video_group->setTitle(tr("Video"));
|
||||
QGridLayout* video_layout = new QGridLayout(video_group);
|
||||
video_layout->addWidget(new QLabel(tr("Width:")), 0, 0);
|
||||
video_width_field_ = new QSpinBox();
|
||||
video_width_field_->setMaximum(99999);
|
||||
video_layout->addWidget(video_width_field_, 0, 1);
|
||||
video_layout->addWidget(new QLabel(tr("Height:")), 1, 0);
|
||||
video_height_field_ = new QSpinBox();
|
||||
video_height_field_->setMaximum(99999);
|
||||
video_layout->addWidget(video_height_field_, 1, 1);
|
||||
video_layout->addWidget(new QLabel(tr("Frame Rate:")), 2, 0);
|
||||
video_layout->addWidget(new QLabel(tr("Width:")), row, 0);
|
||||
video_width_field_ = new IntegerSlider();
|
||||
video_width_field_->SetMinimum(1);
|
||||
video_width_field_->SetMaximum(99999);
|
||||
connect(video_width_field_, &IntegerSlider::ValueChanged, this, &SequenceDialogParameterTab::UpdatePreviewResolutionLabel);
|
||||
video_layout->addWidget(video_width_field_, row, 1);
|
||||
row++;
|
||||
video_layout->addWidget(new QLabel(tr("Height:")), row, 0);
|
||||
video_height_field_ = new IntegerSlider();
|
||||
video_height_field_->SetMinimum(1);
|
||||
video_height_field_->SetMaximum(99999);
|
||||
connect(video_height_field_, &IntegerSlider::ValueChanged, this, &SequenceDialogParameterTab::UpdatePreviewResolutionLabel);
|
||||
video_layout->addWidget(video_height_field_, row, 1);
|
||||
row++;
|
||||
video_layout->addWidget(new QLabel(tr("Frame Rate:")), row, 0);
|
||||
video_frame_rate_field_ = new QComboBox();
|
||||
video_layout->addWidget(video_frame_rate_field_, 2, 1);
|
||||
video_layout->addWidget(video_frame_rate_field_, row, 1);
|
||||
layout->addWidget(video_group);
|
||||
|
||||
row = 0;
|
||||
|
||||
// Set up audio section
|
||||
QGroupBox* audio_group = new QGroupBox();
|
||||
audio_group->setTitle(tr("Audio"));
|
||||
QGridLayout* audio_layout = new QGridLayout(audio_group);
|
||||
audio_layout->addWidget(new QLabel(tr("Sample Rate:")), 0, 0);
|
||||
audio_layout->addWidget(new QLabel(tr("Sample Rate:")), row, 0);
|
||||
audio_sample_rate_field_ = new QComboBox();
|
||||
// FIXME: No sample rate made
|
||||
audio_layout->addWidget(audio_sample_rate_field_, 0, 1);
|
||||
audio_layout->addWidget(new QLabel(tr("Channels:")), 1, 0);
|
||||
audio_layout->addWidget(audio_sample_rate_field_, row, 1);
|
||||
row++;
|
||||
audio_layout->addWidget(new QLabel(tr("Channels:")), row, 0);
|
||||
audio_channels_field_ = new QComboBox();
|
||||
// FIXME: No channels made
|
||||
audio_layout->addWidget(audio_channels_field_, 1, 1);
|
||||
audio_layout->addWidget(audio_channels_field_, row, 1);
|
||||
layout->addWidget(audio_group);
|
||||
|
||||
row = 0;
|
||||
|
||||
// Set up preview section
|
||||
QGroupBox* preview_group = new QGroupBox();
|
||||
preview_group->setTitle(tr("Preview"));
|
||||
QGridLayout* preview_layout = new QGridLayout(preview_group);
|
||||
preview_layout->addWidget(new QLabel(tr("Resolution:")), row, 0);
|
||||
preview_resolution_field_ = new QComboBox();
|
||||
preview_layout->addWidget(preview_resolution_field_, row, 1);
|
||||
preview_resolution_label_ = new QLabel();
|
||||
preview_layout->addWidget(preview_resolution_label_, row, 2);
|
||||
row++;
|
||||
preview_layout->addWidget(new QLabel(tr("Format:")), row, 0);
|
||||
preview_format_field_ = new QComboBox();
|
||||
preview_layout->addWidget(preview_format_field_, row, 1, 1, 2);
|
||||
layout->addWidget(preview_group);
|
||||
|
||||
// Set up available frame rates
|
||||
frame_rate_list_ = Core::SupportedFrameRates();
|
||||
foreach (const rational& fr, frame_rate_list_) {
|
||||
@@ -63,9 +89,38 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence* sequence, QWidg
|
||||
audio_channels_field_->addItem(Core::ChannelLayoutToString(ch_layout), QVariant::fromValue(ch_layout));
|
||||
}
|
||||
|
||||
// Set up preview dividers
|
||||
divider_list_ = {1, 2, 3, 4, 6, 8, 12, 16};
|
||||
foreach (int d, divider_list_) {
|
||||
QString name;
|
||||
|
||||
if (d == 1) {
|
||||
name = tr("Full");
|
||||
} else {
|
||||
name = tr("1/%1").arg(d);
|
||||
}
|
||||
|
||||
preview_resolution_field_->addItem(name);
|
||||
}
|
||||
connect(preview_resolution_field_, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &SequenceDialogParameterTab::UpdatePreviewResolutionLabel);
|
||||
|
||||
// Set up preview formats
|
||||
for (int i=0;i<PixelFormat::PIX_FMT_COUNT;i++) {
|
||||
PixelFormat::Format pix_fmt = static_cast<PixelFormat::Format>(i);
|
||||
|
||||
// We always render with an alpha channel internally
|
||||
if (PixelFormat::FormatHasAlphaChannel(pix_fmt)
|
||||
&& PixelFormat::FormatIsFloat(pix_fmt)) {
|
||||
preview_format_field_->addItem(PixelFormat::GetName(pix_fmt));
|
||||
|
||||
preview_format_list_.append(pix_fmt);
|
||||
}
|
||||
}
|
||||
|
||||
// Set values based on input sequence
|
||||
video_width_field_->setValue(sequence->video_params().width());
|
||||
video_height_field_->setValue(sequence->video_params().height());
|
||||
video_width_field_->SetValue(sequence->video_params().width());
|
||||
video_height_field_->SetValue(sequence->video_params().height());
|
||||
|
||||
int frame_rate_index = frame_rate_list_.indexOf(sequence->video_params().time_base().flipped());
|
||||
video_frame_rate_field_->setCurrentIndex(frame_rate_index);
|
||||
@@ -80,21 +135,27 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence* sequence, QWidg
|
||||
}
|
||||
}
|
||||
|
||||
preview_resolution_field_->setCurrentIndex(divider_list_.indexOf(sequence->video_params().divider()));
|
||||
|
||||
preview_format_field_->setCurrentIndex(preview_format_list_.indexOf(sequence->video_params().format()));
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
QPushButton* save_preset_btn = new QPushButton(tr("Save Preset"));
|
||||
connect(save_preset_btn, &QPushButton::clicked, this, &SequenceDialogParameterTab::SavePresetClicked);
|
||||
layout->addWidget(save_preset_btn);
|
||||
|
||||
UpdatePreviewResolutionLabel();
|
||||
}
|
||||
|
||||
int SequenceDialogParameterTab::GetSelectedVideoWidth() const
|
||||
{
|
||||
return video_width_field_->value();
|
||||
return video_width_field_->GetValue();
|
||||
}
|
||||
|
||||
int SequenceDialogParameterTab::GetSelectedVideoHeight() const
|
||||
{
|
||||
return video_height_field_->value();
|
||||
return video_height_field_->GetValue();
|
||||
}
|
||||
|
||||
const rational &SequenceDialogParameterTab::GetSelectedVideoFrameRate() const
|
||||
@@ -112,23 +173,48 @@ uint64_t SequenceDialogParameterTab::GetSelectedAudioChannelLayout() const
|
||||
return audio_channels_field_->currentData().toULongLong();
|
||||
}
|
||||
|
||||
int SequenceDialogParameterTab::GetSelectedPreviewResolution() const
|
||||
{
|
||||
return divider_list_.at(preview_resolution_field_->currentIndex());
|
||||
}
|
||||
|
||||
PixelFormat::Format SequenceDialogParameterTab::GetSelectedPreviewFormat() const
|
||||
{
|
||||
return preview_format_list_.at(preview_format_field_->currentIndex());
|
||||
}
|
||||
|
||||
void SequenceDialogParameterTab::PresetChanged(const SequencePreset &preset)
|
||||
{
|
||||
video_width_field_->setValue(preset.width);
|
||||
video_height_field_->setValue(preset.height);
|
||||
video_width_field_->SetValue(preset.width);
|
||||
video_height_field_->SetValue(preset.height);
|
||||
video_frame_rate_field_->setCurrentIndex(frame_rate_list_.indexOf(preset.frame_rate));
|
||||
audio_sample_rate_field_->setCurrentIndex(sample_rate_list_.indexOf(preset.sample_rate));
|
||||
audio_channels_field_->setCurrentIndex(channel_layout_list_.indexOf(preset.channel_layout));
|
||||
preview_resolution_field_->setCurrentIndex(divider_list_.indexOf(preset.preview_divider));
|
||||
preview_format_field_->setCurrentIndex(preview_format_list_.indexOf(preset.preview_format));
|
||||
}
|
||||
|
||||
void SequenceDialogParameterTab::SavePresetClicked()
|
||||
{
|
||||
emit SaveParametersAsPreset({QString(),
|
||||
video_width_field_->value(),
|
||||
video_height_field_->value(),
|
||||
static_cast<int>(video_width_field_->GetValue()),
|
||||
static_cast<int>(video_height_field_->GetValue()),
|
||||
frame_rate_list_.at(video_frame_rate_field_->currentIndex()),
|
||||
sample_rate_list_.at(audio_sample_rate_field_->currentIndex()),
|
||||
channel_layout_list_.at(audio_channels_field_->currentIndex())});
|
||||
channel_layout_list_.at(audio_channels_field_->currentIndex()),
|
||||
divider_list_.at(preview_resolution_field_->currentIndex()),
|
||||
preview_format_list_.at(preview_format_field_->currentIndex())});
|
||||
}
|
||||
|
||||
void SequenceDialogParameterTab::UpdatePreviewResolutionLabel()
|
||||
{
|
||||
VideoParams test_param(video_width_field_->GetValue(),
|
||||
video_height_field_->GetValue(),
|
||||
PixelFormat::PIX_FMT_INVALID,
|
||||
divider_list_.at(preview_resolution_field_->currentIndex()));
|
||||
|
||||
preview_resolution_label_->setText(tr("(%1x%2)").arg(QString::number(test_param.effective_width()),
|
||||
QString::number(test_param.effective_height())));
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "project/item/sequence/sequence.h"
|
||||
#include "sequencepreset.h"
|
||||
#include "widget/slider/integerslider.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -26,6 +27,10 @@ public:
|
||||
|
||||
uint64_t GetSelectedAudioChannelLayout() const;
|
||||
|
||||
int GetSelectedPreviewResolution() const;
|
||||
|
||||
PixelFormat::Format GetSelectedPreviewFormat() const;
|
||||
|
||||
public slots:
|
||||
void PresetChanged(const SequencePreset& preset);
|
||||
|
||||
@@ -33,9 +38,9 @@ signals:
|
||||
void SaveParametersAsPreset(const SequencePreset& preset);
|
||||
|
||||
private:
|
||||
QSpinBox* video_width_field_;
|
||||
IntegerSlider* video_width_field_;
|
||||
|
||||
QSpinBox* video_height_field_;
|
||||
IntegerSlider* video_height_field_;
|
||||
|
||||
QComboBox* video_frame_rate_field_;
|
||||
|
||||
@@ -43,15 +48,27 @@ private:
|
||||
|
||||
QComboBox* audio_channels_field_;
|
||||
|
||||
QComboBox* preview_resolution_field_;
|
||||
|
||||
QLabel* preview_resolution_label_;
|
||||
|
||||
QComboBox* preview_format_field_;
|
||||
|
||||
QList<rational> frame_rate_list_;
|
||||
|
||||
QList<int> sample_rate_list_;
|
||||
|
||||
QList<uint64_t> channel_layout_list_;
|
||||
|
||||
QList<int> divider_list_;
|
||||
|
||||
QList<PixelFormat::Format> preview_format_list_;
|
||||
|
||||
private slots:
|
||||
void SavePresetClicked();
|
||||
|
||||
void UpdatePreviewResolutionLabel();
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -40,12 +40,12 @@ SequenceDialogPresetTab::SequenceDialogPresetTab(QWidget* parent) :
|
||||
preset_tree_->addTopLevelItem(my_presets_folder_);
|
||||
|
||||
// Add presets
|
||||
preset_tree_->addTopLevelItem(CreateHDPresetFolder(tr("4K UHD"), 3840, 2160));
|
||||
preset_tree_->addTopLevelItem(CreateHDPresetFolder(tr("1080p"), 1920, 1080));
|
||||
preset_tree_->addTopLevelItem(CreateHDPresetFolder(tr("720p"), 1280, 720));
|
||||
preset_tree_->addTopLevelItem(CreateHDPresetFolder(tr("4K UHD"), 3840, 2160, 6));
|
||||
preset_tree_->addTopLevelItem(CreateHDPresetFolder(tr("1080p"), 1920, 1080, 3));
|
||||
preset_tree_->addTopLevelItem(CreateHDPresetFolder(tr("720p"), 1280, 720, 2));
|
||||
|
||||
preset_tree_->addTopLevelItem(CreateSDPresetFolder(tr("NTSC"), 720, 480, rational(30000, 1001)));
|
||||
preset_tree_->addTopLevelItem(CreateSDPresetFolder(tr("PAL"), 720, 576, rational(25, 1)));
|
||||
preset_tree_->addTopLevelItem(CreateSDPresetFolder(tr("NTSC"), 720, 480, rational(30000, 1001), 1));
|
||||
preset_tree_->addTopLevelItem(CreateSDPresetFolder(tr("PAL"), 720, 576, rational(25, 1), 1));
|
||||
|
||||
// Load custom presets
|
||||
QFile preset_file(GetCustomPresetFilename());
|
||||
@@ -71,6 +71,10 @@ SequenceDialogPresetTab::SequenceDialogPresetTab(QWidget* parent) :
|
||||
p.sample_rate = reader.readElementText().toInt();
|
||||
} else if (reader.name() == QStringLiteral("chlayout")) {
|
||||
p.channel_layout = reader.readElementText().toULongLong();
|
||||
} else if (reader.name() == QStringLiteral("divider")) {
|
||||
p.preview_divider = reader.readElementText().toInt();
|
||||
} else if (reader.name() == QStringLiteral("format")) {
|
||||
p.preview_format = static_cast<PixelFormat::Format>(reader.readElementText().toInt());
|
||||
} else {
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
@@ -111,6 +115,8 @@ SequenceDialogPresetTab::~SequenceDialogPresetTab()
|
||||
writer.writeTextElement(QStringLiteral("framerate"), p.frame_rate.toString());
|
||||
writer.writeTextElement(QStringLiteral("samplerate"), QString::number(p.sample_rate));
|
||||
writer.writeTextElement(QStringLiteral("chlayout"), QString::number(p.channel_layout));
|
||||
writer.writeTextElement(QStringLiteral("divider"), QString::number(p.preview_divider));
|
||||
writer.writeTextElement(QStringLiteral("format"), QString::number(p.preview_format));
|
||||
|
||||
writer.writeEndElement(); // preset
|
||||
}
|
||||
@@ -170,7 +176,7 @@ QTreeWidgetItem* SequenceDialogPresetTab::CreateFolder(const QString &name)
|
||||
return folder;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &name, int width, int height)
|
||||
QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &name, int width, int height, int divider)
|
||||
{
|
||||
QTreeWidgetItem* parent = CreateFolder(name);
|
||||
AddItem(parent, {tr("%1 23.976 FPS").arg(name),
|
||||
@@ -178,35 +184,45 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na
|
||||
height,
|
||||
rational(24000, 1001),
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO});
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F});
|
||||
AddItem(parent, {tr("%1 25 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(25, 1),
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO});
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F});
|
||||
AddItem(parent, {tr("%1 29.97 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(30000, 1001),
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO});
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F});
|
||||
AddItem(parent, {tr("%1 50 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(50, 1),
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO});
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F});
|
||||
AddItem(parent, {tr("%1 59.94 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(60000, 1001),
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO});
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F});
|
||||
return parent;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &name, int width, int height, const rational& frame_rate)
|
||||
QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &name, int width, int height, const rational& frame_rate, int divider)
|
||||
{
|
||||
QTreeWidgetItem* parent = CreateFolder(name);
|
||||
preset_tree_->addTopLevelItem(parent);
|
||||
@@ -215,13 +231,17 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &na
|
||||
height,
|
||||
frame_rate,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO});
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F});
|
||||
AddItem(parent, {tr("%1 Widescreen").arg(name),
|
||||
width,
|
||||
height,
|
||||
frame_rate,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO});
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F});
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ signals:
|
||||
private:
|
||||
QTreeWidgetItem *CreateFolder(const QString& name);
|
||||
|
||||
QTreeWidgetItem *CreateHDPresetFolder(const QString& name, int width, int height);
|
||||
QTreeWidgetItem *CreateHDPresetFolder(const QString& name, int width, int height, int divider);
|
||||
|
||||
QTreeWidgetItem *CreateSDPresetFolder(const QString& name, int width, int height, const rational &frame_rate);
|
||||
QTreeWidgetItem *CreateSDPresetFolder(const QString& name, int width, int height, const rational &frame_rate, int divider);
|
||||
|
||||
QString GetPresetName(QString start);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define SEQUENCEPARAM_H
|
||||
|
||||
#include "common/rational.h"
|
||||
#include "render/pixelformat.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -12,6 +13,8 @@ struct SequencePreset {
|
||||
rational frame_rate;
|
||||
int sample_rate;
|
||||
uint64_t channel_layout;
|
||||
int preview_divider;
|
||||
PixelFormat::Format preview_format;
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -69,7 +69,7 @@ NodeInput *PanNode::ProcessesSamplesFrom(const NodeValueDatabase &) const
|
||||
return samples_input_;
|
||||
}
|
||||
|
||||
void PanNode::ProcessSamples(const NodeValueDatabase &values, const AudioRenderingParams ¶ms, const SampleBufferPtr input, SampleBufferPtr output, int index) const
|
||||
void PanNode::ProcessSamples(const NodeValueDatabase &values, const AudioParams ¶ms, const SampleBufferPtr input, SampleBufferPtr output, int index) const
|
||||
{
|
||||
if (params.channel_count() != 2) {
|
||||
// This node currently only works for stereo audio
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
virtual Capabilities GetCapabilities(const NodeValueDatabase&) const override;
|
||||
virtual NodeInput* ProcessesSamplesFrom(const NodeValueDatabase &value) const override;
|
||||
virtual void ProcessSamples(const NodeValueDatabase& values, const AudioRenderingParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const override;
|
||||
virtual void ProcessSamples(const NodeValueDatabase& values, const AudioParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const override;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ NodeInput *VolumeNode::ProcessesSamplesFrom(const NodeValueDatabase &) const
|
||||
return samples_input_;
|
||||
}
|
||||
|
||||
void VolumeNode::ProcessSamples(const NodeValueDatabase &values, const AudioRenderingParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const
|
||||
void VolumeNode::ProcessSamples(const NodeValueDatabase &values, const AudioParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const
|
||||
{
|
||||
float volume_val = values[volume_input_].Get(NodeParam::kFloat).toFloat();
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
virtual Capabilities GetCapabilities(const NodeValueDatabase&) const override;
|
||||
virtual NodeInput* ProcessesSamplesFrom(const NodeValueDatabase &value) const override;
|
||||
virtual void ProcessSamples(const NodeValueDatabase& values, const AudioRenderingParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const override;
|
||||
virtual void ProcessSamples(const NodeValueDatabase& values, const AudioParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const override;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ NodeInput *MathNode::ProcessesSamplesFrom(const NodeValueDatabase &value) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void MathNode::ProcessSamples(const NodeValueDatabase &values, const AudioRenderingParams ¶ms, const SampleBufferPtr input, SampleBufferPtr output, int index) const
|
||||
void MathNode::ProcessSamples(const NodeValueDatabase &values, const AudioParams ¶ms, const SampleBufferPtr input, SampleBufferPtr output, int index) const
|
||||
{
|
||||
// This function is only used for sample+number pairing
|
||||
NodeInput* number_input = (ProcessesSamplesFrom(values) == param_a_in_) ? param_b_in_ : param_a_in_;
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
virtual NodeValueTable Value(NodeValueDatabase &value) const override;
|
||||
|
||||
virtual NodeInput* ProcessesSamplesFrom(const NodeValueDatabase &value) const override;
|
||||
virtual void ProcessSamples(const NodeValueDatabase &values, const AudioRenderingParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const override;
|
||||
virtual void ProcessSamples(const NodeValueDatabase &values, const AudioParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const override;
|
||||
|
||||
NodeInput* param_a_in() const;
|
||||
NodeInput* param_b_in() const;
|
||||
|
||||
+1
-1
@@ -492,7 +492,7 @@ NodeInput* Node::ProcessesSamplesFrom(const NodeValueDatabase &) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Node::ProcessSamples(const NodeValueDatabase &, const AudioRenderingParams&, const SampleBufferPtr, SampleBufferPtr, int) const
|
||||
void Node::ProcessSamples(const NodeValueDatabase &, const AudioParams&, const SampleBufferPtr, SampleBufferPtr, int) const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ public:
|
||||
/**
|
||||
* @brief If ProcessesSamples() is true, this is the function that will process them.
|
||||
*/
|
||||
virtual void ProcessSamples(const NodeValueDatabase &values, const AudioRenderingParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const;
|
||||
virtual void ProcessSamples(const NodeValueDatabase &values, const AudioParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const;
|
||||
|
||||
/**
|
||||
* @brief Returns the input with the specified ID (or nullptr if it doesn't exist)
|
||||
|
||||
@@ -76,8 +76,8 @@ public:
|
||||
return audio_params_;
|
||||
}
|
||||
|
||||
void set_video_params(const VideoParams& video);
|
||||
void set_audio_params(const AudioParams& audio);
|
||||
void set_video_params(const VideoParams &video);
|
||||
void set_audio_params(const AudioParams &audio);
|
||||
|
||||
rational GetLength();
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ void AudioStream::set_sample_rate(const int &sample_rate)
|
||||
sample_rate_ = sample_rate;
|
||||
}
|
||||
|
||||
bool AudioStream::try_start_conforming(const AudioRenderingParams ¶ms)
|
||||
bool AudioStream::try_start_conforming(const AudioParams ¶ms)
|
||||
{
|
||||
QMutexLocker locker(proxy_access_lock());
|
||||
|
||||
@@ -77,14 +77,14 @@ bool AudioStream::try_start_conforming(const AudioRenderingParams ¶ms)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AudioStream::has_conformed_version(const AudioRenderingParams ¶ms)
|
||||
bool AudioStream::has_conformed_version(const AudioParams ¶ms)
|
||||
{
|
||||
QMutexLocker locker(proxy_access_lock());
|
||||
|
||||
return conformed_.contains(params);
|
||||
}
|
||||
|
||||
void AudioStream::append_conformed_version(const AudioRenderingParams ¶ms)
|
||||
void AudioStream::append_conformed_version(const AudioParams ¶ms)
|
||||
{
|
||||
{
|
||||
QMutexLocker locker(proxy_access_lock());
|
||||
|
||||
@@ -49,21 +49,21 @@ public:
|
||||
const int& sample_rate() const;
|
||||
void set_sample_rate(const int& sample_rate);
|
||||
|
||||
bool try_start_conforming(const AudioRenderingParams& params);
|
||||
bool has_conformed_version(const AudioRenderingParams& params);
|
||||
void append_conformed_version(const AudioRenderingParams& params);
|
||||
bool try_start_conforming(const AudioParams& params);
|
||||
bool has_conformed_version(const AudioParams& params);
|
||||
void append_conformed_version(const AudioParams& params);
|
||||
|
||||
signals:
|
||||
void ConformAppended(OLIVE_NAMESPACE::AudioRenderingParams params);
|
||||
void ConformAppended(OLIVE_NAMESPACE::AudioParams params);
|
||||
|
||||
private:
|
||||
int channels_;
|
||||
uint64_t layout_;
|
||||
int sample_rate_;
|
||||
|
||||
QList<AudioRenderingParams> conformed_;
|
||||
QList<AudioParams> conformed_;
|
||||
|
||||
QList<AudioRenderingParams> currently_conforming_;
|
||||
QList<AudioParams> currently_conforming_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -64,8 +64,9 @@ void Sequence::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, const
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("video")) {
|
||||
int video_width, video_height;
|
||||
int video_width, video_height, preview_div;
|
||||
rational video_timebase;
|
||||
PixelFormat::Format preview_format;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (cancelled && *cancelled) {
|
||||
@@ -78,27 +79,34 @@ void Sequence::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, const
|
||||
video_height = reader->readElementText().toInt();
|
||||
} else if (reader->name() == QStringLiteral("timebase")) {
|
||||
video_timebase = rational::fromString(reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("divider")) {
|
||||
preview_div = reader->readElementText().toInt();
|
||||
} else if (reader->name() == QStringLiteral("format")) {
|
||||
preview_format = static_cast<PixelFormat::Format>(reader->readElementText().toInt());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
set_video_params(VideoParams(video_width, video_height, video_timebase));
|
||||
set_video_params(VideoParams(video_width, video_height, video_timebase, preview_format, preview_div));
|
||||
} else if (reader->name() == QStringLiteral("audio")) {
|
||||
int rate;
|
||||
uint64_t layout;
|
||||
SampleFormat::Format format;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("rate")) {
|
||||
rate = reader->readElementText().toInt();
|
||||
} else if (reader->name() == QStringLiteral("layout")) {
|
||||
layout = reader->readElementText().toULongLong();
|
||||
} else if (reader->name() == QStringLiteral("format")) {
|
||||
format = static_cast<SampleFormat::Format>(reader->readElementText().toInt());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
set_audio_params(AudioParams(rate, layout));
|
||||
set_audio_params(AudioParams(rate, layout, format));
|
||||
} else if (reader->name() == QStringLiteral("points")) {
|
||||
|
||||
TimelinePoints::Load(reader);
|
||||
@@ -148,6 +156,8 @@ void Sequence::Save(QXmlStreamWriter *writer) const
|
||||
writer->writeTextElement(QStringLiteral("width"), QString::number(video_params().width()));
|
||||
writer->writeTextElement(QStringLiteral("height"), QString::number(video_params().height()));
|
||||
writer->writeTextElement(QStringLiteral("timebase"), video_params().time_base().toString());
|
||||
writer->writeTextElement(QStringLiteral("divider"), QString::number(video_params().divider()));
|
||||
writer->writeTextElement(QStringLiteral("format"), QString::number(video_params().format()));
|
||||
|
||||
writer->writeEndElement(); // video
|
||||
|
||||
@@ -155,6 +165,7 @@ void Sequence::Save(QXmlStreamWriter *writer) const
|
||||
|
||||
writer->writeTextElement(QStringLiteral("rate"), QString::number(audio_params().sample_rate()));
|
||||
writer->writeTextElement(QStringLiteral("layout"), QString::number(audio_params().channel_layout()));
|
||||
writer->writeTextElement(QStringLiteral("format"), QString::number(audio_params().format()));
|
||||
|
||||
writer->writeEndElement(); // audio
|
||||
|
||||
@@ -228,10 +239,13 @@ void Sequence::set_audio_params(const AudioParams ¶ms)
|
||||
void Sequence::set_default_parameters()
|
||||
{
|
||||
set_video_params(VideoParams(Config::Current()["DefaultSequenceWidth"].toInt(),
|
||||
Config::Current()["DefaultSequenceHeight"].toInt(),
|
||||
Config::Current()["DefaultSequenceFrameRate"].value<rational>()));
|
||||
Config::Current()["DefaultSequenceHeight"].toInt(),
|
||||
Config::Current()["DefaultSequenceFrameRate"].value<rational>(),
|
||||
static_cast<PixelFormat::Format>(Config::Current()["DefaultSequencePreviewFormat"].toInt()),
|
||||
Config::Current()["DefaultSequencePreviewDivider"].toInt()));
|
||||
set_audio_params(AudioParams(Config::Current()["DefaultSequenceAudioFrequency"].toInt(),
|
||||
Config::Current()["DefaultSequenceAudioLayout"].toULongLong()));
|
||||
Config::Current()["DefaultSequenceAudioLayout"].toULongLong(),
|
||||
SampleFormat::kInternalFormat));
|
||||
}
|
||||
|
||||
void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
|
||||
@@ -248,7 +262,11 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
|
||||
|
||||
// If this is a video stream, use these parameters
|
||||
if (!found_video_params && !vs->frame_rate().isNull()) {
|
||||
set_video_params(VideoParams(vs->width(), vs->height(), vs->frame_rate().flipped()));
|
||||
set_video_params(VideoParams(vs->width(),
|
||||
vs->height(),
|
||||
vs->frame_rate().flipped(),
|
||||
static_cast<PixelFormat::Format>(Config::Current()["DefaultSequencePreviewFormat"].toInt()),
|
||||
Config::Current()["DefaultSequencePreviewDivider"].toInt()));
|
||||
found_video_params = true;
|
||||
}
|
||||
break;
|
||||
@@ -259,13 +277,17 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
|
||||
// something with a frame rate comes along which we'll prioritize
|
||||
ImageStream* is = static_cast<ImageStream*>(s.get());
|
||||
|
||||
set_video_params(VideoParams(is->width(), is->height(), video_params().time_base()));
|
||||
set_video_params(VideoParams(is->width(),
|
||||
is->height(),
|
||||
video_params().time_base(),
|
||||
static_cast<PixelFormat::Format>(Config::Current()["DefaultSequencePreviewFormat"].toInt()),
|
||||
Config::Current()["DefaultSequencePreviewDivider"].toInt()));
|
||||
}
|
||||
break;
|
||||
case Stream::kAudio:
|
||||
if (!found_audio_params) {
|
||||
AudioStream* as = static_cast<AudioStream*>(s.get());
|
||||
set_audio_params(AudioParams(as->sample_rate(), as->channel_layout()));
|
||||
set_audio_params(AudioParams(as->sample_rate(), as->channel_layout(), SampleFormat::kInternalFormat));
|
||||
found_audio_params = true;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -64,8 +64,8 @@ public:
|
||||
virtual QString duration() override;
|
||||
virtual QString rate() override;
|
||||
|
||||
const VideoParams& video_params() const;
|
||||
void set_video_params(const VideoParams& vparam);
|
||||
const VideoParams &video_params() const;
|
||||
void set_video_params(const VideoParams &vparam);
|
||||
|
||||
const AudioParams& audio_params() const;
|
||||
void set_audio_params(const AudioParams& params);
|
||||
|
||||
+15
-66
@@ -26,125 +26,74 @@ extern "C" {
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
AudioParams::AudioParams() :
|
||||
sample_rate_(0),
|
||||
channel_layout_(0)
|
||||
{
|
||||
}
|
||||
|
||||
AudioParams::AudioParams(const int &sample_rate, const uint64_t &channel_layout) :
|
||||
sample_rate_(sample_rate),
|
||||
channel_layout_(channel_layout)
|
||||
{
|
||||
}
|
||||
|
||||
const int &AudioParams::sample_rate() const
|
||||
{
|
||||
return sample_rate_;
|
||||
}
|
||||
|
||||
const uint64_t &AudioParams::channel_layout() const
|
||||
{
|
||||
return channel_layout_;
|
||||
}
|
||||
|
||||
rational AudioParams::time_base() const
|
||||
{
|
||||
return rational(1, sample_rate());
|
||||
}
|
||||
|
||||
AudioRenderingParams::AudioRenderingParams() :
|
||||
format_(SampleFormat::SAMPLE_FMT_INVALID)
|
||||
{
|
||||
}
|
||||
|
||||
AudioRenderingParams::AudioRenderingParams(const int &sample_rate, const uint64_t &channel_layout, const SampleFormat::Format &format) :
|
||||
AudioParams(sample_rate, channel_layout),
|
||||
format_(format)
|
||||
{
|
||||
}
|
||||
|
||||
AudioRenderingParams::AudioRenderingParams(const AudioParams ¶ms, const SampleFormat::Format &format) :
|
||||
AudioParams(params),
|
||||
format_(format)
|
||||
{
|
||||
}
|
||||
|
||||
int AudioRenderingParams::time_to_bytes(const double &time) const
|
||||
int AudioParams::time_to_bytes(const double &time) const
|
||||
{
|
||||
Q_ASSERT(is_valid());
|
||||
|
||||
return time_to_samples(time) * channel_count() * bytes_per_sample_per_channel();
|
||||
}
|
||||
|
||||
const SampleFormat::Format &AudioRenderingParams::format() const
|
||||
{
|
||||
return format_;
|
||||
}
|
||||
|
||||
bool AudioRenderingParams::operator==(const AudioRenderingParams &other) const
|
||||
bool AudioParams::operator==(const AudioParams &other) const
|
||||
{
|
||||
return (format() == other.format()
|
||||
&& sample_rate() == other.sample_rate()
|
||||
&& channel_layout() == other.channel_layout());
|
||||
}
|
||||
|
||||
bool AudioRenderingParams::operator!=(const AudioRenderingParams &other) const
|
||||
bool AudioParams::operator!=(const AudioParams &other) const
|
||||
{
|
||||
return (format() != other.format()
|
||||
|| sample_rate() != other.sample_rate()
|
||||
|| channel_layout() != other.channel_layout());
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
int AudioRenderingParams::time_to_bytes(const rational &time) const
|
||||
int AudioParams::time_to_bytes(const rational &time) const
|
||||
{
|
||||
return time_to_bytes(time.toDouble());
|
||||
}
|
||||
|
||||
int AudioRenderingParams::time_to_samples(const double &time) const
|
||||
int AudioParams::time_to_samples(const double &time) const
|
||||
{
|
||||
Q_ASSERT(is_valid());
|
||||
|
||||
return qFloor(time * sample_rate());
|
||||
}
|
||||
|
||||
int AudioRenderingParams::time_to_samples(const rational &time) const
|
||||
int AudioParams::time_to_samples(const rational &time) const
|
||||
{
|
||||
return time_to_samples(time.toDouble());
|
||||
}
|
||||
|
||||
int AudioRenderingParams::samples_to_bytes(const int &samples) const
|
||||
int AudioParams::samples_to_bytes(const int &samples) const
|
||||
{
|
||||
Q_ASSERT(is_valid());
|
||||
|
||||
return samples * channel_count() * bytes_per_sample_per_channel();
|
||||
}
|
||||
|
||||
rational AudioRenderingParams::samples_to_time(const int &samples) const
|
||||
rational AudioParams::samples_to_time(const int &samples) const
|
||||
{
|
||||
return rational(samples, sample_rate());
|
||||
}
|
||||
|
||||
int AudioRenderingParams::bytes_to_samples(const int &bytes) const
|
||||
int AudioParams::bytes_to_samples(const int &bytes) const
|
||||
{
|
||||
Q_ASSERT(is_valid());
|
||||
|
||||
return bytes / (channel_count() * bytes_per_sample_per_channel());
|
||||
}
|
||||
|
||||
rational AudioRenderingParams::bytes_to_time(const int &bytes) const
|
||||
rational AudioParams::bytes_to_time(const int &bytes) const
|
||||
{
|
||||
Q_ASSERT(is_valid());
|
||||
|
||||
return samples_to_time(bytes_to_samples(bytes));
|
||||
}
|
||||
|
||||
int AudioRenderingParams::channel_count() const
|
||||
int AudioParams::channel_count() const
|
||||
{
|
||||
return av_get_channel_layout_nb_channels(channel_layout());
|
||||
}
|
||||
|
||||
int AudioRenderingParams::bytes_per_sample_per_channel() const
|
||||
int AudioParams::bytes_per_sample_per_channel() const
|
||||
{
|
||||
switch (format_) {
|
||||
case SampleFormat::SAMPLE_FMT_U8:
|
||||
@@ -165,12 +114,12 @@ int AudioRenderingParams::bytes_per_sample_per_channel() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AudioRenderingParams::bits_per_sample() const
|
||||
int AudioParams::bits_per_sample() const
|
||||
{
|
||||
return bytes_per_sample_per_channel() * 8;
|
||||
}
|
||||
|
||||
bool AudioRenderingParams::is_valid() const
|
||||
bool AudioParams::is_valid() const
|
||||
{
|
||||
bool valid = (sample_rate() > 0
|
||||
&& channel_layout() > 0
|
||||
|
||||
+37
-21
@@ -28,28 +28,41 @@
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
class AudioParams
|
||||
{
|
||||
class AudioParams {
|
||||
public:
|
||||
AudioParams();
|
||||
AudioParams(const int& sample_rate, const uint64_t& channel_layout);
|
||||
AudioParams() :
|
||||
sample_rate_(0),
|
||||
channel_layout_(0),
|
||||
format_(SampleFormat::SAMPLE_FMT_INVALID)
|
||||
{
|
||||
}
|
||||
|
||||
const int& sample_rate() const;
|
||||
const uint64_t& channel_layout() const;
|
||||
rational time_base() const;
|
||||
AudioParams(const int& sample_rate, const uint64_t& channel_layout, const SampleFormat::Format& format) :
|
||||
sample_rate_(sample_rate),
|
||||
channel_layout_(channel_layout),
|
||||
format_(format)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
int sample_rate_;
|
||||
const int& sample_rate() const
|
||||
{
|
||||
return sample_rate_;
|
||||
}
|
||||
|
||||
uint64_t channel_layout_;
|
||||
const uint64_t& channel_layout() const
|
||||
{
|
||||
return channel_layout_;
|
||||
}
|
||||
|
||||
};
|
||||
rational time_base() const
|
||||
{
|
||||
return rational(1, sample_rate());
|
||||
}
|
||||
|
||||
class AudioRenderingParams : public AudioParams {
|
||||
public:
|
||||
AudioRenderingParams();
|
||||
AudioRenderingParams(const int& sample_rate, const uint64_t& channel_layout, const SampleFormat::Format& format);
|
||||
AudioRenderingParams(const AudioParams& params, const SampleFormat::Format& format);
|
||||
const SampleFormat::Format &format() const
|
||||
{
|
||||
return format_;
|
||||
}
|
||||
|
||||
int time_to_bytes(const double& time) const;
|
||||
int time_to_bytes(const rational& time) const;
|
||||
@@ -64,17 +77,20 @@ public:
|
||||
int bits_per_sample() const;
|
||||
bool is_valid() const;
|
||||
|
||||
const SampleFormat::Format &format() const;
|
||||
|
||||
bool operator==(const AudioRenderingParams& other) const;
|
||||
bool operator!=(const AudioRenderingParams& other) const;
|
||||
bool operator==(const AudioParams& other) const;
|
||||
bool operator!=(const AudioParams& other) const;
|
||||
|
||||
private:
|
||||
int sample_rate_;
|
||||
|
||||
uint64_t channel_layout_;
|
||||
|
||||
SampleFormat::Format format_;
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
Q_DECLARE_METATYPE(OLIVE_NAMESPACE::AudioRenderingParams)
|
||||
Q_DECLARE_METATYPE(OLIVE_NAMESPACE::AudioParams)
|
||||
|
||||
#endif // AUDIOPARAMS_H
|
||||
|
||||
@@ -34,7 +34,7 @@ AudioPlaybackCache::AudioPlaybackCache()
|
||||
UpdateFilename(QString::number(r));
|
||||
}
|
||||
|
||||
void AudioPlaybackCache::SetParameters(const AudioRenderingParams ¶ms)
|
||||
void AudioPlaybackCache::SetParameters(const AudioParams ¶ms)
|
||||
{
|
||||
QMutexLocker locker(lock());
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ class AudioPlaybackCache : public PlaybackCache
|
||||
public:
|
||||
AudioPlaybackCache();
|
||||
|
||||
AudioRenderingParams GetParameters() {
|
||||
AudioParams GetParameters() {
|
||||
QMutexLocker locker(lock());
|
||||
return params_;
|
||||
}
|
||||
|
||||
void SetParameters(const AudioRenderingParams& params);
|
||||
void SetParameters(const AudioParams& params);
|
||||
|
||||
void WritePCM(const TimeRange &range, SampleBufferPtr samples, const qint64& job_time);
|
||||
|
||||
@@ -70,7 +70,7 @@ private:
|
||||
|
||||
QString filename_;
|
||||
|
||||
AudioRenderingParams params_;
|
||||
AudioParams params_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ bool OpenGLProxy::Init()
|
||||
return true;
|
||||
}
|
||||
|
||||
NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const VideoRenderingParams& params)
|
||||
NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const VideoParams& params, const RenderMode::Mode& mode)
|
||||
{
|
||||
ImageStreamPtr video_stream = std::static_pointer_cast<ImageStream>(stream);
|
||||
|
||||
@@ -83,7 +83,7 @@ NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const Vide
|
||||
color_cache_.insert(colorspace_match, color_processor);
|
||||
}
|
||||
|
||||
ColorManager::OCIOMethod ocio_method = ColorManager::GetOCIOMethodForMode(params.mode());
|
||||
ColorManager::OCIOMethod ocio_method = ColorManager::GetOCIOMethodForMode(mode);
|
||||
|
||||
// OCIO's CPU conversion is more accurate, so for online we render on CPU but offline we render GPU
|
||||
if (ocio_method == ColorManager::kOCIOAccurate) {
|
||||
@@ -120,7 +120,7 @@ NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const Vide
|
||||
color_processor->Enable(ctx_, video_stream->premultiplied_alpha());
|
||||
}
|
||||
|
||||
VideoRenderingParams frame_params = frame->video_params();
|
||||
VideoParams frame_params = frame->video_params();
|
||||
|
||||
// Check frame aspect ratio
|
||||
if (frame->sample_aspect_ratio() != 1 && frame->sample_aspect_ratio() != 0) {
|
||||
@@ -136,16 +136,16 @@ NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const Vide
|
||||
new_height = qRound(static_cast<double>(new_height) / frame->sample_aspect_ratio().toDouble());
|
||||
}
|
||||
|
||||
frame_params = VideoRenderingParams(new_width,
|
||||
new_height,
|
||||
frame_params.format(),
|
||||
frame_params.divider());
|
||||
frame_params = VideoParams(new_width,
|
||||
new_height,
|
||||
frame_params.format(),
|
||||
frame_params.divider());
|
||||
}
|
||||
|
||||
VideoRenderingParams dest_params(frame_params.width(),
|
||||
frame_params.height(),
|
||||
params.format(),
|
||||
frame_params.divider());
|
||||
VideoParams dest_params(frame_params.width(),
|
||||
frame_params.height(),
|
||||
params.format(),
|
||||
frame_params.divider());
|
||||
|
||||
// Create destination texture
|
||||
OpenGLTextureCache::ReferencePtr associated_tex_ref = texture_cache_.Get(ctx_, dest_params);
|
||||
@@ -184,7 +184,7 @@ void OpenGLProxy::RunNodeAccelerated(const Node *node,
|
||||
const TimeRange &range,
|
||||
NodeValueDatabase &input_params,
|
||||
NodeValueTable &output_params,
|
||||
const VideoRenderingParams& params)
|
||||
const VideoParams& params)
|
||||
{
|
||||
OpenGLShaderPtr shader = shader_cache_.value(node->ShaderID(input_params));
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public slots:
|
||||
const OLIVE_NAMESPACE::TimeRange &range,
|
||||
OLIVE_NAMESPACE::NodeValueDatabase &input_params,
|
||||
OLIVE_NAMESPACE::NodeValueTable& output_params,
|
||||
const OLIVE_NAMESPACE::VideoRenderingParams ¶ms);
|
||||
const OLIVE_NAMESPACE::VideoParams ¶ms);
|
||||
|
||||
void TextureToBuffer(const QVariant& texture,
|
||||
OLIVE_NAMESPACE::FramePtr frame,
|
||||
@@ -79,7 +79,8 @@ public slots:
|
||||
|
||||
OLIVE_NAMESPACE::NodeValue FrameToValue(OLIVE_NAMESPACE::FramePtr frame,
|
||||
OLIVE_NAMESPACE::StreamPtr stream,
|
||||
const OLIVE_NAMESPACE::VideoRenderingParams ¶ms);
|
||||
const OLIVE_NAMESPACE::VideoParams ¶ms,
|
||||
const OLIVE_NAMESPACE::RenderMode::Mode &mode);
|
||||
|
||||
private:
|
||||
QOpenGLContext* ctx_;
|
||||
|
||||
@@ -45,7 +45,7 @@ bool OpenGLTexture::IsCreated() const
|
||||
return (texture_);
|
||||
}
|
||||
|
||||
void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoRenderingParams ¶ms, const void* data, int linesize)
|
||||
void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoParams ¶ms, const void* data, int linesize)
|
||||
{
|
||||
if (!ctx) {
|
||||
qWarning() << "OpenGLTexture::Create was passed an invalid context";
|
||||
@@ -63,7 +63,7 @@ void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoRenderingParams ¶
|
||||
CreateInternal(created_ctx_, &texture_, data, linesize);
|
||||
}
|
||||
|
||||
void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoRenderingParams ¶ms)
|
||||
void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoParams ¶ms)
|
||||
{
|
||||
Create(ctx, params, nullptr, 0);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
|
||||
DISABLE_COPY_MOVE(OpenGLTexture)
|
||||
|
||||
void Create(QOpenGLContext* ctx, const VideoRenderingParams& params, const void *data, int linesize);
|
||||
void Create(QOpenGLContext* ctx, const VideoRenderingParams& params);
|
||||
void Create(QOpenGLContext* ctx, const VideoParams& params, const void *data, int linesize);
|
||||
void Create(QOpenGLContext* ctx, const VideoParams& params);
|
||||
void Create(QOpenGLContext* ctx, FramePtr frame);
|
||||
void Create(QOpenGLContext* ctx, Frame* frame);
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
|
||||
GLuint texture_;
|
||||
|
||||
VideoRenderingParams params_;
|
||||
VideoParams params_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext *ctx, Fr
|
||||
return Get(ctx, frame->video_params(), frame->data(), frame->linesize_pixels());
|
||||
}
|
||||
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, const VideoRenderingParams ¶ms, const void *data, int linesize)
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, const VideoParams ¶ms, const void *data, int linesize)
|
||||
{
|
||||
OpenGLTexturePtr texture = nullptr;
|
||||
|
||||
@@ -76,7 +76,7 @@ OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, co
|
||||
return ref;
|
||||
}
|
||||
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext *ctx, const VideoRenderingParams ¶ms)
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext *ctx, const VideoParams ¶ms)
|
||||
{
|
||||
return Get(ctx, params, nullptr, 0);
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ public:
|
||||
|
||||
ReferencePtr Get(QOpenGLContext *ctx, FramePtr frame);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, Frame* frame);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params, const void *data, int linesize);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoParams& params, const void *data, int linesize);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoParams& params);
|
||||
|
||||
private:
|
||||
void Relinquish(Reference* ref);
|
||||
|
||||
@@ -42,7 +42,7 @@ NodeValue OpenGLWorker::FrameToTexture(DecoderPtr decoder, StreamPtr stream, con
|
||||
{
|
||||
FramePtr frame = decoder->RetrieveVideo(range.in(),
|
||||
video_params().divider(),
|
||||
video_params().mode() == RenderMode::kOffline);
|
||||
render_mode() == RenderMode::kOffline);
|
||||
|
||||
NodeValue value;
|
||||
|
||||
@@ -53,7 +53,8 @@ NodeValue OpenGLWorker::FrameToTexture(DecoderPtr decoder, StreamPtr stream, con
|
||||
OLIVE_NS_RETURN_ARG(NodeValue, value),
|
||||
OLIVE_NS_ARG(FramePtr, frame),
|
||||
OLIVE_NS_ARG(StreamPtr, stream),
|
||||
OLIVE_NS_CONST_ARG(VideoRenderingParams&, video_params()));
|
||||
OLIVE_NS_CONST_ARG(VideoParams&, video_params()),
|
||||
OLIVE_NS_CONST_ARG(RenderMode::Mode&, render_mode()));
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -71,7 +72,7 @@ void OpenGLWorker::ProcessNodeEvent(const Node *node, const TimeRange &range, No
|
||||
OLIVE_NS_CONST_ARG(TimeRange&, range),
|
||||
OLIVE_NS_ARG(NodeValueDatabase&, input_params),
|
||||
OLIVE_NS_ARG(NodeValueTable&, output_params),
|
||||
OLIVE_NS_CONST_ARG(VideoRenderingParams&, video_params()));
|
||||
OLIVE_NS_CONST_ARG(VideoParams&, video_params()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ RenderBackend::RenderBackend(QObject *parent) :
|
||||
QObject(parent),
|
||||
viewer_node_(nullptr),
|
||||
update_with_graph_(false),
|
||||
preview_job_time_(0)
|
||||
preview_job_time_(0),
|
||||
render_mode_(RenderMode::kOnline)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ QFuture<QList<QByteArray> > RenderBackend::Hash(const QList<rational> ×)
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.effective_width()), sizeof(int));
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.effective_height()), sizeof(int));
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.format()), sizeof(PixelFormat::Format));
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.mode()), sizeof(RenderMode::Mode));
|
||||
hasher.addData(reinterpret_cast<const char*>(&render_mode_), sizeof(RenderMode::Mode));
|
||||
|
||||
copied_viewer_node_->Hash(hasher, t);
|
||||
|
||||
@@ -167,12 +168,12 @@ RenderTicketPtr RenderBackend::RenderAudio(const TimeRange &r)
|
||||
return ticket;
|
||||
}
|
||||
|
||||
void RenderBackend::SetVideoParams(const VideoRenderingParams ¶ms)
|
||||
void RenderBackend::SetVideoParams(const VideoParams ¶ms)
|
||||
{
|
||||
video_params_ = params;
|
||||
}
|
||||
|
||||
void RenderBackend::SetAudioParams(const AudioRenderingParams ¶ms)
|
||||
void RenderBackend::SetAudioParams(const AudioParams ¶ms)
|
||||
{
|
||||
audio_params_ = params;
|
||||
}
|
||||
@@ -297,6 +298,7 @@ void RenderBackend::RunNextJob()
|
||||
worker->SetVideoParams(video_params_);
|
||||
worker->SetAudioParams(audio_params_);
|
||||
worker->SetVideoDownloadMatrix(video_download_matrix_);
|
||||
worker->SetRenderMode(render_mode_);
|
||||
if (preview_job_time_) {
|
||||
worker->EnablePreviewGeneration(viewer_node_->audio_playback_cache(), preview_job_time_);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ public:
|
||||
update_with_graph_ = e;
|
||||
}
|
||||
|
||||
void SetRenderMode(RenderMode::Mode e)
|
||||
{
|
||||
render_mode_ = e;
|
||||
}
|
||||
|
||||
void EnablePreviewGeneration(qint64 job_time)
|
||||
{
|
||||
preview_job_time_ = job_time;
|
||||
@@ -72,9 +77,9 @@ public:
|
||||
*/
|
||||
RenderTicketPtr RenderAudio(const TimeRange& r);
|
||||
|
||||
void SetVideoParams(const VideoRenderingParams& params);
|
||||
void SetVideoParams(const VideoParams& params);
|
||||
|
||||
void SetAudioParams(const AudioRenderingParams& params);
|
||||
void SetAudioParams(const AudioParams& params);
|
||||
|
||||
void SetVideoDownloadMatrix(const QMatrix4x4& mat);
|
||||
|
||||
@@ -98,11 +103,11 @@ private:
|
||||
ViewerOutput* viewer_node_;
|
||||
|
||||
// VIDEO MEMBERS
|
||||
VideoRenderingParams video_params_;
|
||||
VideoParams video_params_;
|
||||
QMatrix4x4 video_download_matrix_;
|
||||
|
||||
// AUDIO MEMBERS
|
||||
AudioRenderingParams audio_params_;
|
||||
AudioParams audio_params_;
|
||||
|
||||
QList<NodeInput*> graph_update_queue_;
|
||||
QHash<Node*, Node*> copy_map_;
|
||||
@@ -123,6 +128,8 @@ private:
|
||||
|
||||
qint64 preview_job_time_;
|
||||
|
||||
RenderMode::Mode render_mode_;
|
||||
|
||||
private slots:
|
||||
void WorkerFinished();
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ RenderWorker::RenderWorker(RenderBackend* parent) :
|
||||
parent_(parent),
|
||||
available_(true),
|
||||
audio_mode_is_preview_(false),
|
||||
preview_cache_(nullptr)
|
||||
preview_cache_(nullptr),
|
||||
render_mode_(RenderMode::kOnline)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,12 @@ public:
|
||||
available_ = a;
|
||||
}
|
||||
|
||||
void SetVideoParams(const VideoRenderingParams& params)
|
||||
void SetVideoParams(const VideoParams& params)
|
||||
{
|
||||
video_params_ = params;
|
||||
}
|
||||
|
||||
void SetAudioParams(const AudioRenderingParams& params)
|
||||
void SetAudioParams(const AudioParams& params)
|
||||
{
|
||||
audio_params_ = params;
|
||||
}
|
||||
@@ -73,6 +73,11 @@ public:
|
||||
copy_map_ = copy_map;
|
||||
}
|
||||
|
||||
void SetRenderMode(const RenderMode::Mode& mode)
|
||||
{
|
||||
render_mode_ = mode;
|
||||
}
|
||||
|
||||
void EnablePreviewGeneration(AudioPlaybackCache* cache, qint64 job_time)
|
||||
{
|
||||
preview_cache_ = cache;
|
||||
@@ -117,19 +122,24 @@ protected:
|
||||
|
||||
virtual void ProcessNodeEvent(const Node *node, const TimeRange &range, NodeValueDatabase &input_params_in, NodeValueTable &output_params) override;
|
||||
|
||||
const VideoRenderingParams& video_params() const
|
||||
const VideoParams& video_params() const
|
||||
{
|
||||
return video_params_;
|
||||
}
|
||||
|
||||
const AudioRenderingParams& audio_params() const
|
||||
const AudioParams& audio_params() const
|
||||
{
|
||||
return audio_params_;
|
||||
}
|
||||
|
||||
const RenderMode::Mode& render_mode() const
|
||||
{
|
||||
return render_mode_;
|
||||
}
|
||||
|
||||
signals:
|
||||
void AudioConformUnavailable(StreamPtr stream, TimeRange range,
|
||||
rational stream_time, AudioRenderingParams params);
|
||||
rational stream_time, AudioParams params);
|
||||
|
||||
void FinishedJob();
|
||||
|
||||
@@ -142,9 +152,9 @@ private:
|
||||
|
||||
RenderBackend* parent_;
|
||||
|
||||
VideoRenderingParams video_params_;
|
||||
VideoParams video_params_;
|
||||
|
||||
AudioRenderingParams audio_params_;
|
||||
AudioParams audio_params_;
|
||||
|
||||
struct CachedStill {
|
||||
NodeValue texture;
|
||||
@@ -170,6 +180,8 @@ private:
|
||||
|
||||
QHash<Node*, Node*>* copy_map_;
|
||||
|
||||
RenderMode::Mode render_mode_;
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -190,7 +190,7 @@ QList<rational> FrameHashCache::GetInvalidatedFrames()
|
||||
|
||||
void FrameHashCache::SaveCacheFrame(const QByteArray& hash,
|
||||
char* data,
|
||||
const VideoRenderingParams& vparam)
|
||||
const VideoParams& vparam)
|
||||
{
|
||||
QString fn = CachePathName(hash, vparam.format());
|
||||
|
||||
@@ -286,7 +286,7 @@ QString FrameHashCache::CachePathName(const QByteArray& hash, const PixelFormat:
|
||||
return cache_dir.filePath(filename);
|
||||
}
|
||||
|
||||
bool FrameHashCache::SaveCacheFrame(const QString &filename, char *data, const VideoRenderingParams &vparam)
|
||||
bool FrameHashCache::SaveCacheFrame(const QString &filename, char *data, const VideoParams &vparam)
|
||||
{
|
||||
switch (vparam.format()) {
|
||||
case PixelFormat::PIX_FMT_RGB8:
|
||||
|
||||
@@ -60,8 +60,8 @@ public:
|
||||
*/
|
||||
static QString CachePathName(const QByteArray &hash, const PixelFormat::Format& pix_fmt);
|
||||
|
||||
static bool SaveCacheFrame(const QString& filename, char *data, const VideoRenderingParams &vparam);
|
||||
static void SaveCacheFrame(const QByteArray& hash, char *data, const VideoRenderingParams &vparam);
|
||||
static bool SaveCacheFrame(const QString& filename, char *data, const VideoParams &vparam);
|
||||
static void SaveCacheFrame(const QByteArray& hash, char *data, const VideoParams &vparam);
|
||||
static void SaveCacheFrame(const QByteArray& hash, FramePtr frame);
|
||||
|
||||
static QString GetFormatExtension(const PixelFormat::Format& f);
|
||||
|
||||
@@ -216,7 +216,7 @@ FramePtr PixelFormat::ConvertPixelFormat(FramePtr frame, const PixelFormat::Form
|
||||
|
||||
// Create a destination frame with the same parameters
|
||||
FramePtr converted = Frame::Create();
|
||||
converted->set_video_params(VideoRenderingParams(frame->video_params().width(),
|
||||
converted->set_video_params(VideoParams(frame->video_params().width(),
|
||||
frame->video_params().height(),
|
||||
dest_format));
|
||||
converted->set_timestamp(frame->timestamp());
|
||||
|
||||
+17
-81
@@ -20,120 +20,56 @@
|
||||
|
||||
#include "videoparams.h"
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
VideoParams::VideoParams() :
|
||||
width_(0),
|
||||
height_(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VideoParams::VideoParams(const int &width, const int &height, const rational &time_base) :
|
||||
width_(width),
|
||||
height_(height),
|
||||
time_base_(time_base)
|
||||
{
|
||||
}
|
||||
|
||||
const int &VideoParams::width() const
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
|
||||
const int &VideoParams::height() const
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
|
||||
const rational &VideoParams::time_base() const
|
||||
{
|
||||
return time_base_;
|
||||
}
|
||||
|
||||
VideoRenderingParams::VideoRenderingParams() :
|
||||
format_(PixelFormat::PIX_FMT_INVALID)
|
||||
{
|
||||
}
|
||||
|
||||
VideoRenderingParams::VideoRenderingParams(const int &width, const int &height, const PixelFormat::Format &format, const int& divider) :
|
||||
VideoParams(width, height, rational()),
|
||||
VideoParams::VideoParams(const int &width, const int &height, const PixelFormat::Format &format, const int& divider) :
|
||||
width_(width),
|
||||
height_(height),
|
||||
format_(format),
|
||||
divider_(divider)
|
||||
{
|
||||
calculate_effective_size();
|
||||
}
|
||||
|
||||
VideoRenderingParams::VideoRenderingParams(const int &width, const int &height, const rational &time_base, const PixelFormat::Format &format, const RenderMode::Mode& mode, const int ÷r) :
|
||||
VideoParams(width, height, time_base),
|
||||
VideoParams::VideoParams(const int &width, const int &height, const rational &time_base, const PixelFormat::Format &format, const int ÷r) :
|
||||
width_(width),
|
||||
height_(height),
|
||||
time_base_(time_base),
|
||||
format_(format),
|
||||
mode_(mode),
|
||||
divider_(divider)
|
||||
{
|
||||
calculate_effective_size();
|
||||
}
|
||||
|
||||
VideoRenderingParams::VideoRenderingParams(const VideoParams ¶ms, const PixelFormat::Format &format, const RenderMode::Mode& mode, const int& divider) :
|
||||
VideoParams(params),
|
||||
format_(format),
|
||||
mode_(mode),
|
||||
divider_(divider)
|
||||
{
|
||||
calculate_effective_size();
|
||||
}
|
||||
|
||||
const int &VideoRenderingParams::divider() const
|
||||
{
|
||||
return divider_;
|
||||
}
|
||||
|
||||
const int& VideoRenderingParams::effective_width() const
|
||||
{
|
||||
return effective_width_;
|
||||
}
|
||||
|
||||
const int& VideoRenderingParams::effective_height() const
|
||||
{
|
||||
return effective_height_;
|
||||
}
|
||||
|
||||
const PixelFormat::Format &VideoRenderingParams::format() const
|
||||
{
|
||||
return format_;
|
||||
}
|
||||
|
||||
const RenderMode::Mode &VideoRenderingParams::mode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
bool VideoRenderingParams::operator==(const VideoRenderingParams &rhs) const
|
||||
bool VideoParams::operator==(const VideoParams &rhs) const
|
||||
{
|
||||
return width() == rhs.width()
|
||||
&& height() == rhs.height()
|
||||
&& time_base() == rhs.time_base()
|
||||
&& format() == rhs.format()
|
||||
&& mode() == rhs.mode()
|
||||
&& divider() == rhs.divider();
|
||||
}
|
||||
|
||||
bool VideoRenderingParams::operator!=(const VideoRenderingParams &rhs) const
|
||||
bool VideoParams::operator!=(const VideoParams &rhs) const
|
||||
{
|
||||
return width() != rhs.width()
|
||||
|| height() != rhs.height()
|
||||
|| time_base() != rhs.time_base()
|
||||
|| format() != rhs.format()
|
||||
|| mode() != rhs.mode()
|
||||
|| divider() != rhs.divider();
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
void VideoRenderingParams::calculate_effective_size()
|
||||
void VideoParams::calculate_effective_size()
|
||||
{
|
||||
effective_width_ = width() / divider_;
|
||||
effective_height_ = height() / divider_;
|
||||
// Fast rounding up to an even number
|
||||
effective_width_ = qCeil(width() / divider_ * 0.5) * 2;
|
||||
effective_height_ = qCeil(height() / divider_ * 0.5) * 2;
|
||||
}
|
||||
|
||||
bool VideoRenderingParams::is_valid() const
|
||||
bool VideoParams::is_valid() const
|
||||
{
|
||||
return (width() > 0
|
||||
&& height() > 0
|
||||
|
||||
+39
-25
@@ -27,46 +27,60 @@
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
class VideoParams
|
||||
{
|
||||
class VideoParams {
|
||||
public:
|
||||
VideoParams();
|
||||
VideoParams(const int& width, const int& height, const rational& time_base);
|
||||
VideoParams(const int& width, const int& height, const PixelFormat::Format& format, const int& divider = 1);
|
||||
VideoParams(const int& width, const int& height, const rational& time_base, const PixelFormat::Format& format, const int& divider = 1);
|
||||
|
||||
const int& width() const;
|
||||
const int& height() const;
|
||||
const rational& time_base() const;
|
||||
const int& width() const
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
|
||||
private:
|
||||
int width_;
|
||||
int height_;
|
||||
rational time_base_;
|
||||
const int& height() const
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
|
||||
};
|
||||
const rational& time_base() const
|
||||
{
|
||||
return time_base_;
|
||||
}
|
||||
|
||||
class VideoRenderingParams : public VideoParams {
|
||||
public:
|
||||
VideoRenderingParams();
|
||||
VideoRenderingParams(const int& width, const int& height, const PixelFormat::Format& format, const int& divider = 1);
|
||||
VideoRenderingParams(const int& width, const int& height, const rational& time_base, const PixelFormat::Format& format, const RenderMode::Mode& mode, const int& divider = 1);
|
||||
VideoRenderingParams(const VideoParams& params, const PixelFormat::Format& format, const RenderMode::Mode& mode, const int& divider = 1);
|
||||
const int& divider() const
|
||||
{
|
||||
return divider_;
|
||||
}
|
||||
|
||||
const int& divider() const;
|
||||
const int& effective_width() const;
|
||||
const int& effective_height() const;
|
||||
const int& effective_width() const
|
||||
{
|
||||
return effective_width_;
|
||||
}
|
||||
|
||||
const int& effective_height() const
|
||||
{
|
||||
return effective_height_;
|
||||
}
|
||||
|
||||
const PixelFormat::Format& format() const
|
||||
{
|
||||
return format_;
|
||||
}
|
||||
|
||||
bool is_valid() const;
|
||||
const PixelFormat::Format& format() const;
|
||||
const RenderMode::Mode& mode() const;
|
||||
|
||||
bool operator==(const VideoRenderingParams& rhs) const;
|
||||
bool operator!=(const VideoRenderingParams& rhs) const;
|
||||
bool operator==(const VideoParams& rhs) const;
|
||||
bool operator!=(const VideoParams& rhs) const;
|
||||
|
||||
private:
|
||||
void calculate_effective_size();
|
||||
|
||||
int width_;
|
||||
int height_;
|
||||
rational time_base_;
|
||||
|
||||
PixelFormat::Format format_;
|
||||
RenderMode::Mode mode_;
|
||||
|
||||
int divider_;
|
||||
int effective_width_;
|
||||
|
||||
Vendored
+4
-1
@@ -27,13 +27,16 @@
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
CacheTask::CacheTask(ViewerOutput* viewer, const VideoRenderingParams& vparams, const AudioRenderingParams &aparams, bool in_out_only) :
|
||||
CacheTask::CacheTask(ViewerOutput* viewer, const VideoParams& vparams, const AudioParams &aparams, bool in_out_only) :
|
||||
RenderTask(viewer, vparams, aparams),
|
||||
in_out_only_(in_out_only)
|
||||
{
|
||||
SetTitle(tr("Caching \"%1\"").arg(viewer->media_name()));
|
||||
|
||||
backend()->EnablePreviewGeneration(job_time());
|
||||
|
||||
// Render fastest quality
|
||||
backend()->SetRenderMode(RenderMode::kOffline);
|
||||
}
|
||||
|
||||
bool CacheTask::Run()
|
||||
|
||||
Vendored
+2
-2
@@ -32,8 +32,8 @@ class CacheTask : public RenderTask
|
||||
Q_OBJECT
|
||||
public:
|
||||
CacheTask(ViewerOutput* viewer,
|
||||
const VideoRenderingParams &vparams,
|
||||
const AudioRenderingParams &aparams,
|
||||
const VideoParams &vparams,
|
||||
const AudioParams &aparams,
|
||||
bool in_out_only);
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
ConformTask::ConformTask(AudioStreamPtr stream, const AudioRenderingParams& params) :
|
||||
ConformTask::ConformTask(AudioStreamPtr stream, const AudioParams& params) :
|
||||
stream_(stream),
|
||||
params_(params)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ OLIVE_NAMESPACE_ENTER
|
||||
class ConformTask : public Task
|
||||
{
|
||||
public:
|
||||
ConformTask(AudioStreamPtr stream, const AudioRenderingParams& params);
|
||||
ConformTask(AudioStreamPtr stream, const AudioParams& params);
|
||||
|
||||
public slots:
|
||||
virtual bool Run() override;
|
||||
@@ -38,7 +38,7 @@ public slots:
|
||||
private:
|
||||
AudioStreamPtr stream_;
|
||||
|
||||
AudioRenderingParams params_;
|
||||
AudioParams params_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ ExportTask::ExportTask(ViewerOutput* viewer_node,
|
||||
params_(params)
|
||||
{
|
||||
SetTitle(tr("Exporting \"%1\"").arg(viewer_node->media_name()));
|
||||
|
||||
// Render highest quality
|
||||
backend()->SetRenderMode(RenderMode::kOnline);
|
||||
}
|
||||
|
||||
bool ExportTask::Run()
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
RenderTask::RenderTask(ViewerOutput* viewer, const VideoRenderingParams &vparams, const AudioRenderingParams &aparams) :
|
||||
RenderTask::RenderTask(ViewerOutput* viewer, const VideoParams &vparams, const AudioParams &aparams) :
|
||||
viewer_(viewer),
|
||||
video_params_(vparams),
|
||||
audio_params_(aparams)
|
||||
|
||||
@@ -32,7 +32,7 @@ OLIVE_NAMESPACE_ENTER
|
||||
class RenderTask : public Task
|
||||
{
|
||||
public:
|
||||
RenderTask(ViewerOutput* viewer, const VideoRenderingParams &vparams, const AudioRenderingParams &aparams);
|
||||
RenderTask(ViewerOutput* viewer, const VideoParams &vparams, const AudioParams &aparams);
|
||||
|
||||
protected:
|
||||
void Render(const TimeRangeList &video_range,
|
||||
@@ -51,12 +51,12 @@ protected:
|
||||
return viewer_;
|
||||
}
|
||||
|
||||
VideoRenderingParams video_params() const
|
||||
VideoParams video_params() const
|
||||
{
|
||||
return video_params_;
|
||||
}
|
||||
|
||||
AudioRenderingParams audio_params() const
|
||||
AudioParams audio_params() const
|
||||
{
|
||||
return audio_params_;
|
||||
}
|
||||
@@ -76,9 +76,9 @@ protected:
|
||||
private:
|
||||
ViewerOutput* viewer_;
|
||||
|
||||
VideoRenderingParams video_params_;
|
||||
VideoParams video_params_;
|
||||
|
||||
AudioRenderingParams audio_params_;
|
||||
AudioParams audio_params_;
|
||||
|
||||
rational anchor_point_;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ AudioMonitor::~AudioMonitor()
|
||||
Stop();
|
||||
}
|
||||
|
||||
void AudioMonitor::SetParams(const AudioRenderingParams ¶ms)
|
||||
void AudioMonitor::SetParams(const AudioParams ¶ms)
|
||||
{
|
||||
params_ = params;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
virtual ~AudioMonitor() override;
|
||||
|
||||
public slots:
|
||||
void SetParams(const AudioRenderingParams& params);
|
||||
void SetParams(const AudioParams& params);
|
||||
|
||||
void OutputDeviceSet(const QString& filename, qint64 offset, int playback_speed);
|
||||
|
||||
@@ -64,7 +64,7 @@ private:
|
||||
|
||||
QVector<double> GetAverages() const;
|
||||
|
||||
AudioRenderingParams params_;
|
||||
AudioParams params_;
|
||||
|
||||
QFile file_;
|
||||
qint64 last_time_;
|
||||
|
||||
@@ -62,7 +62,7 @@ void AudioWaveformView::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QWidget::paintEvent(event);
|
||||
|
||||
const AudioRenderingParams& params = playback_->GetParameters();
|
||||
const AudioParams& params = playback_->GetParameters();
|
||||
|
||||
if (!playback_
|
||||
|| playback_->GetCacheFilename().isEmpty()
|
||||
|
||||
@@ -84,21 +84,28 @@ void FootageViewerWidget::SetFootage(Footage *footage)
|
||||
|
||||
if (video_stream) {
|
||||
video_node_->SetFootage(video_stream);
|
||||
viewer_node_->set_video_params(VideoParams(video_stream->width(), video_stream->height(), video_stream->frame_rate().flipped()));
|
||||
viewer_node_->set_video_params(VideoParams(video_stream->width(),
|
||||
video_stream->height(),
|
||||
video_stream->frame_rate().flipped(),
|
||||
static_cast<PixelFormat::Format>(Config::Current()["DefaultSequencePreviewFormat"].toInt()),
|
||||
Config::Current()["DefaultSequencePreviewDivider"].toInt()));
|
||||
NodeParam::ConnectEdge(video_node_->output(), viewer_node_->texture_input());
|
||||
} else {
|
||||
viewer_node_->set_video_params(VideoParams(Config::Current()["DefaultSequenceWidth"].toInt(),
|
||||
Config::Current()["DefaultSequenceHeight"].toInt(),
|
||||
Config::Current()["DefaultSequenceFrameRate"].value<rational>()));
|
||||
Config::Current()["DefaultSequenceHeight"].toInt(),
|
||||
Config::Current()["DefaultSequenceFrameRate"].value<rational>(),
|
||||
static_cast<PixelFormat::Format>(Config::Current()["DefaultSequencePreviewFormat"].toInt()),
|
||||
Config::Current()["DefaultSequencePreviewDivider"].toInt()));
|
||||
}
|
||||
|
||||
if (audio_stream) {
|
||||
audio_node_->SetFootage(audio_stream);
|
||||
viewer_node_->set_audio_params(AudioParams(audio_stream->sample_rate(), audio_stream->channel_layout()));
|
||||
viewer_node_->set_audio_params(AudioParams(audio_stream->sample_rate(), audio_stream->channel_layout(), SampleFormat::kInternalFormat));
|
||||
NodeParam::ConnectEdge(audio_node_->output(), viewer_node_->samples_input());
|
||||
} else {
|
||||
viewer_node_->set_audio_params(AudioParams(Config::Current()["DefaultSequenceAudioFrequency"].toInt(),
|
||||
Config::Current()["DefaultSequenceAudioLayout"].toULongLong()));
|
||||
Config::Current()["DefaultSequenceAudioLayout"].toULongLong(),
|
||||
SampleFormat::kInternalFormat));
|
||||
}
|
||||
|
||||
ConnectViewerNode(viewer_node_, footage_->project()->color_manager());
|
||||
|
||||
@@ -54,7 +54,6 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
playback_speed_(0),
|
||||
frame_cache_job_time_(0),
|
||||
color_menu_enabled_(true),
|
||||
divider_(Config::Current()["DefaultViewerDivider"].toInt()),
|
||||
override_color_manager_(nullptr),
|
||||
time_changed_from_timer_(false),
|
||||
prequeuing_(false),
|
||||
@@ -112,6 +111,7 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
// Start background renderer
|
||||
renderer_ = new OpenGLBackend(this);
|
||||
renderer_->SetUpdateWithGraph(true);
|
||||
renderer_->SetRenderMode(RenderMode::kOffline);
|
||||
|
||||
// Setup cache wait timer (waits a few seconds of inactivity before caching)
|
||||
cache_wait_timer_.setInterval(100);
|
||||
@@ -186,8 +186,7 @@ void ViewerWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
|
||||
ruler()->SetPlaybackCache(n->video_frame_cache());
|
||||
|
||||
n->audio_playback_cache()->SetParameters(AudioRenderingParams(n->audio_params(),
|
||||
SampleFormat::kInternalFormat));
|
||||
n->audio_playback_cache()->SetParameters(n->audio_params());
|
||||
|
||||
SizeChangedSlot(n->video_params().width(), n->video_params().height());
|
||||
last_length_ = rational();
|
||||
@@ -208,8 +207,6 @@ void ViewerWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
window->display_widget()->ConnectColorManager(using_manager);
|
||||
}
|
||||
|
||||
divider_ = CalculateDivider();
|
||||
|
||||
UpdateRendererParameters();
|
||||
|
||||
UpdateStack();
|
||||
@@ -409,7 +406,7 @@ FramePtr DecodeCachedImage(const QString &fn, const rational& time)
|
||||
|
||||
frame = Frame::Create();
|
||||
frame->set_timestamp(time);
|
||||
frame->set_video_params(VideoRenderingParams(input->spec().width,
|
||||
frame->set_video_params(VideoParams(input->spec().width,
|
||||
input->spec().height,
|
||||
image_format));
|
||||
|
||||
@@ -558,7 +555,7 @@ void ViewerWidget::PushScrubbedAudio()
|
||||
QFile audio_src(audio_fn);
|
||||
|
||||
if (audio_src.open(QFile::ReadOnly)) {
|
||||
const AudioRenderingParams& params = GetConnectedNode()->audio_playback_cache()->GetParameters();
|
||||
const AudioParams& params = GetConnectedNode()->audio_playback_cache()->GetParameters();
|
||||
|
||||
// FIXME: Hardcoded scrubbing interval (20ms)
|
||||
int size_of_sample = params.time_to_bytes(rational(20, 1000));
|
||||
@@ -574,6 +571,7 @@ void ViewerWidget::PushScrubbedAudio()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
int ViewerWidget::CalculateDivider()
|
||||
{
|
||||
if (GetConnectedNode() && Config::Current()["AutoSelectDivider"].toBool()) {
|
||||
@@ -585,6 +583,7 @@ int ViewerWidget::CalculateDivider()
|
||||
|
||||
return divider_;
|
||||
}
|
||||
*/
|
||||
|
||||
void ViewerWidget::UpdateMinimumScale()
|
||||
{
|
||||
@@ -703,20 +702,6 @@ void ViewerWidget::FinishPlayPreprocess()
|
||||
PlaybackTimerUpdate();
|
||||
}
|
||||
|
||||
VideoRenderingParams ViewerWidget::GenerateVideoParams() const
|
||||
{
|
||||
return VideoRenderingParams(GetConnectedNode()->video_params(),
|
||||
GetCurrentPixelFormat(),
|
||||
RenderMode::kOffline,
|
||||
divider_);
|
||||
}
|
||||
|
||||
AudioRenderingParams ViewerWidget::GenerateAudioParams() const
|
||||
{
|
||||
return AudioRenderingParams(GetConnectedNode()->audio_params(),
|
||||
SampleFormat::kInternalFormat);
|
||||
}
|
||||
|
||||
int ViewerWidget::DeterminePlaybackQueueSize()
|
||||
{
|
||||
int64_t end_ts;
|
||||
@@ -914,8 +899,8 @@ void ViewerWidget::StartBackgroundCaching()
|
||||
|
||||
} else {
|
||||
cache_background_task_ = new CacheTask(GetConnectedNode(),
|
||||
GenerateVideoParams(),
|
||||
GenerateAudioParams(),
|
||||
GetConnectedNode()->video_params(),
|
||||
GetConnectedNode()->audio_params(),
|
||||
false);
|
||||
|
||||
our_cache_background_task_ = cache_background_task_;
|
||||
@@ -943,8 +928,8 @@ void ViewerWidget::UpdateRendererParameters()
|
||||
|
||||
StartBackgroundCaching();
|
||||
|
||||
renderer_->SetVideoParams(GenerateVideoParams());
|
||||
renderer_->SetAudioParams(GenerateAudioParams());
|
||||
renderer_->SetVideoParams(GetConnectedNode()->video_params());
|
||||
renderer_->SetAudioParams(GetConnectedNode()->audio_params());
|
||||
|
||||
display_widget_->SetVideoParams(GetConnectedNode()->video_params());
|
||||
}
|
||||
@@ -975,26 +960,6 @@ void ViewerWidget::ShowContextMenu(const QPoint &pos)
|
||||
menu.addSeparator();
|
||||
}
|
||||
|
||||
{
|
||||
// Playback resolution
|
||||
Menu* playback_resolution_menu = new Menu(tr("Resolution"), &menu);
|
||||
menu.addMenu(playback_resolution_menu);
|
||||
|
||||
playback_resolution_menu->addAction(tr("Full"))->setData(1);
|
||||
int dividers[] = {2, 4, 8, 16};
|
||||
for (int i=0;i<4;i++) {
|
||||
playback_resolution_menu->addAction(tr("1/%1").arg(dividers[i]))->setData(dividers[i]);
|
||||
}
|
||||
connect(playback_resolution_menu, &QMenu::triggered, this, &ViewerWidget::SetDividerFromMenu);
|
||||
|
||||
foreach (QAction* a, playback_resolution_menu->actions()) {
|
||||
a->setCheckable(true);
|
||||
if (a->data() == divider_) {
|
||||
a->setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Viewer Zoom Level
|
||||
Menu* zoom_menu = new Menu(tr("Zoom"), &menu);
|
||||
@@ -1252,20 +1217,6 @@ void ViewerWidget::LengthChangedSlot(const rational &length)
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWidget::SetDividerFromMenu(QAction *action)
|
||||
{
|
||||
int divider = action->data().toInt();
|
||||
|
||||
if (divider <= 0) {
|
||||
qWarning() << "Tried to set invalid divider:" << divider;
|
||||
return;
|
||||
}
|
||||
|
||||
divider_ = divider;
|
||||
|
||||
UpdateRendererParameters();
|
||||
}
|
||||
|
||||
void ViewerWidget::SetZoomFromMenu(QAction *action)
|
||||
{
|
||||
sizer_->SetZoom(action->data().toInt());
|
||||
|
||||
@@ -197,9 +197,6 @@ private:
|
||||
|
||||
void FinishPlayPreprocess();
|
||||
|
||||
VideoRenderingParams GenerateVideoParams() const;
|
||||
AudioRenderingParams GenerateAudioParams() const;
|
||||
|
||||
int DeterminePlaybackQueueSize();
|
||||
|
||||
void PopOldestFrameFromPlaybackQueue();
|
||||
@@ -216,8 +213,6 @@ private:
|
||||
|
||||
bool color_menu_enabled_;
|
||||
|
||||
int divider_;
|
||||
|
||||
ColorManager* override_color_manager_;
|
||||
|
||||
bool time_changed_from_timer_;
|
||||
@@ -269,8 +264,6 @@ private slots:
|
||||
|
||||
void ShowContextMenu(const QPoint& pos);
|
||||
|
||||
void SetDividerFromMenu(QAction* action);
|
||||
|
||||
void SetZoomFromMenu(QAction* action);
|
||||
|
||||
void ViewerInvalidatedVideoRange(const OLIVE_NAMESPACE::TimeRange &range);
|
||||
|
||||
Reference in New Issue
Block a user