diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-10-06 23:38:07 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-10-18 20:25:57 +0200 |
| commit | bdbec5b501af2c020dd783eb8b0b8c18c34b6552 (patch) | |
| tree | 92819766f9fa72c4ecd2ae7c0a7be71d4cb37c2c /src/lib/ffmpeg_decoder.cc | |
| parent | b65d616d5e187ca2153f5f9390dd8ad16d7da30e (diff) | |
Extract VideoFilterGraphSet.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 986e51ab6..27b7aa7b7 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -77,6 +77,7 @@ using namespace dcpomatic; FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> film, shared_ptr<const FFmpegContent> c, bool fast) : FFmpeg (c) , Decoder (film) + , _filter_graphs(c->filters(), dcp::Fraction(lrint(_ffmpeg_content->video_frame_rate().get_value_or(24) * 1000), 1000)) { if (c->video && c->video->use()) { video = make_shared<VideoDecoder>(this, c); @@ -577,23 +578,7 @@ FFmpegDecoder::decode_and_process_video_packet (AVPacket* packet) void FFmpegDecoder::process_video_frame () { - shared_ptr<VideoFilterGraph> graph; - - auto i = _filter_graphs.begin(); - while (i != _filter_graphs.end() && !(*i)->can_process(dcp::Size(_video_frame->width, _video_frame->height), (AVPixelFormat) _video_frame->format)) { - ++i; - } - - if (i == _filter_graphs.end ()) { - dcp::Fraction vfr (lrint(_ffmpeg_content->video_frame_rate().get() * 1000), 1000); - graph = make_shared<VideoFilterGraph>(dcp::Size(_video_frame->width, _video_frame->height), (AVPixelFormat) _video_frame->format, vfr); - graph->setup (_ffmpeg_content->filters ()); - _filter_graphs.push_back (graph); - LOG_GENERAL (N_("New graph for %1x%2, pixel format %3"), _video_frame->width, _video_frame->height, _video_frame->format); - } else { - graph = *i; - } - + auto graph = _filter_graphs.get(dcp::Size(_video_frame->width, _video_frame->height), static_cast<AVPixelFormat>(_video_frame->format)); auto images = graph->process (_video_frame); for (auto const& i: images) { |
