2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG.
\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
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
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
23 #include "video_format.h"
\r
25 #include <boost/algorithm/string.hpp>
\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
31 namespace caspar { namespace core {
\r
33 const video_format_desc format_descs[video_format::count] =
\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
53 const video_format_desc& video_format_desc::get(video_format::type format)
\r
55 return format_descs[format];
\r
58 const video_format_desc& video_format_desc::get(const std::wstring& name)
\r
60 for(int n = 0; n < video_format::invalid; ++n)
\r
62 if(boost::iequals(format_descs[n].name, name))
\r
63 return format_descs[n];
\r
65 return format_descs[video_format::invalid];
\r