simplified and optimized samplebuffer

This commit is contained in:
itsmattkc
2022-05-09 14:55:51 -07:00
parent 58c4600d04
commit bb0fedabba
47 changed files with 214 additions and 252 deletions
+3 -3
View File
@@ -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
+3 -3
View File
@@ -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_;
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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_;
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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);