implemented preliminary pre-cacher for audio
FFmpegDecoder now implements an "indexer" for audio, which actually just extracts the raw PCM audio from an audio codec and saves it to disk
This commit is contained in:
@@ -52,7 +52,7 @@ int AudioRenderingParams::time_to_bytes(const rational &time) const
|
||||
{
|
||||
Q_ASSERT(is_valid());
|
||||
|
||||
return qFloor(time.toDouble() * sample_rate()) * channel_count() * sample_size();
|
||||
return qFloor(time.toDouble() * sample_rate()) * channel_count() * bytes_per_sample();
|
||||
}
|
||||
|
||||
int AudioRenderingParams::channel_count() const
|
||||
@@ -60,7 +60,7 @@ int AudioRenderingParams::channel_count() const
|
||||
return av_get_channel_layout_nb_channels(channel_layout());
|
||||
}
|
||||
|
||||
int AudioRenderingParams::sample_size() const
|
||||
int AudioRenderingParams::bytes_per_sample() const
|
||||
{
|
||||
switch (format_) {
|
||||
case olive::SAMPLE_FMT_U8:
|
||||
@@ -71,6 +71,7 @@ int AudioRenderingParams::sample_size() const
|
||||
case olive::SAMPLE_FMT_FLT:
|
||||
return 4;
|
||||
case olive::SAMPLE_FMT_DBL:
|
||||
case olive::SAMPLE_FMT_S64:
|
||||
return 8;
|
||||
case olive::SAMPLE_FMT_INVALID:
|
||||
case olive::SAMPLE_FMT_COUNT:
|
||||
@@ -80,6 +81,11 @@ int AudioRenderingParams::sample_size() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AudioRenderingParams::bits_per_sample() const
|
||||
{
|
||||
return bytes_per_sample() * 8;
|
||||
}
|
||||
|
||||
bool AudioRenderingParams::is_valid() const
|
||||
{
|
||||
return (sample_rate() > 0
|
||||
|
||||
@@ -30,7 +30,8 @@ public:
|
||||
|
||||
int time_to_bytes(const rational& time) const;
|
||||
int channel_count() const;
|
||||
int sample_size() const;
|
||||
int bytes_per_sample() const;
|
||||
int bits_per_sample() const;
|
||||
bool is_valid() const;
|
||||
|
||||
const olive::SampleFormat& format() const;
|
||||
|
||||
@@ -344,14 +344,27 @@ void VideoRendererProcessor::ThreadCallback(RenderTexturePtr texture, const rati
|
||||
|
||||
// If the connected output is using this time, signal it to update
|
||||
if (last_time_requested_ == time) {
|
||||
|
||||
copy_buffer_.Bind();
|
||||
texture->Bind();
|
||||
|
||||
QOpenGLContext::currentContext()->functions()->glViewport(0, 0, master_texture_->width(), master_texture_->height());
|
||||
QOpenGLFunctions* f = QOpenGLContext::currentContext()->functions();
|
||||
|
||||
olive::gl::Blit(copy_pipeline_);
|
||||
if (texture == nullptr) {
|
||||
|
||||
// No texture, clear the master and push it
|
||||
f->glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
f->glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
} else {
|
||||
texture->Bind();
|
||||
|
||||
f->glViewport(0, 0, master_texture_->width(), master_texture_->height());
|
||||
|
||||
olive::gl::Blit(copy_pipeline_);
|
||||
|
||||
texture->Release();
|
||||
}
|
||||
|
||||
texture->Release();
|
||||
copy_buffer_.Release();
|
||||
|
||||
push_time_ = time;
|
||||
|
||||
Reference in New Issue
Block a user