Try to tidy up frame indexing; use DCP length obtained from the transcode to make...
[dcpomatic.git] / src / lib / filter_graph.cc
index 7320070fe6f4c69b18e0247fff28dc7105ff5443..86864a762295c93c4d22085570d45feb5b7f6640 100644 (file)
@@ -23,7 +23,9 @@
 
 extern "C" {
 #include <libavfilter/avfiltergraph.h>
+#ifdef HAVE_BUFFERSRC_H        
 #include <libavfilter/buffersrc.h>
+#endif 
 #if (LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR >= 53 && LIBAVFILTER_VERSION_MINOR <= 77) || LIBAVFILTER_VERSION_MAJOR == 3
 #include <libavfilter/avcodec.h>
 #include <libavfilter/buffersink.h>
@@ -45,15 +47,15 @@ using std::stringstream;
 using std::string;
 using std::list;
 using boost::shared_ptr;
+using libdcp::Size;
 
 /** Construct a FilterGraph for the settings in a film.
  *  @param film Film.
  *  @param decoder Decoder that we are using.
- *  @param crop true to apply crop, otherwise false.
  *  @param s Size of the images to process.
  *  @param p Pixel format of the images to process.
  */
-FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, bool crop, Size s, AVPixelFormat p)
+FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, Size s, AVPixelFormat p)
        : _buffer_src_context (0)
        , _buffer_sink_context (0)
        , _size (s)
@@ -64,11 +66,7 @@ FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, bool cr
                filters += ",";
        }
 
-       if (crop) {
-               filters += crop_string (Position (film->crop().left, film->crop().top), film->cropped_size (decoder->native_size()));
-       } else {
-               filters += crop_string (Position (0, 0), decoder->native_size());
-       }
+       filters += crop_string (Position (film->crop().left, film->crop().top), film->cropped_size (decoder->native_size()));
 
        avfilter_register_all ();