diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-10-15 12:42:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-10-15 12:42:22 +0100 |
| commit | 13511ed2fcc23f4d5f9c507c775c3c5cfd82d155 (patch) | |
| tree | 5ab1d1600725873a199725e50d67da9791c25d67 /src/lib/decoder.cc | |
| parent | cb33319a820b17a05cfb2ef78ba1799f4d0c54b9 (diff) | |
| parent | 43990add893eccf350f280e2dd3f947a94f3e9aa (diff) | |
Merge branch 'master' of /home/carl/git/dvdomatic
Diffstat (limited to 'src/lib/decoder.cc')
| -rw-r--r-- | src/lib/decoder.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index 324d1a296..1f771da2d 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -48,6 +48,7 @@ extern "C" { #include "filter.h" #include "delay_line.h" #include "ffmpeg_compatibility.h" +#include "subtitle.h" using namespace std; using namespace boost; @@ -303,8 +304,13 @@ Decoder::process_video (AVFrame* frame) image->make_black (); } + 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); - Video (image, _video_frame); + Video (image, _video_frame, sub); ++_video_frame; } } @@ -405,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)); + } + } +} |
