diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-11-14 20:04:15 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-11-14 20:04:15 +0000 |
| commit | 05c37b9bb09f7bfa4c2ec8ea6b3fa4a83d0fec20 (patch) | |
| tree | fa7a3e408c2eb66b070864694b6af7e0787e508f /src/lib/decoder.cc | |
| parent | 5161626c3c28ba528511a8b211286a5e81a0f02a (diff) | |
Tests pass again.
Diffstat (limited to 'src/lib/decoder.cc')
| -rw-r--r-- | src/lib/decoder.cc | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index e91b5e19e..8e1e4e3c5 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -73,57 +73,19 @@ Decoder::go () } } -/** Called to tell the world that some audio data is ready - * @param audio Audio data. - */ -void -Decoder::process_audio (shared_ptr<AudioBuffers> audio) -{ - /* Maybe apply gain */ - if (_film->audio_gain() != 0) { - float const linear_gain = pow (10, _film->audio_gain() / 20); - for (int i = 0; i < audio->channels(); ++i) { - for (int j = 0; j < audio->frames(); ++j) { - audio->data(i)[j] *= linear_gain; - } - } - } - - Audio (audio); -} - /** Called by subclasses to tell the world that some video data is ready. * We do some post-processing / filtering then emit it for listeners. * @param frame to decode; caller manages memory. */ void -Decoder::process_video (AVFrame const * frame) +Decoder::emit_video (shared_ptr<Image> image) { - shared_ptr<FilterGraph> graph; - - list<shared_ptr<FilterGraph> >::iterator i = _filter_graphs.begin(); - while (i != _filter_graphs.end() && !(*i)->can_process (Size (frame->width, frame->height), (AVPixelFormat) frame->format)) { - ++i; - } - - if (i == _filter_graphs.end ()) { - graph.reset (new FilterGraph (_film, this, _opt->apply_crop, Size (frame->width, frame->height), (AVPixelFormat) frame->format)); - _filter_graphs.push_back (graph); - _film->log()->log (String::compose ("New graph for %1x%2, pixel format %3", frame->width, frame->height, frame->format)); - } else { - graph = *i; + shared_ptr<Subtitle> sub; + if (_timed_subtitle && _timed_subtitle->displayed_at (double (video_frame()) / _film->frames_per_second())) { + sub = _timed_subtitle->subtitle (); } - list<shared_ptr<Image> > images = graph->process (frame); - - for (list<shared_ptr<Image> >::iterator i = images.begin(); i != images.end(); ++i) { - shared_ptr<Subtitle> sub; - if (_timed_subtitle && _timed_subtitle->displayed_at (double (video_frame()) / _film->frames_per_second())) { - sub = _timed_subtitle->subtitle (); - } - - emit_video (*i, sub); - } + Video (image, sub); } void @@ -149,7 +111,7 @@ Decoder::emit_video (shared_ptr<Image> image, shared_ptr<Subtitle> sub) } void -Decoder::process_subtitle (shared_ptr<TimedSubtitle> s) +Decoder::emit_subtitle (shared_ptr<TimedSubtitle> s) { _timed_subtitle = s; |
