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.
}
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);
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));
}
}
/*
- 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.
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)
{
}
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;
}
/*
- 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.
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);
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;
};