]> git.sesse.net Git - casparcg/blob - modules/image/image.cpp
Simplified thumbnail creation, making it less intrusive in the frame_producer design.
[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
28 #include <core/producer/frame_producer.h>
29 #include <core/consumer/frame_consumer.h>
30 #include <core/producer/media_info/media_info.h>
31 #include <core/producer/media_info/media_info_repository.h>
32 #include <core/frame/draw_frame.h>
33 #include <core/system_info_provider.h>
34
35 #include <common/utf.h>
36
37 #include <boost/property_tree/ptree.hpp>
38
39 #include <FreeImage.h>
40
41 namespace caspar { namespace image {
42
43 std::wstring version()
44 {
45         return u16(FreeImage_GetVersion());
46 }
47
48 void init(core::module_dependencies dependencies)
49 {
50         FreeImage_Initialise();
51         dependencies.producer_registry->register_producer_factory(L"Image Scroll Producer", create_scroll_producer, describe_scroll_producer);
52         dependencies.producer_registry->register_producer_factory(L"Image Producer", create_producer, describe_producer);
53         dependencies.producer_registry->register_thumbnail_producer(create_thumbnail);
54         dependencies.consumer_registry->register_consumer_factory(L"Image Consumer", create_consumer, describe_consumer);
55         dependencies.media_info_repo->register_extractor([](const std::wstring& file, const std::wstring& extension, core::media_info& info)
56         {
57                 if (extension == L".TGA"
58                         || extension == L".COL"
59                         || extension == L".PNG"
60                         || extension == L".JPEG"
61                         || extension == L".JPG"
62                         || extension == L".GIF"
63                         || extension == L".BMP")
64                 {
65                         info.clip_type = L"STILL";
66
67                         return true;
68                 }
69
70                 return false;
71         });
72         dependencies.system_info_provider_repo->register_system_info_provider([](boost::property_tree::wptree& info)
73         {
74                 info.add(L"system.freeimage", version());
75         });
76 }
77
78 void uninit()
79 {
80         FreeImage_DeInitialise();
81 }
82
83 }}