]> git.sesse.net Git - casparcg/blob - modules/image/image.cpp
d912afe5d05224fc360a545315a7d2ce65c19dd2
[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
33 #include <common/utf.h>
34
35 #include <FreeImage.h>
36
37 namespace caspar { namespace image {
38
39 void init(const spl::shared_ptr<core::media_info_repository>& repo)
40 {
41         FreeImage_Initialise();
42         core::register_producer_factory(create_scroll_producer);
43         core::register_producer_factory(create_producer);
44         core::register_thumbnail_producer_factory(create_thumbnail_producer);
45         core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_consumer(params);});
46         repo->register_extractor([](const std::wstring& file, const std::wstring& extension, core::media_info& info)
47         {
48                 if (extension == L".TGA"
49                         || extension == L".COL"
50                         || extension == L".PNG"
51                         || extension == L".JPEG"
52                         || extension == L".JPG"
53                         || extension == L".GIF"
54                         || extension == L".BMP")
55                 {
56                         info.clip_type = L"STILL";
57
58                         return true;
59                 }
60
61                 return false;
62         });
63 }
64
65 void uninit()
66 {
67         FreeImage_DeInitialise();
68 }
69
70
71 std::wstring version()
72 {
73         return u16(FreeImage_GetVersion());
74 }
75
76 }}