summaryrefslogtreecommitdiff
path: root/src/lib/decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-14 21:06:47 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-14 21:06:47 +0100
commit009a58293bf2e9727d544d1a2648422cc395d81e (patch)
treec581d457104195a0219a0197c523981756bf9ecd /src/lib/decoder.cc
parentb5001080a3e5b414f6cad1c52926ed757f2d8574 (diff)
parentade28a703b15af710161faa017cddf95d66c4118 (diff)
Merge branch 'subs'
Diffstat (limited to 'src/lib/decoder.cc')
-rw-r--r--src/lib/decoder.cc21
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));
+ }
+ }
+}