| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_GPU_VIDEO_COMMON_H_ | 5 #ifndef CHROME_COMMON_GPU_VIDEO_COMMON_H_ |
| 6 #define CHROME_COMMON_GPU_VIDEO_COMMON_H_ | 6 #define CHROME_COMMON_GPU_VIDEO_COMMON_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
| 10 #include "chrome/common/common_param_traits.h" | 10 #include "chrome/common/common_param_traits.h" |
| 11 | 11 |
| 12 class GpuVideoServiceInfoParam { | 12 struct GpuVideoServiceInfoParam { |
| 13 public: | |
| 14 // route id for GpuVideoService on GPU process side for this channel. | 13 // route id for GpuVideoService on GPU process side for this channel. |
| 15 int32 video_service_route_id_; | 14 int32 video_service_route_id; |
| 16 // route id for GpuVideoServiceHost on Render process side for this channel. | 15 // route id for GpuVideoServiceHost on Render process side for this channel. |
| 17 int32 video_service_host_route_id_; | 16 int32 video_service_host_route_id; |
| 18 // TODO(jiesun): define capabilities of video service. | 17 // TODO(jiesun): define capabilities of video service. |
| 19 int32 service_available_; | 18 int32 service_available; |
| 20 }; | 19 }; |
| 21 | 20 |
| 22 class GpuVideoDecoderInfoParam { | 21 struct GpuVideoDecoderInfoParam { |
| 23 public: | |
| 24 // Context ID of the GLES2 context what this decoder should assicate with. | 22 // Context ID of the GLES2 context what this decoder should assicate with. |
| 25 int context_id; | 23 int context_id; |
| 26 | 24 |
| 27 // Global decoder id. | 25 // Global decoder id. |
| 28 int32 decoder_id; | 26 int32 decoder_id; |
| 29 | 27 |
| 30 // Route id for GpuVideoDecoder on GPU process side for this channel. | 28 // Route id for GpuVideoDecoder on GPU process side for this channel. |
| 31 int32 decoder_route_id; | 29 int32 decoder_route_id; |
| 32 | 30 |
| 33 // TODO(hclam): Merge this ID with |decoder_route_id_|. | 31 // TODO(hclam): Merge this ID with |decoder_route_id_|. |
| 34 // Route id for GpuVideoServiceHost on Render process side for this channel. | 32 // Route id for GpuVideoServiceHost on Render process side for this channel. |
| 35 int32 decoder_host_route_id; | 33 int32 decoder_host_route_id; |
| 36 }; | 34 }; |
| 37 | 35 |
| 38 class GpuVideoDecoderInitParam { | 36 struct GpuVideoDecoderInitParam { |
| 39 public: | 37 int32 codec_id; |
| 40 int32 codec_id_; | 38 int32 width; |
| 41 int32 width_; | 39 int32 height; |
| 42 int32 height_; | 40 int32 profile; |
| 43 int32 profile_; | 41 int32 level; |
| 44 int32 level_; | 42 int32 frame_rate_den; |
| 45 int32 frame_rate_den_; | 43 int32 frame_rate_num; |
| 46 int32 frame_rate_num_; | 44 int32 aspect_ratio_den; |
| 47 int32 aspect_ratio_den_; | 45 int32 aspect_ratio_num; |
| 48 int32 aspect_ratio_num_; | |
| 49 }; | 46 }; |
| 50 | 47 |
| 51 class GpuVideoDecoderInitDoneParam { | 48 struct GpuVideoDecoderInitDoneParam { |
| 52 public: | |
| 53 enum SurfaceType { | 49 enum SurfaceType { |
| 54 SurfaceTypeSystemMemory, | 50 SurfaceTypeSystemMemory, |
| 55 SurfaceTypeD3DSurface, | 51 SurfaceTypeGlTexture, |
| 56 SurfaceTypeEGLImage, | 52 SurfaceTypeD3dTexture, |
| 57 }; | 53 }; |
| 58 enum SurfaceFormat { | 54 enum SurfaceFormat { |
| 59 SurfaceFormat_YV12, | 55 SurfaceFormat_YV12, |
| 60 SurfaceFormat_NV12, | 56 SurfaceFormat_NV12, |
| 61 SurfaceFormat_XRGB, | 57 SurfaceFormat_RGBA, |
| 62 }; | 58 }; |
| 63 int32 success_; // other parameter is only meaningful when this is true. | 59 int32 success; // other parameter is only meaningful when this is true. |
| 64 int32 provides_buffer; | 60 int32 provides_buffer; |
| 65 int32 format_; | 61 int32 format; |
| 66 int32 surface_type_; | 62 int32 surface_type; |
| 67 int32 stride_; | 63 int32 stride; |
| 68 int32 input_buffer_size_; | 64 int32 input_buffer_size; |
| 69 int32 output_buffer_size_; | 65 int32 output_buffer_size; |
| 70 base::SharedMemoryHandle input_buffer_handle_; | 66 base::SharedMemoryHandle input_buffer_handle; |
| 71 // we do not need this if hardware composition is ready. | 67 // we do not need this if hardware composition is ready. |
| 72 base::SharedMemoryHandle output_buffer_handle_; | 68 base::SharedMemoryHandle output_buffer_handle; |
| 73 }; | 69 }; |
| 74 | 70 |
| 75 class GpuVideoDecoderInputBufferParam { | 71 struct GpuVideoDecoderInputBufferParam { |
| 76 public: | 72 int64 timestamp; // In unit of microseconds. |
| 77 int64 timestamp_; // In unit of microseconds. | 73 int32 offset; |
| 78 int32 offset_; | 74 int32 size; |
| 79 int32 size_; | 75 int32 flags; // miscellaneous flag bit mask |
| 80 int32 flags_; // miscellaneous flag bit mask | |
| 81 }; | 76 }; |
| 82 | 77 |
| 83 class GpuVideoDecoderOutputBufferParam { | 78 struct GpuVideoDecoderOutputBufferParam { |
| 84 public: | 79 int64 timestamp; // In unit of microseconds. |
| 85 int64 timestamp_; // In unit of microseconds. | 80 int64 duration; // In unit of microseconds. |
| 86 int64 duration_; // In unit of microseconds. | 81 int32 flags; // miscellaneous flag bit mask |
| 87 int32 flags_; // miscellaneous flag bit mask | 82 |
| 83 // TODO(hclam): This is really ugly and should be removed. Instead of sending |
| 84 // a texture id we should send a buffer id that signals that a buffer is ready |
| 85 // to be consumed. Before that we need API to establish the buffers. |
| 86 int32 texture; |
| 88 | 87 |
| 89 enum { | 88 enum { |
| 90 kFlagsEndOfStream = 0x00000001, | 89 kFlagsEndOfStream = 0x00000001, |
| 91 kFlagsDiscontinuous = 0x00000002, | 90 kFlagsDiscontinuous = 0x00000002, |
| 92 }; | 91 }; |
| 93 }; | 92 }; |
| 94 | 93 |
| 95 class GpuVideoDecoderErrorInfoParam { | 94 struct GpuVideoDecoderErrorInfoParam { |
| 96 public: | |
| 97 int32 error_id; // TODO(jiesun): define enum. | 95 int32 error_id; // TODO(jiesun): define enum. |
| 98 }; | 96 }; |
| 99 | 97 |
| 100 // TODO(jiesun): define this. | 98 // TODO(jiesun): define this. |
| 101 class GpuVideoDecoderFormatChangeParam { | 99 struct GpuVideoDecoderFormatChangeParam { |
| 102 public: | 100 int32 stride; |
| 103 int32 stride_; | 101 int32 input_buffer_size; |
| 104 int32 input_buffer_size_; | 102 int32 output_buffer_size; |
| 105 int32 output_buffer_size_; | 103 base::SharedMemoryHandle input_buffer_handle; |
| 106 base::SharedMemoryHandle input_buffer_handle_; | 104 base::SharedMemoryHandle output_buffer_handle; |
| 107 base::SharedMemoryHandle output_buffer_handle_; | |
| 108 }; | 105 }; |
| 109 | 106 |
| 110 namespace IPC { | 107 namespace IPC { |
| 111 | 108 |
| 112 template <> | 109 template <> |
| 113 struct ParamTraits<GpuVideoServiceInfoParam> { | 110 struct ParamTraits<GpuVideoServiceInfoParam> { |
| 114 typedef GpuVideoServiceInfoParam param_type; | 111 typedef GpuVideoServiceInfoParam param_type; |
| 115 static void Write(Message* m, const param_type& p); | 112 static void Write(Message* m, const param_type& p); |
| 116 static bool Read(const Message* m, void** iter, param_type* r); | 113 static bool Read(const Message* m, void** iter, param_type* r); |
| 117 static void Log(const param_type& p, std::string* l); | 114 static void Log(const param_type& p, std::string* l); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 template <> | 165 template <> |
| 169 struct ParamTraits<GpuVideoDecoderFormatChangeParam> { | 166 struct ParamTraits<GpuVideoDecoderFormatChangeParam> { |
| 170 typedef GpuVideoDecoderFormatChangeParam param_type; | 167 typedef GpuVideoDecoderFormatChangeParam param_type; |
| 171 static void Write(Message* m, const param_type& p); | 168 static void Write(Message* m, const param_type& p); |
| 172 static bool Read(const Message* m, void** iter, param_type* r); | 169 static bool Read(const Message* m, void** iter, param_type* r); |
| 173 static void Log(const param_type& p, std::string* l); | 170 static void Log(const param_type& p, std::string* l); |
| 174 }; | 171 }; |
| 175 }; | 172 }; |
| 176 | 173 |
| 177 #endif // CHROME_COMMON_GPU_VIDEO_COMMON_H_ | 174 #endif // CHROME_COMMON_GPU_VIDEO_COMMON_H_ |
| OLD | NEW |