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:
@@ -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_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user