summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/lib/ffmpeg_decoder.cc3
-rw-r--r--src/lib/filter_graph.cc5
-rw-r--r--src/lib/video_filter_graph.cc13
-rw-r--r--src/lib/video_filter_graph.h5
5 files changed, 20 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 98f6c7d90..dd554346a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2018-05-15 Carl Hetherington <cth@carlh.net>
+ * Fix crash on enabling telecine filter.
+
* Fix incorrect subtitle positining in a VF when there are more than
two consecutive reels with no subtitles.
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index ea41acf23..55ff01046 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -508,7 +508,8 @@ FFmpegDecoder::decode_video_packet ()
}
if (i == _filter_graphs.end ()) {
- graph.reset (new VideoFilterGraph (dcp::Size (_frame->width, _frame->height), (AVPixelFormat) _frame->format));
+ dcp::Fraction vfr (lrint(_ffmpeg_content->video_frame_rate().get() * 1000), 1000);
+ graph.reset (new VideoFilterGraph (dcp::Size (_frame->width, _frame->height), (AVPixelFormat) _frame->format, vfr));
graph->setup (_ffmpeg_content->filters ());
_filter_graphs.push_back (graph);
LOG_GENERAL (N_("New graph for %1x%2, pixel format %3"), _frame->width, _frame->height, _frame->format);
diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc
index 52826f3d0..daceeaf2d 100644
--- a/src/lib/filter_graph.cc
+++ b/src/lib/filter_graph.cc
@@ -111,8 +111,9 @@ FilterGraph::setup (vector<Filter const *> filters)
throw DecodeError (N_("could not set up filter graph."));
}
- if (avfilter_graph_config (_graph, 0) < 0) {
- throw DecodeError (N_("could not configure filter graph."));
+ int e = avfilter_graph_config (_graph, 0);
+ if (e < 0) {
+ throw DecodeError (String::compose (N_("could not configure filter graph (%1)"), e));
}
}
diff --git a/src/lib/video_filter_graph.cc b/src/lib/video_filter_graph.cc
index 534dd6142..6075500e9 100644
--- a/src/lib/video_filter_graph.cc
+++ b/src/lib/video_filter_graph.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -35,9 +35,10 @@ using std::string;
using std::make_pair;
using boost::shared_ptr;
-VideoFilterGraph::VideoFilterGraph (dcp::Size s, AVPixelFormat p)
+VideoFilterGraph::VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction r)
: _size (s)
, _pixel_format (p)
+ , _frame_rate (r)
{
}
@@ -85,7 +86,13 @@ string
VideoFilterGraph::src_parameters () const
{
char buffer[256];
- snprintf (buffer, sizeof(buffer), "video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=1/1", _size.width, _size.height, _pixel_format);
+ snprintf (
+ buffer, sizeof(buffer),
+ "video_size=%dx%d:pix_fmt=%d:frame_rate=%d/%d:time_base=1/1:pixel_aspect=1/1",
+ _size.width, _size.height,
+ _pixel_format,
+ _frame_rate.numerator, _frame_rate.denominator
+ );
return buffer;
}
diff --git a/src/lib/video_filter_graph.h b/src/lib/video_filter_graph.h
index 5eff1d5c4..19cb24e36 100644
--- a/src/lib/video_filter_graph.h
+++ b/src/lib/video_filter_graph.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -23,7 +23,7 @@
class VideoFilterGraph : public FilterGraph
{
public:
- VideoFilterGraph (dcp::Size s, AVPixelFormat p);
+ VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction r);
bool can_process (dcp::Size s, AVPixelFormat p) const;
std::list<std::pair<boost::shared_ptr<Image>, int64_t> > process (AVFrame * frame);
@@ -37,4 +37,5 @@ protected:
private:
dcp::Size _size; ///< size of the images that this chain can process
AVPixelFormat _pixel_format; ///< pixel format of the images that this chain can process
+ dcp::Fraction _frame_rate;
};