]> git.sesse.net Git - casparcg/blob - core/frame/frame_format.cpp
2.0.0.2:
[casparcg] / core / frame / frame_format.cpp
1 /*\r
2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
3 *\r
4 *  This file is part of CasparCG.\r
5 *\r
6 *    CasparCG is free software: you can redistribute it and/or modify\r
7 *    it under the terms of the GNU General Public License as published by\r
8 *    the Free Software Foundation, either version 3 of the License, or\r
9 *    (at your option) any later version.\r
10 *\r
11 *    CasparCG is distributed in the hope that it will be useful,\r
12 *    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14 *    GNU General Public License for more details.\r
15 \r
16 *    You should have received a copy of the GNU General Public License\r
17 *    along with CasparCG.  If not, see <http://www.gnu.org/licenses/>.\r
18 *\r
19 */\r
20  \r
21 #include "..\StdAfx.h"\r
22 \r
23 #include "frame_format.h"\r
24 \r
25 #include <boost/algorithm/string.hpp>\r
26 \r
27 #define DEFINE_VIDEOFORMATDESC(w, h, m, f, s, fmt) { (w), (h), (m), (f), (w)*(h)*4, s, (fmt) }\r
28 \r
29 namespace caspar { namespace core {\r
30 \r
31 const frame_format_desc frame_format_desc::format_descs[frame_format::count] =  \r
32 {       \r
33         DEFINE_VIDEOFORMATDESC(720, 576, video_mode::upper, 50, TEXT("PAL"), frame_format::pal), \r
34         DEFINE_VIDEOFORMATDESC(720, 486, video_mode::lower, 60/1.001, TEXT("NTSC"), frame_format::ntsc), \r
35         DEFINE_VIDEOFORMATDESC(720, 576, video_mode::progressive, 25, TEXT("576p2500"), frame_format::x576p2500),\r
36         DEFINE_VIDEOFORMATDESC(1280, 720, video_mode::progressive, 50, TEXT("720p5000"), frame_format::x720p5000), \r
37         DEFINE_VIDEOFORMATDESC(1280, 720, video_mode::progressive, 60/1.001, TEXT("720p5994"), frame_format::x720p5994),\r
38         DEFINE_VIDEOFORMATDESC(1280, 720, video_mode::progressive, 60, TEXT("720p6000"), frame_format::x720p6000),\r
39         DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive, 24/1.001, TEXT("1080p2397"), frame_format::x1080p2397),\r
40         DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive, 24, TEXT("1080p2400"), frame_format::x1080p2400),\r
41         DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::upper, 50, TEXT("1080i5000"), frame_format::x1080i5000),\r
42         DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::upper, 60/1.001, TEXT("1080i5994"), frame_format::x1080i5994),\r
43         DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::upper, 60, TEXT("1080i6000"), frame_format::x1080i6000),\r
44         DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive, 25, TEXT("1080p2500"), frame_format::x1080p2500),\r
45         DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive, 30/1.001, TEXT("1080p2997"), frame_format::x1080p2997),\r
46         DEFINE_VIDEOFORMATDESC(1920, 1080,video_mode:: progressive, 30, TEXT("1080p3000"), frame_format::x1080p3000)\r
47 };\r
48 \r
49 frame_format get_video_format(const std::wstring& str)\r
50 {\r
51         for(int n = 0; n < frame_format::count; ++n)\r
52         {\r
53                 if(boost::iequals(frame_format_desc::format_descs[n].name, str))\r
54                         return static_cast<frame_format>(n);\r
55         }\r
56 \r
57         return frame_format::invalid;\r
58 }\r
59 \r
60 }}      //namespace caspar\r
61 \r