]> git.sesse.net Git - casparcg/blobdiff - modules/ffmpeg/producer/filter/filter.h
[ffmpeg] Ported 2.0.7 ffmpeg producer to 2.1.0 while still keeping the usage of the...
[casparcg] / modules / ffmpeg / producer / filter / filter.h
index ecac5e7a921d81b2ab7fbb719230504b032455dc..86cdba98f5c0ee3b535d02fea75fd570983d78db 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
+* Copyright 2013 Sveriges Television AB http://casparcg.com/
 *
 * This file is part of CasparCG (www.casparcg.com).
 *
 
 #include <common/memory.h>
 
+#include <boost/rational.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/algorithm/string/case_conv.hpp>
 
 #include <string>
 #include <vector>
 
+#if defined(_MSC_VER)
+#pragma warning (push)
+#pragma warning (disable : 4244)
+#endif
+extern "C"
+{
+#include <libavutil/pixfmt.h>
+}
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 struct AVFrame;
-enum PixelFormat;
 
 namespace caspar { namespace ffmpeg {
 
@@ -39,10 +51,24 @@ static std::wstring append_filter(const std::wstring& filters, const std::wstrin
        return filters + (filters.empty() ? L"" : L",") + filter;
 }
 
+static std::wstring prepend_filter(const std::wstring& filters, const std::wstring& filter)
+{
+       return filter + (filters.empty() ? L"" : L",") + filters;
+}
+
 class filter : boost::noncopyable
 {
 public:
-       filter(const std::wstring& filters = L"", const std::vector<PixelFormat>& pix_fmts = std::vector<PixelFormat>());
+       filter(
+               int in_width,
+               int in_height,
+               boost::rational<int> in_time_base,
+               boost::rational<int> in_frame_rate,
+               boost::rational<int> in_sample_aspect_ratio,
+               AVPixelFormat in_pix_fmt,
+               std::vector<AVPixelFormat> out_pix_fmts,
+               const std::string& filtergraph,
+               bool multithreaded = true);
        filter(filter&& other);
        filter& operator=(filter&& other);
 
@@ -54,10 +80,13 @@ public:
                        
        static bool is_double_rate(const std::wstring& filters)
        {
-               if(boost::to_upper_copy(filters).find(L"YADIF=1") != std::string::npos)
+               if (boost::to_upper_copy(filters).find(L"YADIF=1") != std::string::npos)
                        return true;
-       
-               if(boost::to_upper_copy(filters).find(L"YADIF=3") != std::string::npos)
+
+               if (boost::to_upper_copy(filters).find(L"YADIF=3") != std::string::npos)
+                       return true;
+
+               if (boost::to_upper_copy(filters).find(L"SEPARATEFIELDS") != std::string::npos)
                        return true;
 
                return false;
@@ -65,20 +94,14 @@ public:
 
        static bool is_deinterlacing(const std::wstring& filters)
        {
-               if(boost::to_upper_copy(filters).find(L"YADIF") != std::string::npos)
-                       return true;    
+               if (boost::to_upper_copy(filters).find(L"YADIF") != std::string::npos)
+                       return true;
+
+               if (boost::to_upper_copy(filters).find(L"SEPARATEFIELDS") != std::string::npos)
+                       return true;
+
                return false;
        }       
-       
-       static int delay(const std::wstring& filters)
-       {
-               return is_double_rate(filters) ? 1 : 0;
-       }
-
-       int delay() const
-       {
-               return delay(filter_str());
-       }
 
        bool is_double_rate() const
        {
@@ -90,8 +113,8 @@ public:
                return is_deinterlacing(filter_str());
        }
 private:
-       struct impl;
-       spl::shared_ptr<impl> impl_;
+       struct implementation;
+       spl::shared_ptr<implementation> impl_;
 };
 
-}}
\ No newline at end of file
+}}