summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-12-16 13:43:25 +0000
committerCarl Hetherington <cth@carlh.net>2012-12-16 13:43:25 +0000
commit3171c89fef95b19c8889996caaac73eea71cf388 (patch)
treedeeeda477690ff9af5a67bd210270b5da7806371 /src/lib/ffmpeg_decoder.cc
parent1f2bc4d8f3601ad1e12b94f37b3889fcd003509b (diff)
Decoder handles crop changing.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index b3b1acbbb..51afc461a 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -77,6 +77,8 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<Film> f, shared_ptr<const DecodeOptions
setup_video ();
setup_audio ();
setup_subtitle ();
+
+ f->Changed.connect (bind (&FFmpegDecoder::film_changed, this, _1));
}
FFmpegDecoder::~FFmpegDecoder ()
@@ -526,6 +528,8 @@ FFmpegDecoder::set_subtitle_stream (shared_ptr<SubtitleStream> s)
void
FFmpegDecoder::filter_and_emit_video (AVFrame* frame)
{
+ boost::mutex::scoped_lock lm (_filter_graphs_mutex);
+
shared_ptr<FilterGraph> graph;
list<shared_ptr<FilterGraph> >::iterator i = _filter_graphs.begin();
@@ -554,6 +558,11 @@ FFmpegDecoder::seek (SourceFrame f)
int64_t const t = static_cast<int64_t>(f) / (av_q2d (_format_context->streams[_video_stream]->time_base) * frames_per_second());
int const r = av_seek_frame (_format_context, _video_stream, t, 0);
avcodec_flush_buffers (_video_codec_context);
+
+ if (r >= 0) {
+ OutputChanged ();
+ }
+
return r < 0;
}
@@ -655,3 +664,21 @@ FFmpegDecoder::out_careful ()
_film->log()->log (String::compose ("Frame removed at %1s", out_pts_seconds));
}
}
+
+void
+FFmpegDecoder::film_changed (Film::Property p)
+{
+ switch (p) {
+ case Film::CROP:
+ {
+ boost::mutex::scoped_lock lm (_filter_graphs_mutex);
+ _filter_graphs.clear ();
+ }
+ OutputChanged ();
+ break;
+
+ default:
+ break;
+ }
+}
+