]> git.sesse.net Git - casparcg/blob - core/video_format.h
2.0.0.2: Added copyright notice to all files.
[casparcg] / core / video_format.h
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 #pragma once\r
22 \r
23 #include <string>\r
24 \r
25 #include <common/compiler/vs/disable_silly_warnings.h>\r
26 \r
27 namespace caspar { namespace core {\r
28         \r
29 struct video_format \r
30\r
31         enum type\r
32         {\r
33                 pal = 0,\r
34                 ntsc,\r
35                 x576p2500,\r
36                 x720p2500,\r
37                 x720p5000,\r
38                 x720p5994,\r
39                 x720p6000,\r
40                 x1080p2397,\r
41                 x1080p2400,\r
42                 x1080i5000,\r
43                 x1080i5994,\r
44                 x1080i6000,\r
45                 x1080p2500,\r
46                 x1080p2997,\r
47                 x1080p3000,\r
48                 invalid,\r
49                 count\r
50         };\r
51 };\r
52 \r
53 struct video_mode \r
54\r
55         enum type\r
56         {\r
57                 progressive,\r
58                 lower,\r
59                 upper,\r
60                 count,\r
61                 invalid\r
62         };\r
63 };\r
64 \r
65 struct video_format_desc\r
66 {\r
67         video_format::type              format;         // video output format\r
68 \r
69         size_t                                  width;          // output frame width\r
70         size_t                                  height;         // output frame height\r
71         video_mode::type                mode;           // progressive, interlaced upper field first, interlaced lower field first\r
72         double                                  fps;            // actual framerate, e.g. i50 = 25 fps, p50 = 50 fps\r
73         double                                  interval;       // time between frames\r
74         size_t                                  size;           // output frame size in bytes \r
75         std::wstring                    name;           // name of output format\r
76 \r
77         static const video_format_desc& get(video_format::type format);\r
78         static const video_format_desc& get(const std::wstring& name);\r
79 };\r
80 \r
81 inline bool operator==(const video_format_desc& rhs, const video_format_desc& lhs)\r
82 {\r
83         return rhs.format == lhs.format;\r
84 }\r
85 \r
86 inline bool operator!=(const video_format_desc& rhs, const video_format_desc& lhs)\r
87 {\r
88         return !(rhs == lhs);\r
89 }\r
90 \r
91 inline std::wostream& operator<<(std::wostream& out, const video_format_desc& format_desc)\r
92 {\r
93         out << format_desc.name.c_str();\r
94         return out;\r
95 }\r
96 \r
97 }}