renderer/decoder: simplified audio PCM transcode
Turned the two-step PCM transcode into one step and simplified/removed much of the unnecessary infrastructure that supported it. This makes the code cleaner and generally improves the code paths.
This commit is contained in:
@@ -22,8 +22,7 @@
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
AudioStream::AudioStream() :
|
||||
index_done_(false)
|
||||
AudioStream::AudioStream()
|
||||
{
|
||||
set_type(kAudio);
|
||||
}
|
||||
@@ -65,68 +64,32 @@ void AudioStream::set_sample_rate(const int &sample_rate)
|
||||
sample_rate_ = sample_rate;
|
||||
}
|
||||
|
||||
const rational &AudioStream::index_length()
|
||||
bool AudioStream::try_start_conforming(const AudioRenderingParams ¶ms)
|
||||
{
|
||||
QMutexLocker locker(index_access_lock());
|
||||
QMutexLocker locker(proxy_access_lock());
|
||||
|
||||
return index_length_;
|
||||
}
|
||||
|
||||
void AudioStream::set_index_length(const rational &index_length)
|
||||
{
|
||||
{
|
||||
QMutexLocker locker(index_access_lock());
|
||||
|
||||
index_length_ = index_length;
|
||||
}
|
||||
|
||||
emit IndexChanged();
|
||||
}
|
||||
|
||||
const bool &AudioStream::index_done()
|
||||
{
|
||||
QMutexLocker locker(index_access_lock());
|
||||
|
||||
return index_done_;
|
||||
}
|
||||
|
||||
void AudioStream::set_index_done(const bool& index_done)
|
||||
{
|
||||
{
|
||||
QMutexLocker locker(index_access_lock());
|
||||
|
||||
index_done_ = index_done;
|
||||
}
|
||||
|
||||
emit IndexChanged();
|
||||
}
|
||||
|
||||
void AudioStream::clear_index()
|
||||
{
|
||||
QMutexLocker locker(index_access_lock());
|
||||
|
||||
index_done_ = false;
|
||||
index_length_ = 0;
|
||||
}
|
||||
|
||||
bool AudioStream::has_conformed_version(const AudioRenderingParams ¶ms)
|
||||
{
|
||||
QMutexLocker locker(index_access_lock());
|
||||
|
||||
foreach (const AudioRenderingParams& p, conformed_) {
|
||||
if (p == params) {
|
||||
return true;
|
||||
}
|
||||
if (!currently_conforming_.contains(params)
|
||||
&& !conformed_.contains(params)) {
|
||||
currently_conforming_.append(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AudioStream::has_conformed_version(const AudioRenderingParams ¶ms)
|
||||
{
|
||||
QMutexLocker locker(proxy_access_lock());
|
||||
|
||||
return conformed_.contains(params);
|
||||
}
|
||||
|
||||
void AudioStream::append_conformed_version(const AudioRenderingParams ¶ms)
|
||||
{
|
||||
{
|
||||
QMutexLocker locker(index_access_lock());
|
||||
QMutexLocker locker(proxy_access_lock());
|
||||
|
||||
currently_conforming_.removeOne(params);
|
||||
conformed_.append(params);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,29 +49,21 @@ public:
|
||||
const int& sample_rate() const;
|
||||
void set_sample_rate(const int& sample_rate);
|
||||
|
||||
const rational& index_length();
|
||||
void set_index_length(const rational& index_length);
|
||||
|
||||
const bool& index_done();
|
||||
void set_index_done(const bool &index_done);
|
||||
|
||||
void clear_index();
|
||||
|
||||
bool try_start_conforming(const AudioRenderingParams& params);
|
||||
bool has_conformed_version(const AudioRenderingParams& params);
|
||||
void append_conformed_version(const AudioRenderingParams& params);
|
||||
|
||||
signals:
|
||||
void ConformAppended(const AudioRenderingParams& params);
|
||||
void ConformAppended(OLIVE_NAMESPACE::AudioRenderingParams params);
|
||||
|
||||
private:
|
||||
int channels_;
|
||||
uint64_t layout_;
|
||||
int sample_rate_;
|
||||
|
||||
rational index_length_;
|
||||
bool index_done_;
|
||||
QList<AudioRenderingParams> conformed_;
|
||||
|
||||
QVector<AudioRenderingParams> conformed_;
|
||||
QList<AudioRenderingParams> currently_conforming_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -139,14 +139,9 @@ QIcon Stream::IconFromType(const Stream::Type &type)
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
QMutex* Stream::index_process_lock()
|
||||
QMutex *Stream::proxy_access_lock()
|
||||
{
|
||||
return &index_process_lock_;
|
||||
}
|
||||
|
||||
QMutex *Stream::index_access_lock()
|
||||
{
|
||||
return &index_access_lock_;
|
||||
return &proxy_access_lock_;
|
||||
}
|
||||
|
||||
void Stream::FootageSetEvent(Footage*)
|
||||
|
||||
@@ -92,8 +92,7 @@ public:
|
||||
|
||||
static QIcon IconFromType(const Type& type);
|
||||
|
||||
QMutex* index_process_lock();
|
||||
QMutex* index_access_lock();
|
||||
QMutex* proxy_access_lock();
|
||||
|
||||
protected:
|
||||
virtual void FootageSetEvent(Footage*);
|
||||
@@ -120,9 +119,7 @@ private:
|
||||
|
||||
bool enabled_;
|
||||
|
||||
QMutex index_process_lock_;
|
||||
|
||||
QMutex index_access_lock_;
|
||||
QMutex proxy_access_lock_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -75,14 +75,14 @@ void VideoStream::set_image_sequence(bool e)
|
||||
|
||||
bool VideoStream::has_proxy(const int ÷r)
|
||||
{
|
||||
QMutexLocker locker(index_access_lock());
|
||||
QMutexLocker locker(proxy_access_lock());
|
||||
|
||||
return proxies_.contains(divider);
|
||||
}
|
||||
|
||||
void VideoStream::append_proxy(const int ÷r)
|
||||
{
|
||||
QMutexLocker locker(index_access_lock());
|
||||
QMutexLocker locker(proxy_access_lock());
|
||||
|
||||
proxies_.append(divider);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user