]> git.sesse.net Git - casparcg/blob - core/video_format.cpp
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
[casparcg] / core / video_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 "video_format.h"\r
24 \r
25 #include <boost/algorithm/string.hpp>\r
26 \r
27 #include <array>\r
28 \r
29 #define DEFINE_VIDEOFORMATDESC(w, h, m, f, s, fmt) { (fmt), (w), (h), (m), (m == video_mode::progressive ? f : f/2.0), (1.0/(m == video_mode::progressive ? f : f/2.0)), ((w)*(h)*4), (s)}\r
30 \r
31 namespace caspar { namespace core {\r
32         \r
33 const video_format_desc format_descs[video_format::invalid] =  \r
34 {                                                                          \r
35         DEFINE_VIDEOFORMATDESC(720,  576,  video_mode::upper,                   50,                     TEXT("PAL"),            video_format::pal               ), \r
36         //DEFINE_VIDEOFORMATDESC(720,  486,  video_mode::lower,                 60/1.001,       TEXT("NTSC"),           video_format::ntsc              ), \r
37         //DEFINE_VIDEOFORMATDESC(720,  576,  video_mode::progressive,           25,                     TEXT("576p2500"),       video_format::x576p2500 ),\r
38         DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,             25,                     TEXT("720p2500"),       video_format::x720p2500 ), \r
39         DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,             50,                     TEXT("720p5000"),       video_format::x720p5000 ), \r
40         //DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,   60/1.001,       TEXT("720p5994"),       video_format::x720p5994 ),\r
41         //DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,   60,                     TEXT("720p6000"),       video_format::x720p6000 ),\r
42         //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,   24/1.001,       TEXT("1080p2397"),      video_format::x1080p2397),\r
43         //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,   24,                     TEXT("1080p2400"),      video_format::x1080p2400),\r
44         DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::upper,                   50,                     TEXT("1080i5000"),      video_format::x1080i5000),\r
45         //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::upper,                 60/1.001,       TEXT("1080i5994"),      video_format::x1080i5994),\r
46         //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::upper,                 60,                     TEXT("1080i6000"),      video_format::x1080i6000),\r
47         DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,             25,                     TEXT("1080p2500"),      video_format::x1080p2500),\r
48         //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,   30/1.001,       TEXT("1080p2997"),      video_format::x1080p2997),\r
49         //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,   30,                     TEXT("1080p3000"),      video_format::x1080p3000),\r
50         DEFINE_VIDEOFORMATDESC(0,               0, video_mode::invalid,                 -1,                     TEXT("invalid"),        video_format::invalid   )\r
51 };\r
52 \r
53 const video_format_desc& video_format_desc::get(video_format::type format)      \r
54 {\r
55         return format_descs[format];\r
56 }\r
57 \r
58 const video_format_desc& video_format_desc::get(const std::wstring& name)       \r
59 {\r
60         for(int n = 0; n < video_format::invalid; ++n)\r
61         {\r
62                 if(boost::iequals(format_descs[n].name, name))\r
63                         return format_descs[n];\r
64         }\r
65         return format_descs[video_format::invalid];\r
66 }\r
67 \r
68 }}\r
69 \r