OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_COMMON_GPU_VIDEO_COMMON_H_ | |
6 #define CHROME_COMMON_GPU_VIDEO_COMMON_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/shared_memory.h" | |
10 #include "chrome/common/common_param_traits.h" | |
11 #include "media/base/video_frame.h" | |
12 | |
13 // This is used in messages when only buffer flag is meaningful. | |
14 extern const int32 kGpuVideoInvalidFrameId; | |
15 | |
16 // Flags assigned to a video buffer for both input and output. | |
17 enum GpuVideoBufferFlag { | |
18 kGpuVideoEndOfStream = 1 << 0, | |
19 kGpuVideoDiscontinuous = 1 << 1, | |
20 }; | |
21 | |
22 struct GpuVideoDecoderInitParam { | |
23 int32 codec_id; | |
24 int32 width; | |
25 int32 height; | |
26 int32 profile; | |
27 int32 level; | |
28 int32 frame_rate_den; | |
29 int32 frame_rate_num; | |
30 int32 aspect_ratio_den; | |
31 int32 aspect_ratio_num; | |
32 }; | |
33 | |
34 struct GpuVideoDecoderInitDoneParam { | |
35 int32 success; // other parameter is only meaningful when this is true. | |
36 int32 input_buffer_size; | |
37 base::SharedMemoryHandle input_buffer_handle; | |
38 }; | |
39 | |
40 struct GpuVideoDecoderInputBufferParam { | |
41 int64 timestamp; // In unit of microseconds. | |
42 int32 offset; | |
43 int32 size; | |
44 int32 flags; // Miscellaneous flag bit mask. | |
45 }; | |
46 | |
47 struct GpuVideoDecoderErrorInfoParam { | |
48 int32 error_id; // TODO(jiesun): define enum. | |
49 }; | |
50 | |
51 // TODO(jiesun): define this. | |
52 struct GpuVideoDecoderFormatChangeParam { | |
53 int32 input_buffer_size; | |
54 base::SharedMemoryHandle input_buffer_handle; | |
55 }; | |
56 | |
57 namespace IPC { | |
58 | |
59 template <> | |
60 struct ParamTraits<GpuVideoDecoderInitParam> { | |
61 typedef GpuVideoDecoderInitParam param_type; | |
62 static void Write(Message* m, const param_type& p); | |
63 static bool Read(const Message* m, void** iter, param_type* r); | |
64 static void Log(const param_type& p, std::string* l); | |
65 }; | |
66 | |
67 template <> | |
68 struct ParamTraits<GpuVideoDecoderInitDoneParam> { | |
69 typedef GpuVideoDecoderInitDoneParam param_type; | |
70 static void Write(Message* m, const param_type& p); | |
71 static bool Read(const Message* m, void** iter, param_type* r); | |
72 static void Log(const param_type& p, std::string* l); | |
73 }; | |
74 | |
75 template <> | |
76 struct ParamTraits<GpuVideoDecoderInputBufferParam> { | |
77 typedef GpuVideoDecoderInputBufferParam param_type; | |
78 static void Write(Message* m, const param_type& p); | |
79 static bool Read(const Message* m, void** iter, param_type* r); | |
80 static void Log(const param_type& p, std::string* l); | |
81 }; | |
82 | |
83 template <> | |
84 struct ParamTraits<GpuVideoDecoderErrorInfoParam> { | |
85 typedef GpuVideoDecoderErrorInfoParam param_type; | |
86 static void Write(Message* m, const param_type& p); | |
87 static bool Read(const Message* m, void** iter, param_type* r); | |
88 static void Log(const param_type& p, std::string* l); | |
89 }; | |
90 | |
91 template <> | |
92 struct ParamTraits<GpuVideoDecoderFormatChangeParam> { | |
93 typedef GpuVideoDecoderFormatChangeParam param_type; | |
94 static void Write(Message* m, const param_type& p); | |
95 static bool Read(const Message* m, void** iter, param_type* r); | |
96 static void Log(const param_type& p, std::string* l); | |
97 }; | |
98 | |
99 template <> | |
100 struct ParamTraits<media::VideoFrame::Format> { | |
101 typedef media::VideoFrame::Format param_type; | |
102 static void Write(Message* m, const param_type& p); | |
103 static bool Read(const Message* m, void** iter, param_type* p); | |
104 static void Log(const param_type& p, std::string* l); | |
105 }; | |
106 | |
107 } // namespace IPC | |
108 | |
109 #endif // CHROME_COMMON_GPU_VIDEO_COMMON_H_ | |
OLD | NEW |