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 | |
12 class GpuVideoServiceInfoParam { | |
13 public: | |
14 // route id for GpuVideoService on GPU process side for this channel. | |
15 int32 video_service_route_id_; | |
16 // route id for GpuVideoServiceHost on Render process side for this channel. | |
17 int32 video_service_host_route_id_; | |
18 // TODO(jiesun): define capabilities of video service. | |
19 int32 service_available_; | |
20 }; | |
21 | |
22 class GpuVideoDecoderInfoParam { | |
23 public: | |
24 // global decoder id. | |
25 int32 decoder_id_; | |
26 // route id for GpuVideoDecoder on GPU process side for this channel. | |
27 int32 decoder_route_id_; | |
28 // route id for GpuVideoServiceHost on Render process side for this channel. | |
29 int32 decoder_host_route_id_; | |
30 }; | |
31 | |
32 class GpuVideoDecoderInitParam { | |
33 public: | |
34 int32 codec_id_; | |
35 int32 width_; | |
36 int32 height_; | |
37 int32 profile_; | |
38 int32 level_; | |
39 int32 frame_rate_den_; | |
40 int32 frame_rate_num_; | |
41 int32 aspect_ratio_den_; | |
42 int32 aspect_ratio_num_; | |
43 }; | |
44 | |
45 class GpuVideoDecoderInitDoneParam { | |
46 public: | |
47 enum SurfaceType { | |
48 SurfaceTypeSystemMemory, | |
49 SurfaceTypeD3D, | |
50 SurfaceTypeEGLImage, | |
51 }; | |
52 enum SurfaceFormat { | |
53 SurfaceFormat_YV12, | |
54 SurfaceFormat_NV12, | |
55 SurfaceFormat_XRGB, | |
56 }; | |
57 int32 success_; // other parameter is only meaningful when this is true. | |
58 int32 provides_buffer; | |
59 int32 format_; | |
60 int32 surface_type_; | |
61 int32 stride_; | |
62 int32 input_buffer_size_; | |
63 int32 output_buffer_size_; | |
64 base::SharedMemoryHandle input_buffer_handle_; | |
65 // we do not need this if hardware composition is ready. | |
66 base::SharedMemoryHandle output_buffer_handle_; | |
67 }; | |
68 | |
69 class GpuVideoDecoderInputBufferParam { | |
70 public: | |
71 int64 timestamp_; // In unit of microseconds. | |
72 int32 offset_; | |
73 int32 size_; | |
74 int32 flags_; // miscellaneous flag bit mask | |
75 }; | |
76 | |
77 class GpuVideoDecoderOutputBufferParam { | |
78 public: | |
79 int64 timestamp_; // In unit of microseconds. | |
80 int64 duration_; // In unit of microseconds. | |
81 int32 flags_; // miscellaneous flag bit mask | |
82 | |
83 enum { | |
84 kFlagsEndOfStream = 0x00000001, | |
85 kFlagsDiscontinuous = 0x00000002, | |
86 }; | |
87 }; | |
88 | |
89 class GpuVideoDecoderErrorInfoParam { | |
90 public: | |
91 int32 error_id; // TODO(jiesun): define enum. | |
92 }; | |
93 | |
94 // TODO(jiesun): define this. | |
95 class GpuVideoDecoderFormatChangeParam { | |
96 public: | |
97 int32 stride_; | |
98 int32 input_buffer_size_; | |
99 int32 output_buffer_size_; | |
100 base::SharedMemoryHandle input_buffer_handle_; | |
101 base::SharedMemoryHandle output_buffer_handle_; | |
102 }; | |
103 | |
104 namespace IPC { | |
105 | |
106 template <> | |
107 struct ParamTraits<GpuVideoServiceInfoParam> { | |
108 typedef GpuVideoServiceInfoParam param_type; | |
109 static void Write(Message* m, const param_type& p); | |
110 static bool Read(const Message* m, void** iter, param_type* r); | |
111 static void Log(const param_type& p, std::wstring* l); | |
112 }; | |
113 | |
114 template <> | |
115 struct ParamTraits<GpuVideoDecoderInfoParam> { | |
116 typedef GpuVideoDecoderInfoParam param_type; | |
117 static void Write(Message* m, const param_type& p); | |
118 static bool Read(const Message* m, void** iter, param_type* r); | |
119 static void Log(const param_type& p, std::wstring* l); | |
120 }; | |
121 | |
122 template <> | |
123 struct ParamTraits<GpuVideoDecoderInitParam> { | |
124 typedef GpuVideoDecoderInitParam param_type; | |
125 static void Write(Message* m, const param_type& p); | |
126 static bool Read(const Message* m, void** iter, param_type* r); | |
127 static void Log(const param_type& p, std::wstring* l); | |
128 }; | |
129 | |
130 template <> | |
131 struct ParamTraits<GpuVideoDecoderInitDoneParam> { | |
132 typedef GpuVideoDecoderInitDoneParam param_type; | |
133 static void Write(Message* m, const param_type& p); | |
134 static bool Read(const Message* m, void** iter, param_type* r); | |
135 static void Log(const param_type& p, std::wstring* l); | |
136 }; | |
137 | |
138 template <> | |
139 struct ParamTraits<GpuVideoDecoderInputBufferParam> { | |
140 typedef GpuVideoDecoderInputBufferParam param_type; | |
141 static void Write(Message* m, const param_type& p); | |
142 static bool Read(const Message* m, void** iter, param_type* r); | |
143 static void Log(const param_type& p, std::wstring* l); | |
144 }; | |
145 | |
146 template <> | |
147 struct ParamTraits<GpuVideoDecoderOutputBufferParam> { | |
148 typedef GpuVideoDecoderOutputBufferParam param_type; | |
149 static void Write(Message* m, const param_type& p); | |
150 static bool Read(const Message* m, void** iter, param_type* r); | |
151 static void Log(const param_type& p, std::wstring* l); | |
152 }; | |
153 | |
154 template <> | |
155 struct ParamTraits<GpuVideoDecoderErrorInfoParam> { | |
156 typedef GpuVideoDecoderErrorInfoParam param_type; | |
157 static void Write(Message* m, const param_type& p); | |
158 static bool Read(const Message* m, void** iter, param_type* r); | |
159 static void Log(const param_type& p, std::wstring* l); | |
160 }; | |
161 | |
162 template <> | |
163 struct ParamTraits<GpuVideoDecoderFormatChangeParam> { | |
164 typedef GpuVideoDecoderFormatChangeParam param_type; | |
165 static void Write(Message* m, const param_type& p); | |
166 static bool Read(const Message* m, void** iter, param_type* r); | |
167 static void Log(const param_type& p, std::wstring* l); | |
168 }; | |
169 }; | |
170 | |
171 #endif // CHROME_COMMON_GPU_VIDEO_COMMON_H_ | |
172 | |
OLD | NEW |