Merge branch 'master' of ssh://houllier/home/carl/git/dvdomatic
[dcpomatic.git] / src / lib / filter_graph.h
index 4ff10dece1a3dfe996076110dc3c41231eec1344..2138943e42b6e3e6ef11ba4967f0c85f0755d618 100644 (file)
 
 */
 
+/** @file src/lib/filter_graph.h
+ *  @brief A graph of FFmpeg filters.
+ */
+
 #ifndef DVDOMATIC_FILTER_GRAPH_H
 #define DVDOMATIC_FILTER_GRAPH_H
 
 #include "util.h"
 
-class Decoder;
 class Image;
-class Film;
+class VideoFilter;
+class FFmpegDecoder;
 
 class FilterGraph
 {
 public:
-       FilterGraph (boost::shared_ptr<Film> film, Decoder* decoder, bool crop, Size s, AVPixelFormat p);
+       virtual bool can_process (libdcp::Size, AVPixelFormat) const = 0;
+       virtual std::list<boost::shared_ptr<Image> > process (AVFrame *) = 0;
+};
+
+class EmptyFilterGraph : public FilterGraph
+{
+public:
+       bool can_process (libdcp::Size, AVPixelFormat) const {
+               return true;
+       }
 
-       bool can_process (Size s, AVPixelFormat p) const;
-       std::list<boost::shared_ptr<Image> > process (AVFrame const * frame);
+       std::list<boost::shared_ptr<Image> > process (AVFrame *);
+};
+
+/** @class FFmpegFilterGraph
+ *  @brief A graph of FFmpeg filters.
+ */
+class FFmpegFilterGraph : public FilterGraph
+{
+public:
+       FFmpegFilterGraph (boost::shared_ptr<Film> film, FFmpegDecoder* decoder, libdcp::Size s, AVPixelFormat p);
+       ~FFmpegFilterGraph ();
+
+       bool can_process (libdcp::Size s, AVPixelFormat p) const;
+       std::list<boost::shared_ptr<Image> > process (AVFrame * frame);
 
 private:
        AVFilterContext* _buffer_src_context;
        AVFilterContext* _buffer_sink_context;
-       Size _size;
-       AVPixelFormat _pixel_format;
+       libdcp::Size _size; ///< size of the images that this chain can process
+       AVPixelFormat _pixel_format; ///< pixel format of the images that this chain can process
+       AVFrame* _frame;
 };
 
+boost::shared_ptr<FilterGraph> filter_graph_factory (boost::shared_ptr<Film>, FFmpegDecoder *, libdcp::Size, AVPixelFormat);
+
 #endif