Use SafeStringStream instead of std::stringstream to try to fix random crashes on...
[dcpomatic.git] / src / lib / filter_graph.cc
index a3bb0093edb1e7a84896d8286b04840962f246d4..0d72eacdfd2311c2a793065078bf178ff4e86a15 100644 (file)
@@ -33,10 +33,11 @@ extern "C" {
 #include "filter.h"
 #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;
@@ -59,7 +60,7 @@ FilterGraph::FilterGraph (shared_ptr<const FFmpegContent> content, libdcp::Size
 {
        _frame = av_frame_alloc ();
        
-       string filters = Filter::ffmpeg_strings (content->filters()).first;
+       string filters = Filter::ffmpeg_string (content->filters());
        if (filters.empty ()) {
                filters = "copy";
        }
@@ -79,7 +80,7 @@ FilterGraph::FilterGraph (shared_ptr<const FFmpegContent> content, libdcp::Size
                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:"
@@ -141,7 +142,7 @@ FilterGraph::process (AVFrame* frame)
                throw DecodeError (N_("could not push buffer into filter chain."));
        }
 
-       while (1) {
+       while (true) {
                if (av_buffersink_get_frame (_buffer_sink_context, _frame) < 0) {
                        break;
                }