]> git.sesse.net Git - casparcg/blobdiff - modules/ffmpeg/producer/filter/filter.cpp
2.0.2: Updated file info headers.
[casparcg] / modules / ffmpeg / producer / filter / filter.cpp
index cb5ee7bec700f464a6fd7c3ad842ac0bde8c23b1..6006d5e72f2c691b5e68ca678d7e70fd3d47794e 100644 (file)
@@ -1,3 +1,24 @@
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Robert Nagy, ronag89@gmail.com\r
+*/\r
+\r
 #include "../../stdafx.h"\r
 \r
 #include "filter.h"\r
@@ -42,15 +63,11 @@ struct filter::implementation
        std::shared_ptr<void>                   parallel_yadif_ctx_;\r
        std::vector<PixelFormat>                pix_fmts_;\r
        std::queue<std::shared_ptr<AVFrame>> bypass_;\r
-       int                                                             in_format_;\r
-       bool                                                    warned_;\r
                \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
-               , in_format_(0)\r
-               , warned_(false)\r
        {\r
                if(pix_fmts_.empty())\r
                {\r
@@ -59,6 +76,7 @@ struct filter::implementation
                        pix_fmts_.push_back(PIX_FMT_YUV422P);\r
                        pix_fmts_.push_back(PIX_FMT_YUV420P);\r
                        pix_fmts_.push_back(PIX_FMT_YUV411P);\r
+                       pix_fmts_.push_back(PIX_FMT_BGRA);\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
@@ -91,7 +109,6 @@ struct filter::implementation
                        {\r
                                try\r
                                {\r
-                                       in_format_ = frame->format;\r
                                        graph_.reset(avfilter_graph_alloc(), [](AVFilterGraph* p){avfilter_graph_free(&p);});\r
                                                                \r
                                        // Input\r
@@ -191,24 +208,7 @@ struct filter::implementation
                                        frame->key_frame                        = picref->video->key_frame;\r
                                        frame->pict_type                        = picref->video->pict_type;\r
                                        frame->sample_aspect_ratio      = picref->video->sample_aspect_ratio;\r
-\r
-                                       // HACK: Workaround for missing format bug in libavfilter.\r
-                                       if(frame->format == 0)\r
-                                       {\r
-                                               if(in_format_ == PIX_FMT_YUV444P10)\r
-                                                       frame->format = PIX_FMT_YUV420P;//PIX_FMT_YUV444P;\r
-                                               else if(in_format_ == PIX_FMT_YUV422P10)\r
-                                                       frame->format = PIX_FMT_YUV420P;//PIX_FMT_YUV422P;\r
-                                               else\r
-                                                       BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("libavfilter bug: Mframe format == 0."));\r
-                                               \r
-                                               if(!warned_)\r
-                                               {\r
-                                                       CASPAR_LOG(warning) << "[ffmpeg] libavfilter bug workaround: frame format == 0, guessing PIX_FMT_YUV420P.";\r
-                                                       warned_ = true;\r
-                                               }\r
-                                       }\r
-\r
+                                       \r
                                        return frame;\r
                                }\r
                        }\r