]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 20 Jun 2011 21:21:00 +0000 (21:21 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 20 Jun 2011 21:21:00 +0000 (21:21 +0000)
core/mixer/image/image_mixer.cpp
core/mixer/image/image_mixer.h
core/mixer/mixer.cpp
core/mixer/mixer.h
core/producer/frame/frame_factory.h
modules/bluefish/bluefish.cpp
modules/ffmpeg/producer/util.h
modules/ffmpeg/util/filter.cpp [deleted file]
modules/ffmpeg/util/filter.h [deleted file]
modules/ffmpeg/util/util.h [deleted file]
shell/casparcg.config

index 9a5edc8805ff43b3c026917ce544da0410a73ec0..8cfc85a951282ffd7394746c6a3f8da1e3c12fdc 100644 (file)
@@ -243,7 +243,7 @@ public:
                local_key_ = stream.back().transform.get_is_key(); // Keep for next layer if last frame is key\r
        }\r
                        \r
-       safe_ptr<write_frame> create_frame(void* tag, const core::pixel_format_desc& desc)\r
+       safe_ptr<write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc)\r
        {\r
                return make_safe<write_frame>(channel_.ogl(), reinterpret_cast<int>(tag), desc);\r
        }\r
@@ -254,7 +254,7 @@ void image_mixer::begin(const core::basic_frame& frame){impl_->begin(frame);}
 void image_mixer::visit(core::write_frame& frame){impl_->visit(frame);}\r
 void image_mixer::end(){impl_->end();}\r
 safe_ptr<host_buffer> image_mixer::render(){return impl_->render();}\r
-safe_ptr<write_frame> image_mixer::create_frame(void* tag, const core::pixel_format_desc& desc){return impl_->create_frame(tag, desc);}\r
+safe_ptr<write_frame> image_mixer::create_frame(const void* tag, const core::pixel_format_desc& desc){return impl_->create_frame(tag, desc);}\r
 void image_mixer::begin_layer(){impl_->begin_layer();}\r
 void image_mixer::end_layer(){impl_->end_layer();}\r
 image_mixer& image_mixer::operator=(image_mixer&& other)\r
index b8c337389e75c99c4237b49f8674f95ff87d6608..927097ceca617730a68aa66b7ed60de2a78bd588 100644 (file)
@@ -48,7 +48,7 @@ public:
        \r
        safe_ptr<host_buffer> render();\r
 \r
-       safe_ptr<write_frame> create_frame(void* tag, const core::pixel_format_desc& format);\r
+       safe_ptr<write_frame> create_frame(const void* tag, const core::pixel_format_desc& format);\r
 \r
 private:\r
        struct implementation;\r
index f56f98f25c11024386e30d193f52c319c5a0b2d7..749bf040e9612aca8ee92344d7ae2e589e94e0d5 100644 (file)
@@ -127,7 +127,7 @@ public:
                }\r
        }\r
                        \r
-       safe_ptr<core::write_frame> create_frame(void* tag, const core::pixel_format_desc& desc)\r
+       safe_ptr<core::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc)\r
        {               \r
                return image_mixer_.create_frame(tag, desc);\r
        }\r
@@ -259,8 +259,8 @@ private:
 mixer::mixer(video_channel_context& video_channel) : impl_(new implementation(video_channel)){}\r
 safe_ptr<core::read_frame> mixer::execute(const std::map<int, safe_ptr<core::basic_frame>>& frames){ return impl_->execute(frames);}\r
 core::video_format_desc mixer::get_video_format_desc() const { return impl_->channel_.get_format_desc(); }\r
