]> git.sesse.net Git - casparcg/blob - core/video_format.h
2.0.0.2: Fixed bug where invalid video format caused access violation.
[casparcg] / core / video_format.h
1 #pragma once\r
2 \r
3 #include <string>\r
4 \r
5 #include <common/compiler/vs/disable_silly_warnings.h>\r
6 \r
7 namespace caspar { namespace core {\r
8         \r
9 struct video_format \r
10\r
11         enum type\r
12         {\r
13                 pal = 0,\r
14                 //ntsc,\r
15                 //x576p2500,\r
16                 x720p2500,\r
17                 x720p5000,\r
18                 //x720p5994,\r
19                 //x720p6000,\r
20                 //x1080p2397,\r
21                 //x1080p2400,\r
22                 x1080i5000,\r
23                 //x1080i5994,\r
24                 //x1080i6000,\r
25                 x1080p2500,\r
26                 //x1080p2997,\r
27                 //x1080p3000,\r
28                 invalid,\r
29                 count\r
30         };\r
31 };\r
32 \r
33 struct video_mode \r
34\r
35         enum type\r
36         {\r
37                 progressive,\r
38                 lower,\r
39                 upper,\r
40                 count,\r
41                 invalid\r
42         };\r
43 };\r
44 \r
45 struct video_format_desc\r
46 {\r
47         video_format::type              format;         // video output format\r
48 \r
49         size_t                                  width;          // output frame width\r
50         size_t                                  height;         // output frame height\r
51         video_mode::type                mode;           // progressive, interlaced upper field first, interlaced lower field first\r
52         double                                  fps;            // actual framerate, e.g. i50 = 25 fps, p50 = 50 fps\r
53         double                                  interval;       // time between frames\r
54         size_t                                  size;           // output frame size in bytes \r
55         std::wstring                    name;           // name of output format\r
56 \r
57         static const video_format_desc& get(video_format::type format);\r
58         static const video_format_desc& get(const std::wstring& name);\r
59 };\r
60 \r
61 inline bool operator==(const video_format_desc& rhs, const video_format_desc& lhs)\r
62 {\r
63         return rhs.format == lhs.format;\r
64 }\r
65 \r
66 inline bool operator!=(const video_format_desc& rhs, const video_format_desc& lhs)\r
67 {\r
68         return !(rhs == lhs);\r
69 }\r
70 \r
71 inline std::wostream& operator<<(std::wostream& out, const video_format_desc& format_desc)\r
72 {\r
73         out << format_desc.name.c_str();\r
74         return out;\r
75 }\r
76 \r
77 }}