]> git.sesse.net Git - casparcg/blob - modules/image/image.cpp
Fixed compilation problem on Linux.
[casparcg] / modules / image / image.cpp
1 /*
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Robert Nagy, ronag89@gmail.com
20 */
21
22 #include "image.h"
23
24 #include "producer/image_producer.h"
25 #include "producer/image_scroll_producer.h"
26 #include "consumer/image_consumer.h"
27 #include "util/image_loader.h"
28
29 #include <core/producer/frame_producer.h>
30 #include <core/consumer/frame_consumer.h>
31 #include <core/producer/media_info/media_info.h>
32 #include <core/producer/media_info/media_info_repository.h>
33 #include <core/frame/draw_frame.h>
34 #include <core/system_info_provider.h>
35
36 #include <common/utf.h>
37
38 #include <boost/property_tree/ptree.hpp>
39 #include <boost/algorithm/string/case_conv.hpp>
40
41 #include <FreeImage.h>
42
43 namespace caspar { namespace image {
44
45 std::wstring version()
46 {
47         return u16(FreeImage_GetVersion());
48 }
49
50 void init(core::module_dependencies dependencies)
51 {
52         FreeImage_Initialise();
53         dependencies.producer_registry->register_producer_factory(L"Image Scroll Producer", create_scroll_producer, describe_scroll_producer);
54         dependencies.producer_registry->register_producer_factory(L"Image Producer", create_producer, describe_producer);
55         dependencies.producer_registry->register_thumbnail_producer(create_thumbnail);
56         dependencies.consumer_registry->register_consumer_factory(L"Image Consumer", create_consumer, describe_consumer);
57         dependencies.media_info_repo->register_extractor([](const std::wstring& file, const std::wstring& extension, core::media_info& info)
58         {
59                 if (supported_extensions().find(boost::to_lower_copy(extension)) != supported_extensions().end())
60                 {
61                         info.clip_type = L"STILL";
62
63                         return true;
64                 }
65
66                 return false;
67         });
68         dependencies.system_info_provider_repo->register_system_info_provider([](boost::property_tree::wptree& info)
69         {
70                 info.add(L"system.freeimage", version());
71         });
72 }
73
74 void uninit()
75 {
76         FreeImage_DeInitialise();
77 }
78
79 }}