diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-10-14 16:50:08 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-10-14 16:50:08 +0100 |
| commit | a066feba1b455a72fe10b7baa79f17f69cd24ba9 (patch) | |
| tree | ba2ee6308f200c42870d42b7c716fddf941f8c31 /src/lib/decoder.cc | |
| parent | 27fac0b4c6d42cb3b47bc1240d50ce11923fb66a (diff) | |
Various fixes to subtitling.
Diffstat (limited to 'src/lib/decoder.cc')
| -rw-r--r-- | src/lib/decoder.cc | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index c4759a872..1f771da2d 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -229,7 +229,7 @@ Decoder::process_audio (uint8_t* data, int size) * @param frame to decode; caller manages memory. */ void -Decoder::process_video (AVFrame* frame, shared_ptr<Subtitle> sub) +Decoder::process_video (AVFrame* frame) { if (_minimal) { ++_video_frame; @@ -304,12 +304,9 @@ Decoder::process_video (AVFrame* frame, shared_ptr<Subtitle> sub) image->make_black (); } - if (sub && _opt->apply_crop) { - list<shared_ptr<SubtitleImage> > im = sub->images (); - for (list<shared_ptr<SubtitleImage> >::iterator i = im.begin(); i != im.end(); ++i) { - Position p = (*i)->position (); - (*i)->set_position (Position (p.x - _fs->crop.left, p.y - _fs->crop.top)); - } + shared_ptr<Subtitle> sub; + if (_subtitle && _subtitle->displayed_at (double (last_video_frame()) / rint (_fs->frames_per_second))) { + sub = _subtitle; } TIMING ("Decoder emits %1", _video_frame); @@ -414,3 +411,16 @@ Decoder::setup_video_filters () /* XXX: leaking `inputs' / `outputs' ? */ } +void +Decoder::process_subtitle (shared_ptr<Subtitle> s) +{ + _subtitle = s; + + if (_opt->apply_crop) { + list<shared_ptr<SubtitleImage> > im = _subtitle->images (); + for (list<shared_ptr<SubtitleImage> >::iterator i = im.begin(); i != im.end(); ++i) { + Position const p = (*i)->position (); + (*i)->set_position (Position (p.x - _fs->crop.left, p.y - _fs->crop.top)); + } + } +} |
