X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ffilter_graph.cc;h=86f291fde6fd3ada1095d9a961cbe8125de64c5e;hb=7a1bd472537fee593a3f088655324861d24e804b;hp=f6a6c4529df2376bc08f81a2adaf721d5516459d;hpb=40b654453c2ce0b266f43c36f1b9a5d1705f983c;p=dcpomatic.git diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index f6a6c4529..86f291fde 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -34,10 +34,10 @@ extern "C" { #include "exceptions.h" #include "image.h" #include "ffmpeg_content.h" +#include "safe_stringstream.h" #include "i18n.h" -using std::stringstream; using std::string; using std::list; using std::pair; @@ -83,7 +83,7 @@ FilterGraph::FilterGraph (shared_ptr content, dcp::Size s, throw DecodeError (N_("Could not create buffer sink filter")); } - stringstream a; + SafeStringStream a; a << "video_size=" << _size.width << "x" << _size.height << ":" << "pix_fmt=" << _pixel_format << ":" << "time_base=1/1:" @@ -117,7 +117,7 @@ FilterGraph::FilterGraph (shared_ptr content, dcp::Size s, inputs->pad_idx = 0; inputs->next = 0; - if (avfilter_graph_parse (graph, filters.c_str(), &inputs, &outputs, 0) < 0) { + if (avfilter_graph_parse (graph, filters.c_str(), inputs, outputs, 0) < 0) { throw DecodeError (N_("could not set up filter graph.")); } @@ -147,8 +147,9 @@ FilterGraph::process (AVFrame* frame) if (_copy) { images.push_back (make_pair (shared_ptr (new Image (frame)), av_frame_get_best_effort_timestamp (frame))); } else { - if (av_buffersrc_write_frame (_buffer_src_context, frame) < 0) { - throw DecodeError (N_("could not push buffer into filter chain.")); + int r = av_buffersrc_write_frame (_buffer_src_context, frame); + if (r < 0) { + throw DecodeError (String::compose (N_("could not push buffer into filter chain (%1)."), r)); } while (true) {