simplified and optimized samplebuffer
This commit is contained in:
@@ -192,7 +192,7 @@ bool ExportTask::FrameDownloaded(FramePtr f, const QByteArray &hash, const QVect
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ExportTask::AudioDownloaded(const TimeRange &range, SampleBufferPtr samples)
|
||||
bool ExportTask::AudioDownloaded(const TimeRange &range, const SampleBuffer &samples)
|
||||
{
|
||||
TimeRange adjusted_range = range;
|
||||
|
||||
@@ -221,7 +221,7 @@ bool ExportTask::EncodeSubtitle(const SubtitleBlock *sub)
|
||||
}
|
||||
}
|
||||
|
||||
bool ExportTask::WriteAudioLoop(const TimeRange& time, SampleBufferPtr samples)
|
||||
bool ExportTask::WriteAudioLoop(const TimeRange& time, const SampleBuffer &samples)
|
||||
{
|
||||
if (!encoder_->WriteAudio(samples)) {
|
||||
SetError(encoder_->GetError());
|
||||
@@ -232,7 +232,7 @@ bool ExportTask::WriteAudioLoop(const TimeRange& time, SampleBufferPtr samples)
|
||||
|
||||
for (auto it=audio_map_.begin(); it!=audio_map_.end(); it++) {
|
||||
TimeRange t = it.key();
|
||||
SampleBufferPtr s = it.value();
|
||||
SampleBuffer s = it.value();
|
||||
|
||||
if (t.in() == audio_time_) {
|
||||
// Erase from audio map since we're just about to write it
|
||||
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
|
||||
virtual bool FrameDownloaded(FramePtr frame, const QByteArray& hash, const QVector<rational>& times) override;
|
||||
|
||||
virtual bool AudioDownloaded(const TimeRange& range, SampleBufferPtr samples) override;
|
||||
virtual bool AudioDownloaded(const TimeRange& range, const SampleBuffer &samples) override;
|
||||
|
||||
virtual bool EncodeSubtitle(const SubtitleBlock *sub) override;
|
||||
|
||||
@@ -50,11 +50,11 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
bool WriteAudioLoop(const TimeRange &time, SampleBufferPtr samples);
|
||||
bool WriteAudioLoop(const TimeRange &time, const SampleBuffer &samples);
|
||||
|
||||
QHash<rational, FramePtr> time_map_;
|
||||
|
||||
QHash<TimeRange, SampleBufferPtr> audio_map_;
|
||||
QHash<TimeRange, SampleBuffer> audio_map_;
|
||||
|
||||
ColorManager* color_manager_;
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ bool PreCacheTask::FrameDownloaded(FramePtr frame, const QByteArray &hash, const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PreCacheTask::AudioDownloaded(const TimeRange &range, SampleBufferPtr samples)
|
||||
bool PreCacheTask::AudioDownloaded(const TimeRange &range, const SampleBuffer &samples)
|
||||
{
|
||||
// Pre-cache doesn't cache any audio
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
|
||||
virtual bool FrameDownloaded(FramePtr frame, const QByteArray& hash, const QVector<rational>& times) override;
|
||||
|
||||
virtual bool AudioDownloaded(const TimeRange& range, SampleBufferPtr samples) override;
|
||||
virtual bool AudioDownloaded(const TimeRange& range, const SampleBuffer &samples) override;
|
||||
|
||||
private:
|
||||
Project* project_;
|
||||
|
||||
@@ -195,7 +195,7 @@ bool RenderTask::Render(ColorManager* manager,
|
||||
|
||||
TimeRange range = watcher->property("range").value<TimeRange>();
|
||||
|
||||
if (!AudioDownloaded(range, watcher->Get().value<SampleBufferPtr>())) {
|
||||
if (!AudioDownloaded(range, watcher->Get().value<SampleBuffer>())) {
|
||||
result = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ protected:
|
||||
|
||||
virtual bool FrameDownloaded(FramePtr frame, const QByteArray& hash, const QVector<rational>& times) = 0;
|
||||
|
||||
virtual bool AudioDownloaded(const TimeRange& range, SampleBufferPtr samples) = 0;
|
||||
virtual bool AudioDownloaded(const TimeRange& range, const SampleBuffer &samples) = 0;
|
||||
|
||||
virtual bool EncodeSubtitle(const SubtitleBlock *subtitle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user