2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
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.
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.
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/>.
19 * Author: Robert Nagy, ronag89@gmail.com
28 #include <common/enum_class.h>
30 #include <boost/rational.hpp>
32 namespace caspar { namespace core {
34 enum class video_format
81 progressive = 3 // NOTE: progressive == lower | upper;
83 ENUM_ENABLE_BITWISE(field_mode);
84 //static_assert((field_mode::lower | field_mode::upper) == field_mode::progressive, "");
86 struct video_format_desc final
94 core::field_mode field_mode; // progressive, interlaced upper field first, interlaced lower field first
95 double fps; // actual framerate = duration/time_scale, e.g. i50 = 25 fps, p50 = 50 fps
96 boost::rational<int> framerate;
100 std::size_t size; // frame size in bytes
101 std::wstring name; // name of output format
103 int audio_sample_rate;
104 std::vector<int> audio_cadence; // rotating optimal number of samples per frame
106 video_format_desc(video_format format,
111 core::field_mode field_mode,
114 const std::wstring& name,
115 const std::vector<int>& audio_cadence);
117 video_format_desc(video_format format = video_format::invalid);
118 video_format_desc(const std::wstring& name);
121 bool operator==(const video_format_desc& rhs, const video_format_desc& lhs);
122 bool operator!=(const video_format_desc& rhs, const video_format_desc& lhs);
124 std::wostream& operator<<(std::wostream& out, const video_format_desc& format_desc);