*/
+/** @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