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
21 #include "..\StdAfx.h"
\r
23 #include "..\utils\allocator.h"
\r
24 #include "..\utils\ID.h"
\r
25 #include "..\utils\image\Image.hpp"
\r
26 #include "FrameManager.h"
\r
27 #include <algorithm>
\r
30 #pragma intrinsic(__movsd, __stosd)
\r
32 #define DEFINE_VIDEOFORMATDESC(w, h, m, f, s) { (w), (h), (m), (f), (w)*(h)*4, s }
\r
36 const FrameFormatDescription FrameFormatDescription::FormatDescriptions[FrameFormatCount] = {
\r
37 DEFINE_VIDEOFORMATDESC(720, 576, Interlaced, 50, TEXT("PAL")),
\r
38 DEFINE_VIDEOFORMATDESC(720, 486, Interlaced, 60/1.001, TEXT("NTSC")),
\r
39 DEFINE_VIDEOFORMATDESC(720, 576, Progressive, 25, TEXT("576p2500")),
\r
40 DEFINE_VIDEOFORMATDESC(1280, 720, Progressive, 50, TEXT("720p5000")),
\r
41 DEFINE_VIDEOFORMATDESC(1280, 720, Progressive, 60/1.001, TEXT("720p5994")),
\r
42 DEFINE_VIDEOFORMATDESC(1280, 720, Progressive, 60, TEXT("720p6000")),
\r
43 DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 24/1.001, TEXT("1080p2397")),
\r
44 DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 24, TEXT("1080p2400")),
\r
45 DEFINE_VIDEOFORMATDESC(1920, 1080, Interlaced, 50, TEXT("1080i5000")),
\r
46 DEFINE_VIDEOFORMATDESC(1920, 1080, Interlaced, 60/1.001, TEXT("1080i5994")),
\r
47 DEFINE_VIDEOFORMATDESC(1920, 1080, Interlaced, 60, TEXT("1080i6000")),
\r
48 DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 25, TEXT("1080p2500")),
\r
49 DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 30/1.001, TEXT("1080p2997")),
\r
50 DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 30, TEXT("1080p3000"))
\r
54 FrameFormat GetVideoFormat(const tstring& strVideoMode)
\r
56 for(int index = 0; index < FrameFormatCount; ++index)
\r
58 const FrameFormatDescription& fmtDesc = FrameFormatDescription::FormatDescriptions[index];
\r
60 tstring strVideoModeUpper = strVideoMode;
\r
61 tstring strFmtDescUpper = fmtDesc.name;
\r
63 std::transform(strVideoModeUpper.begin(), strVideoModeUpper.end(), strVideoModeUpper.begin(), toupper);
\r
64 std::transform(strFmtDescUpper.begin(), strFmtDescUpper.end(), strFmtDescUpper.begin(), toupper);
\r
66 if(strVideoModeUpper == strFmtDescUpper) {
\r
67 return (FrameFormat)index;
\r
70 return FFormatInvalid;
\r
75 Frame::Frame() : bHasVideo_(false)
\r