]> git.sesse.net Git - casparcg/blob - modules/ffmpeg/producer/filter/filter.h
2.0.2: MAYOR CHANGES => needs testing
[casparcg] / modules / ffmpeg / producer / filter / filter.h
1 #pragma once\r
2 \r
3 #include <common/memory/safe_ptr.h>\r
4 \r
5 #include <boost/noncopyable.hpp>\r
6 #include <boost/algorithm/string/case_conv.hpp>\r
7 \r
8 #include <string>\r
9 #include <vector>\r
10 \r
11 struct AVFrame;\r
12 enum PixelFormat;\r
13 \r
14 namespace caspar { namespace ffmpeg {\r
15                 \r
16 static bool is_double_rate(const std::wstring& filters)\r
17 {\r
18         if(boost::to_upper_copy(filters).find(L"YADIF=1") != std::string::npos)\r
19                 return true;\r
20         \r
21         if(boost::to_upper_copy(filters).find(L"YADIF=3") != std::string::npos)\r
22                 return true;\r
23 \r
24         return false;\r
25 }\r
26 \r
27 static bool is_deinterlacing(const std::wstring& filters)\r
28 {\r
29         if(boost::to_upper_copy(filters).find(L"YADIF") != std::string::npos)\r
30                 return true;    \r
31         return false;\r
32 }\r
33 \r
34 static std::wstring append_filter(const std::wstring& filters, const std::wstring& filter)\r
35 {\r
36         return filters + (filters.empty() ? L"" : L",") + filter;\r
37 }\r
38 \r
39 class filter : boost::noncopyable\r
40 {\r
41 public:\r
42         filter(const std::wstring& filters = L"", const std::vector<PixelFormat>& pix_fmts = std::vector<PixelFormat>());\r
43         filter(filter&& other);\r
44         filter& operator=(filter&& other);\r
45 \r
46         void push(const std::shared_ptr<AVFrame>& frame);\r
47         std::shared_ptr<AVFrame> poll();\r
48         std::vector<safe_ptr<AVFrame>> poll_all();\r
49 \r
50         std::string filter_str() const;\r
51         \r
52 private:\r
53         struct implementation;\r
54         safe_ptr<implementation> impl_;\r
55 };\r
56 \r
57 }}