]> git.sesse.net Git - casparcg/blobdiff - modules/image/image.cpp
Simplified thumbnail creation, making it less intrusive in the frame_producer design.
[casparcg] / modules / image / image.cpp
index dbc64c70b1aae917e4110bbd1cc9e4fe0fe7a1b7..a03b01e24a32f952160ddec93e3fe777b238a3a2 100644 (file)
@@ -1,49 +1,83 @@
-/*\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 "image.h"\r
-\r
-#include "producer/image_producer.h"\r
-#include "producer/image_scroll_producer.h"\r
-#include "consumer/image_consumer.h"\r
-\r
-#include <core/producer/frame_producer.h>\r
-#include <core/consumer/frame_consumer.h>\r
-\r
-#include <common/utility/string.h>\r
-\r
-#include <FreeImage.h>\r
-\r
-namespace caspar { namespace image {\r
-\r
-void init()\r
-{\r
-       core::register_producer_factory(create_scroll_producer);\r
-       core::register_producer_factory(create_producer);\r
-       core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_consumer(params);});\r
-}\r
-\r
-std::wstring get_version()\r
-{\r
-       return u16(FreeImage_GetVersion());\r
-}\r
-\r
-}}
\ No newline at end of file
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
+*
+* This file is part of CasparCG (www.casparcg.com).
+*
+* CasparCG is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* CasparCG is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
+*
+* Author: Robert Nagy, ronag89@gmail.com
+*/
+
+#include "image.h"
+
+#include "producer/image_producer.h"
+#include "producer/image_scroll_producer.h"
+#include "consumer/image_consumer.h"
+
+#include <core/producer/frame_producer.h>
+#include <core/consumer/frame_consumer.h>
+#include <core/producer/media_info/media_info.h>
+#include <core/producer/media_info/media_info_repository.h>
+#include <core/frame/draw_frame.h>
+#include <core/system_info_provider.h>
+
+#include <common/utf.h>
+
+#include <boost/property_tree/ptree.hpp>
+
+#include <FreeImage.h>
+
+namespace caspar { namespace image {
+
+std::wstring version()
+{
+       return u16(FreeImage_GetVersion());
+}
+
+void init(core::module_dependencies dependencies)
+{
+       FreeImage_Initialise();
+       dependencies.producer_registry->register_producer_factory(L"Image Scroll Producer", create_scroll_producer, describe_scroll_producer);
+       dependencies.producer_registry->register_producer_factory(L"Image Producer", create_producer, describe_producer);
+       dependencies.producer_registry->register_thumbnail_producer(create_thumbnail);
+       dependencies.consumer_registry->register_consumer_factory(L"Image Consumer", create_consumer, describe_consumer);
+       dependencies.media_info_repo->register_extractor([](const std::wstring& file, const std::wstring& extension, core::media_info& info)
+       {
+               if (extension == L".TGA"
+                       || extension == L".COL"
+                       || extension == L".PNG"
+                       || extension == L".JPEG"
+                       || extension == L".JPG"
+                       || extension == L".GIF"
+                       || extension == L".BMP")
+               {
+                       info.clip_type = L"STILL";
+
+                       return true;
+               }
+
+               return false;
+       });
+       dependencies.system_info_provider_repo->register_system_info_provider([](boost::property_tree::wptree& info)
+       {
+               info.add(L"system.freeimage", version());
+       });
+}
+
+void uninit()
+{
+       FreeImage_DeInitialise();
+}
+
+}}