-safe_ptr<core::write_frame> mixer::create_frame(void* tag, const core::pixel_format_desc& desc){ return impl_->create_frame(tag, desc); }              \r
-safe_ptr<core::write_frame> mixer::create_frame(void* tag, size_t width, size_t height, core::pixel_format::type pix_fmt)\r
+safe_ptr<core::write_frame> mixer::create_frame(const void* tag, const core::pixel_format_desc& desc){ return impl_->create_frame(tag, desc); }                \r
+safe_ptr<core::write_frame> mixer::create_frame(const void* tag, size_t width, size_t height, core::pixel_format::type pix_fmt)\r
 {\r
        // Create bgra frame\r
        core::pixel_format_desc desc;\r
index 317a6f17e70d476f9a12b92ac41dfddefdb11dfc..3958a36bae6f5894f34b73e3a68940562f88d771 100644 (file)
@@ -46,8 +46,8 @@ public:
                \r
        safe_ptr<core::read_frame> execute(const std::map<int, safe_ptr<core::basic_frame>>& frames); // nothrow\r
                \r
-       safe_ptr<core::write_frame> create_frame(void* tag, const core::pixel_format_desc& desc);               \r
-       safe_ptr<core::write_frame> create_frame(void* tag, size_t width, size_t height, core::pixel_format::type pix_fmt = core::pixel_format::bgra);          \r
+       safe_ptr<core::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc);         \r
+       safe_ptr<core::write_frame> create_frame(const void* tag, size_t width, size_t height, core::pixel_format::type pix_fmt = core::pixel_format::bgra);            \r
        \r
        core::video_format_desc get_video_format_desc() const; // nothrow\r
 \r
index 30e7bcfc9c20d2143046e833ed9141edec80f6f2..c8880155bec68e11e00f843754c440a9f4ee8bb4 100644 (file)
@@ -33,8 +33,8 @@ struct video_format_desc;
                \r
 struct frame_factory : boost::noncopyable\r
 {\r
-       virtual safe_ptr<write_frame> create_frame(void* video_stream_tag, const pixel_format_desc& desc) = 0;\r
-       virtual safe_ptr<write_frame> create_frame(void* video_stream_tag, size_t width, size_t height, pixel_format::type pix_fmt = pixel_format::bgra) = 0;           \r
+       virtual safe_ptr<write_frame> create_frame(const void* video_stream_tag, const pixel_format_desc& desc) = 0;\r
+       virtual safe_ptr<write_frame> create_frame(const void* video_stream_tag, size_t width, size_t height, pixel_format::type pix_fmt = pixel_format::bgra) = 0;             \r
        \r
        virtual video_format_desc get_video_format_desc() const = 0; // nothrow\r
 };\r
index b9b027c44e23fab7e0e2086b6ff1ec3b34f3c975..8cd7bf9a991e4422cbea8d230108fa0202a48b50 100644 (file)
@@ -39,7 +39,7 @@ void init_bluefish()
        }\r
        catch(...)\r
        {\r
-               CASPAR_LOG_CURRENT_EXCEPTION();\r
+               //CASPAR_LOG_CURRENT_EXCEPTION();\r
                CASPAR_LOG(info) << L"Bluefish not supported.";\r
        }\r
 }\r
index ddad50c3175569275871ba8ed0b40179e5fe81f3..b7d478d1b871934c05b8c0b252c34cb628b65de7 100644 (file)
@@ -88,11 +88,10 @@ static core::pixel_format_desc get_pixel_format_desc(PixelFormat pix_fmt, size_t
        }\r
 }\r
 \r
-safe_ptr<core::write_frame> make_write_frame(const void* tag, const safe_ptr<AVFrame>& decoded_frame, const safe_ptr<core::frame_factory>& frame_factory)\r
+static safe_ptr<core::write_frame> make_write_frame(const void* tag, const safe_ptr<AVFrame>& decoded_frame, const safe_ptr<core::frame_factory>& frame_factory)\r
 {                      \r
        static tbb::concurrent_unordered_map<size_t, tbb::concurrent_queue<std::shared_ptr<SwsContext>>> sws_contexts_;\r
 \r
-       // We don't know what the filter output might give until we received the first frame. Initialize everything on first frame.\r
        auto width   = decoded_frame->width;\r
        auto height  = decoded_frame->height;\r
        auto pix_fmt = static_cast<PixelFormat>(decoded_frame->format);\r
@@ -153,7 +152,7 @@ safe_ptr<core::write_frame> make_write_frame(const void* tag, const safe_ptr<AVF
                });\r
        }\r
                \r
