\r
namespace caspar {\r
\r
-PixelFormat pix_fmts[] = \r
-{\r
- PIX_FMT_YUV420P,\r
- PIX_FMT_YUVA420P,\r
- PIX_FMT_YUV422P,\r
- PIX_FMT_YUV444P,\r
- PIX_FMT_YUV411P,\r
- PIX_FMT_ARGB, \r
- PIX_FMT_RGBA,\r
- PIX_FMT_ABGR,\r
- PIX_FMT_GRAY8,\r
- PIX_FMT_NONE\r
-}; \r
-\r
struct filter::implementation\r
{\r
std::string filters_;\r
AVFilterContext* buffersink_ctx_;\r
AVFilterContext* buffersrc_ctx_;\r
std::shared_ptr<void> parallel_yadif_ctx_;\r
+ std::vector<PixelFormat> pix_fmts_;\r
\r
- implementation(const std::wstring& filters) \r
+ implementation(const std::wstring& filters, const std::vector<PixelFormat>& pix_fmts) \r
: filters_(narrow(filters))\r
, parallel_yadif_ctx_(nullptr)\r
+ , pix_fmts_(pix_fmts)\r
{\r
+ if(pix_fmts_.empty())\r
+ {\r
+ pix_fmts_.push_back(PIX_FMT_YUV420P);\r
+ pix_fmts_.push_back(PIX_FMT_YUVA420P);\r
+ pix_fmts_.push_back(PIX_FMT_YUV422P);\r
+ pix_fmts_.push_back(PIX_FMT_YUV444P);\r
+ pix_fmts_.push_back(PIX_FMT_YUV411P);\r
+ pix_fmts_.push_back(PIX_FMT_ARGB);\r
+ pix_fmts_.push_back(PIX_FMT_RGBA);\r
+ pix_fmts_.push_back(PIX_FMT_ABGR);\r
+ pix_fmts_.push_back(PIX_FMT_GRAY8);\r
+ pix_fmts_.push_back(PIX_FMT_NONE);\r
+ }\r
+ else\r
+ pix_fmts_.push_back(PIX_FMT_NONE);\r
+\r
std::transform(filters_.begin(), filters_.end(), filters_.begin(), ::tolower);\r
}\r
\r
THROW_ON_ERROR2(avfilter_graph_create_filter(&buffersrc_ctx_, avfilter_get_by_name("buffer"), "src", args.str().c_str(), NULL, graph_.get()), "[filter]");\r
\r
// OPIX_FMT_BGRAutput\r
- THROW_ON_ERROR2(avfilter_graph_create_filter(&buffersink_ctx_, avfilter_get_by_name("buffersink"), "out", NULL, pix_fmts, graph_.get()), "[filter]");\r
+ THROW_ON_ERROR2(avfilter_graph_create_filter(&buffersink_ctx_, avfilter_get_by_name("buffersink"), "out", NULL, pix_fmts_.data(), graph_.get()), "[filter]");\r
\r
AVFilterInOut* outputs = avfilter_inout_alloc();\r
AVFilterInOut* inputs = avfilter_inout_alloc();\r
}\r
};\r
\r
-filter::filter(const std::wstring& filters) : impl_(new implementation(filters)){}\r
+filter::filter(const std::wstring& filters, const std::vector<PixelFormat>& pix_fmts) : impl_(new implementation(filters, pix_fmts)){}\r
filter::filter(filter&& other) : impl_(std::move(other.impl_)){}\r
filter& filter::operator=(filter&& other){impl_ = std::move(other.impl_); return *this;}\r
std::vector<safe_ptr<AVFrame>> filter::execute(const std::shared_ptr<AVFrame>& frame) {return impl_->execute(frame);}\r