-       // Fix field-order if needed. DVVIDEO is in lower field. Make it upper field if needed.\r
+       // Fix field-order if needed\r
        if(decoded_frame->interlaced_frame)\r
        {\r
                switch(frame_factory->get_video_format_desc().mode)\r
diff --git a/modules/ffmpeg/util/filter.cpp b/modules/ffmpeg/util/filter.cpp
deleted file mode 100644 (file)
index 90d49f9..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-#include "../stdafx.h"\r
-\r
-#include "filter.h"\r
-\r
-#include "../ffmpeg_error.h"\r
-#include "util.h"\r
-\r
-#include <common/exception/exceptions.h>\r
-#include <core/producer/frame/basic_frame.h>\r
-#include <core/producer/frame/frame_factory.h>\r
-#include <core/mixer/write_frame.h>\r
-\r
-#include <boost/circular_buffer.hpp>\r
-\r
-#include <cstdio>\r
-#include <sstream>\r
-\r
-extern "C" \r
-{\r
-       #define __STDC_CONSTANT_MACROS\r
-       #define __STDC_LIMIT_MACROS\r
-       #include <libavutil/avutil.h>\r
-       #include <libavutil/imgutils.h>\r
-       #include <libavfilter/avfilter.h>\r
-       #include <libavfilter/avcodec.h>\r
-       #include <libavfilter/vsrc_buffer.h>\r
-       #include <libavfilter/avfiltergraph.h>\r
-}\r
-\r
-namespace caspar {\r
-       \r
-struct filter::implementation\r
-{\r
-       std::string                                                             filters_;\r
-       std::shared_ptr<AVFilterGraph>                  graph_;\r
-       AVFilterContext*                                                video_in_filter_;\r
-       AVFilterContext*                                                video_out_filter_;\r
-\r
-       boost::circular_buffer<std::shared_ptr<AVFilterBufferRef>> buffers_;\r
-               \r
-       implementation(const std::string& filters) \r
-               : filters_(filters)\r
-       {\r
-               std::transform(filters_.begin(), filters_.end(), filters_.begin(), ::tolower);\r
-\r
-               buffers_.set_capacity(3);\r
-       }\r
-\r
-       std::vector<safe_ptr<AVFrame>> execute(const safe_ptr<AVFrame>& frame)\r
-       {               \r
-               int errn = 0;   \r
-\r
-               if(!graph_)\r
-               {\r
-                       graph_.reset(avfilter_graph_alloc(), [](AVFilterGraph* p){avfilter_graph_free(&p);});\r
-                       \r
-                       // Input\r
-                       std::stringstream buffer_ss;\r
-                       buffer_ss << frame->width << ":" << frame->height << ":" << frame->format << ":" << 0 << ":" << 0 << ":" << 0 << ":" << 0; // don't care about pts and aspect_ratio\r
-                       errn = avfilter_graph_create_filter(&video_in_filter_, avfilter_get_by_name("buffer"), "src", buffer_ss.str().c_str(), NULL, graph_.get());\r
-                       if(errn < 0 || !video_in_filter_)\r
-                       {\r
-                               BOOST_THROW_EXCEPTION(caspar_exception() <<     msg_info(av_error_str(errn)) <<\r
-                                       boost::errinfo_api_function("avfilter_graph_create_filter") <<  boost::errinfo_errno(AVUNERROR(errn)));\r
-                       }\r
-\r
-                       // Output\r
-                       errn = avfilter_graph_create_filter(&video_out_filter_, avfilter_get_by_name("nullsink"), "out", NULL, NULL, graph_.get());\r
-                       if(errn < 0 || !video_out_filter_)\r
-                       {\r
-                               BOOST_THROW_EXCEPTION(caspar_exception() <<     msg_info(av_error_str(errn)) <<\r
-                                       boost::errinfo_api_function("avfilter_graph_create_filter") << boost::errinfo_errno(AVUNERROR(errn)));\r
-                       }\r
-                       \r
-                       AVFilterInOut* outputs = reinterpret_cast<AVFilterInOut*>(av_malloc(sizeof(AVFilterInOut)));\r
-                       AVFilterInOut* inputs  = reinterpret_cast<AVFilterInOut*>(av_malloc(sizeof(AVFilterInOut)));\r
-\r
-                       outputs->name                   = av_strdup("in");\r
-                       outputs->filter_ctx             = video_in_filter_;\r
-                       outputs->pad_idx                = 0;\r
-                       outputs->next                   = NULL;\r
-\r
-                       inputs->name                    = av_strdup("out");\r
-                       inputs->filter_ctx              = video_out_filter_;\r
-                       inputs->pad_idx                 = 0;\r
-                       inputs->next                    = NULL;\r
-                       \r
-                       errn = avfilter_graph_parse(graph_.get(), filters_.c_str(), inputs, outputs, NULL);\r
-                       if(errn < 0)\r
-                       {\r
-                               BOOST_THROW_EXCEPTION(caspar_exception() <<     msg_info(av_error_str(errn)) <<\r
-                                       boost::errinfo_api_function("avfilter_graph_parse") << boost::errinfo_errno(AVUNERROR(errn)));\r
-                       }\r
-\r
-//                     av_free(outputs);\r
-//                     av_free(inputs);\r
-\r
-                       errn = avfilter_graph_config(graph_.get(), NULL);\r
-                       if(errn < 0)\r
-                       {\r
-                               BOOST_THROW_EXCEPTION(caspar_exception() <<     msg_info(av_error_str(errn)) \r
-                                       <<      boost::errinfo_api_function("avfilter_graph_config") << boost::errinfo_errno(AVUNERROR(errn)));\r
-                       }\r
-               }\r
-       \r
-               errn = av_vsrc_buffer_add_frame(video_in_filter_, frame.get(), AV_VSRC_BUF_FLAG_OVERWRITE);\r
-               if(errn < 0)\r
-               {\r
-                       BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(av_error_str(errn)) <<\r
-                               boost::errinfo_api_function("av_vsrc_buffer_add_frame") << boost::errinfo_errno(AVUNERROR(errn)));\r
-               }\r
-\r
-               errn = avfilter_poll_frame(video_out_filter_->inputs[0]);\r
-               if(errn < 0)\r
-               {\r
-                       BOOST_THROW_EXCEPTION(caspar_exception() <<     msg_info(av_error_str(errn)) <<\r
-                               boost::errinfo_api_function("avfilter_poll_frame") << boost::errinfo_errno(AVUNERROR(errn)));\r
-               }\r
-\r
-               std::vector<safe_ptr<AVFrame>> result;\r
-\r
-               std::generate_n(std::back_inserter(result), errn, [&]{return get_frame();});\r
-\r
-               return result;\r
-       }\r
-               \r
-       safe_ptr<AVFrame> get_frame()\r
-       {               \r
-               auto link = video_out_filter_->inputs[0];\r
-\r
-               CASPAR_ASSERT(link);\r
-\r
-               int errn = avfilter_request_frame(link);                        \r
-               if(errn < 0)\r
-               {\r
-                       BOOST_THROW_EXCEPTION(caspar_exception() <<     msg_info(av_error_str(errn)) <<\r
-                               boost::errinfo_api_function("avfilter_request_frame") << boost::errinfo_errno(AVUNERROR(errn)));\r
-               }\r
-               \r
-               auto pic = reinterpret_cast<AVPicture*>(link->cur_buf->buf);\r
-               \r
-               safe_ptr<AVFrame> frame(avcodec_alloc_frame(), av_free);\r
-               avcodec_get_frame_defaults(frame.get());        \r
-\r
-               for(size_t n = 0; n < 4; ++n)\r
-               {\r
-                       frame->data[n]          = pic->data[n];\r
-                       frame->linesize[n]      = pic->linesize[n];\r
-               }\r
-\r
-               // FIXME\r
-               frame->width                    = link->cur_buf->video->w;\r
-               frame->height                   = link->cur_buf->video->h;\r
-               frame->format                   = link->cur_buf->format;\r
-               frame->interlaced_frame = link->cur_buf->video->interlaced;\r
-               frame->top_field_first  = link->cur_buf->video->top_field_first;\r
-               frame->key_frame                = link->cur_buf->video->key_frame;\r
-\r
-               buffers_.push_back(std::shared_ptr<AVFilterBufferRef>(link->cur_buf, avfilter_unref_buffer));\r
-\r
-               return frame;\r
-       }\r
-};\r
-\r
-filter::filter(const std::string& filters) : impl_(new implementation(filters)){}\r
-std::vector<safe_ptr<AVFrame>> filter::execute(const safe_ptr<AVFrame>& frame) {return impl_->execute(frame);}\r
-\r
-}
\ No newline at end of file
diff --git a/modules/ffmpeg/util/filter.h b/modules/ffmpeg/util/filter.h
deleted file mode 100644 (file)
index c964f48..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once\r
-\r
-#include <common/memory/safe_ptr.h>\r
-\r
-#include <vector>\r
-\r
-struct AVFrame;\r
-\r
-namespace caspar {\r
-               \r
-class filter\r
-{\r
-public:\r
-       filter(const std::string& filters);\r
-\r
-       std::vector<safe_ptr<AVFrame>> execute(const safe_ptr<AVFrame>& frame);\r
-\r
-private:\r
-       struct implementation;\r
-       safe_ptr<implementation> impl_;\r
-};\r
-\r
-}
\ No newline at end of file
diff --git a/modules/ffmpeg/util/util.h b/modules/ffmpeg/util/util.h
deleted file mode 100644 (file)
index d24a5f1..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#pragma once\r
-\r
-#include <core/video_format.h>\r
-#include <core/producer/frame/pixel_format.h>\r
-\r
-namespace caspar {\r
-       \r
-static core::pixel_format::type get_pixel_format(PixelFormat pix_fmt)\r
-{\r
-       switch(pix_fmt)\r
-       {\r
-       case PIX_FMT_GRAY8:             return core::pixel_format::gray;\r
-       case PIX_FMT_BGRA:              return core::pixel_format::bgra;\r
-       case PIX_FMT_ARGB:              return core::pixel_format::argb;\r
-       case PIX_FMT_RGBA:              return core::pixel_format::rgba;\r
-       case PIX_FMT_ABGR:              return core::pixel_format::abgr;\r
-       case PIX_FMT_YUV444P:   return core::pixel_format::ycbcr;\r
-       case PIX_FMT_YUV422P:   return core::pixel_format::ycbcr;\r
-       case PIX_FMT_YUV420P:   return core::pixel_format::ycbcr;\r
-       case PIX_FMT_YUV411P:   return core::pixel_format::ycbcr;\r
-       case PIX_FMT_YUV410P:   return core::pixel_format::ycbcr;\r
-       case PIX_FMT_YUVA420P:  return core::pixel_format::ycbcra;\r
-       default:                                return core::pixel_format::invalid;\r
-       }\r
-}\r
-\r
-static core::pixel_format_desc get_pixel_format_desc(PixelFormat pix_fmt, size_t width, size_t height)\r
-{\r
-       // Get linesizes\r
-       AVPicture dummy_pict;   \r
-       avpicture_fill(&dummy_pict, nullptr, pix_fmt, width, height);\r
-\r
-       core::pixel_format_desc desc;\r
-       desc.pix_fmt = get_pixel_format(pix_fmt);\r
-               \r
-       switch(desc.pix_fmt)\r
-       {\r
-       case core::pixel_format::gray:\r
-               {\r
-                       desc.planes.push_back(core::pixel_format_desc::plane(dummy_pict.linesize[0]/4, height, 1));                                             \r
-                       return desc;\r
-               }\r
-       case core::pixel_format::bgra:\r
-       case core::pixel_format::argb:\r
-       case core::pixel_format::rgba:\r
-       case core::pixel_format::abgr:\r
-               {\r
-                       desc.planes.push_back(core::pixel_format_desc::plane(dummy_pict.linesize[0]/4, height, 4));                                             \r
-                       return desc;\r
-               }\r
-       case core::pixel_format::ycbcr:\r
-       case core::pixel_format::ycbcra:\r
-               {               \r
-                       // Find chroma height\r
-                       size_t size2 = dummy_pict.data[2] - dummy_pict.data[1];\r
-                       size_t h2 = size2/dummy_pict.linesize[1];                       \r
-\r
-                       desc.planes.push_back(core::pixel_format_desc::plane(dummy_pict.linesize[0], height, 1));\r
-                       desc.planes.push_back(core::pixel_format_desc::plane(dummy_pict.linesize[1], h2, 1));\r
-                       desc.planes.push_back(core::pixel_format_desc::plane(dummy_pict.linesize[2], h2, 1));\r
-\r
-                       if(desc.pix_fmt == core::pixel_format::ycbcra)                                          \r
-                               desc.planes.push_back(core::pixel_format_desc::plane(dummy_pict.linesize[3], height, 1));       \r
-                       return desc;\r
-               }               \r
-       default:                \r
-               desc.pix_fmt = core::pixel_format::invalid;\r
-               return desc;\r
-       }\r
-}\r
-\r
-}
\ No newline at end of file
index 8438d3a96fa24e99f3f903f6f0066d39ea9127ae..d19572fc34148822e66cbfcf22b6358924189f8e 100644 (file)
@@ -12,7 +12,7 @@
   </diagnostics>\r
   <channels>\r
     <channel>\r
-      <video-mode>1080i5000</video-mode>\r
+      <video-mode>PAL</video-mode>\r
       <consumers>\r
         <screen>                      \r
         </screen>\r