| 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 #include "chrome/common/gpu_video_common.h" | 5 #include "chrome/common/gpu_video_common.h" |
| 6 | 6 |
| 7 namespace IPC { | 7 namespace IPC { |
| 8 | 8 |
| 9 void ParamTraits<GpuVideoServiceInfoParam>::Write( | 9 void ParamTraits<GpuVideoServiceInfoParam>::Write( |
| 10 Message* m, const GpuVideoServiceInfoParam& p) { | 10 Message* m, const GpuVideoServiceInfoParam& p) { |
| 11 m->WriteInt(p.video_service_route_id_); | 11 m->WriteInt(p.video_service_route_id); |
| 12 m->WriteInt(p.video_service_host_route_id_); | 12 m->WriteInt(p.video_service_host_route_id); |
| 13 m->WriteInt(p.service_available_); | 13 m->WriteInt(p.service_available); |
| 14 } | 14 } |
| 15 | 15 |
| 16 bool ParamTraits<GpuVideoServiceInfoParam>::Read( | 16 bool ParamTraits<GpuVideoServiceInfoParam>::Read( |
| 17 const Message* m, void** iter, GpuVideoServiceInfoParam* r) { | 17 const Message* m, void** iter, GpuVideoServiceInfoParam* r) { |
| 18 if (!m->ReadInt(iter, &r->video_service_route_id_) || | 18 if (!m->ReadInt(iter, &r->video_service_route_id) || |
| 19 !m->ReadInt(iter, &r->video_service_host_route_id_) || | 19 !m->ReadInt(iter, &r->video_service_host_route_id) || |
| 20 !m->ReadInt(iter, &r->service_available_)) | 20 !m->ReadInt(iter, &r->service_available)) |
| 21 return false; | 21 return false; |
| 22 return true; | 22 return true; |
| 23 } | 23 } |
| 24 | 24 |
| 25 void ParamTraits<GpuVideoServiceInfoParam>::Log( | 25 void ParamTraits<GpuVideoServiceInfoParam>::Log( |
| 26 const GpuVideoServiceInfoParam& p, std::string* l) { | 26 const GpuVideoServiceInfoParam& p, std::string* l) { |
| 27 l->append(StringPrintf("(%d, %d, %d)", | 27 l->append(StringPrintf("(%d, %d, %d)", |
| 28 p.video_service_route_id_, | 28 p.video_service_route_id, |
| 29 p.video_service_host_route_id_, | 29 p.video_service_host_route_id, |
| 30 p.service_available_)); | 30 p.service_available)); |
| 31 } | 31 } |
| 32 | 32 |
| 33 /////////////////////////////////////////////////////////////////////////////// | 33 /////////////////////////////////////////////////////////////////////////////// |
| 34 | 34 |
| 35 void ParamTraits<GpuVideoDecoderInfoParam>::Write( | 35 void ParamTraits<GpuVideoDecoderInfoParam>::Write( |
| 36 Message* m, const GpuVideoDecoderInfoParam& p) { | 36 Message* m, const GpuVideoDecoderInfoParam& p) { |
| 37 m->WriteInt(p.context_id); | 37 m->WriteInt(p.context_id); |
| 38 m->WriteInt(p.decoder_id); | 38 m->WriteInt(p.decoder_id); |
| 39 m->WriteInt(p.decoder_route_id); | 39 m->WriteInt(p.decoder_route_id); |
| 40 m->WriteInt(p.decoder_host_route_id); | 40 m->WriteInt(p.decoder_host_route_id); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 55 l->append(StringPrintf("(%d, %d, %d)", | 55 l->append(StringPrintf("(%d, %d, %d)", |
| 56 p.decoder_id, | 56 p.decoder_id, |
| 57 p.decoder_route_id, | 57 p.decoder_route_id, |
| 58 p.decoder_host_route_id)); | 58 p.decoder_host_route_id)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 /////////////////////////////////////////////////////////////////////////////// | 61 /////////////////////////////////////////////////////////////////////////////// |
| 62 | 62 |
| 63 void ParamTraits<GpuVideoDecoderInitParam>::Write( | 63 void ParamTraits<GpuVideoDecoderInitParam>::Write( |
| 64 Message* m, const GpuVideoDecoderInitParam& p) { | 64 Message* m, const GpuVideoDecoderInitParam& p) { |
| 65 m->WriteInt(p.codec_id_); | 65 m->WriteInt(p.codec_id); |
| 66 m->WriteInt(p.width_); | 66 m->WriteInt(p.width); |
| 67 m->WriteInt(p.height_); | 67 m->WriteInt(p.height); |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool ParamTraits<GpuVideoDecoderInitParam>::Read( | 70 bool ParamTraits<GpuVideoDecoderInitParam>::Read( |
| 71 const Message* m, void** iter, GpuVideoDecoderInitParam* r) { | 71 const Message* m, void** iter, GpuVideoDecoderInitParam* r) { |
| 72 if (!m->ReadInt(iter, &r->codec_id_) || | 72 if (!m->ReadInt(iter, &r->codec_id) || |
| 73 !m->ReadInt(iter, &r->width_) || | 73 !m->ReadInt(iter, &r->width) || |
| 74 !m->ReadInt(iter, &r->height_)) | 74 !m->ReadInt(iter, &r->height)) |
| 75 return false; | 75 return false; |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void ParamTraits<GpuVideoDecoderInitParam>::Log( | 79 void ParamTraits<GpuVideoDecoderInitParam>::Log( |
| 80 const GpuVideoDecoderInitParam& p, std::string* l) { | 80 const GpuVideoDecoderInitParam& p, std::string* l) { |
| 81 l->append(StringPrintf("(%d, %d %d)", p.codec_id_, p.width_, p.height_)); | 81 l->append(StringPrintf("(%d, %d %d)", p.codec_id, p.width, p.height)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 /////////////////////////////////////////////////////////////////////////////// | 84 /////////////////////////////////////////////////////////////////////////////// |
| 85 | 85 |
| 86 void ParamTraits<GpuVideoDecoderInitDoneParam>::Write( | 86 void ParamTraits<GpuVideoDecoderInitDoneParam>::Write( |
| 87 Message* m, const GpuVideoDecoderInitDoneParam& p) { | 87 Message* m, const GpuVideoDecoderInitDoneParam& p) { |
| 88 m->WriteInt(p.success_); | 88 m->WriteInt(p.success); |
| 89 m->WriteInt(p.stride_); | 89 m->WriteInt(p.stride); |
| 90 m->WriteInt(p.format_); | 90 m->WriteInt(p.format); |
| 91 m->WriteInt(p.surface_type_); | 91 m->WriteInt(p.surface_type); |
| 92 m->WriteInt(p.input_buffer_size_); | 92 m->WriteInt(p.input_buffer_size); |
| 93 m->WriteInt(p.output_buffer_size_); | 93 m->WriteInt(p.output_buffer_size); |
| 94 IPC::ParamTraits<base::SharedMemoryHandle>::Write( | 94 IPC::ParamTraits<base::SharedMemoryHandle>::Write( |
| 95 m, p.input_buffer_handle_); | 95 m, p.input_buffer_handle); |
| 96 IPC::ParamTraits<base::SharedMemoryHandle>::Write( | 96 IPC::ParamTraits<base::SharedMemoryHandle>::Write( |
| 97 m, p.output_buffer_handle_); | 97 m, p.output_buffer_handle); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool ParamTraits<GpuVideoDecoderInitDoneParam>::Read( | 100 bool ParamTraits<GpuVideoDecoderInitDoneParam>::Read( |
| 101 const Message* m, void** iter, GpuVideoDecoderInitDoneParam* r) { | 101 const Message* m, void** iter, GpuVideoDecoderInitDoneParam* r) { |
| 102 if (!m->ReadInt(iter, &r->success_) || | 102 if (!m->ReadInt(iter, &r->success) || |
| 103 !m->ReadInt(iter, &r->stride_) || | 103 !m->ReadInt(iter, &r->stride) || |
| 104 !m->ReadInt(iter, &r->format_) || | 104 !m->ReadInt(iter, &r->format) || |
| 105 !m->ReadInt(iter, &r->surface_type_) || | 105 !m->ReadInt(iter, &r->surface_type) || |
| 106 !m->ReadInt(iter, &r->input_buffer_size_) || | 106 !m->ReadInt(iter, &r->input_buffer_size) || |
| 107 !m->ReadInt(iter, &r->output_buffer_size_) || | 107 !m->ReadInt(iter, &r->output_buffer_size) || |
| 108 !IPC::ParamTraits<base::SharedMemoryHandle>::Read( | 108 !IPC::ParamTraits<base::SharedMemoryHandle>::Read( |
| 109 m, iter, &r->input_buffer_handle_) || | 109 m, iter, &r->input_buffer_handle) || |
| 110 !IPC::ParamTraits<base::SharedMemoryHandle>::Read( | 110 !IPC::ParamTraits<base::SharedMemoryHandle>::Read( |
| 111 m, iter, &r->output_buffer_handle_)) | 111 m, iter, &r->output_buffer_handle)) |
| 112 return false; | 112 return false; |
| 113 return true; | 113 return true; |
| 114 } | 114 } |
| 115 | 115 |
| 116 void ParamTraits<GpuVideoDecoderInitDoneParam>::Log( | 116 void ParamTraits<GpuVideoDecoderInitDoneParam>::Log( |
| 117 const GpuVideoDecoderInitDoneParam& p, std::string* l) { | 117 const GpuVideoDecoderInitDoneParam& p, std::string* l) { |
| 118 l->append(StringPrintf("(%d)", p.stride_)); | 118 l->append(StringPrintf("(%d)", p.stride)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 /////////////////////////////////////////////////////////////////////////////// | 121 /////////////////////////////////////////////////////////////////////////////// |
| 122 | 122 |
| 123 void ParamTraits<GpuVideoDecoderInputBufferParam>::Write( | 123 void ParamTraits<GpuVideoDecoderInputBufferParam>::Write( |
| 124 Message* m, const GpuVideoDecoderInputBufferParam& p) { | 124 Message* m, const GpuVideoDecoderInputBufferParam& p) { |
| 125 m->WriteInt64(p.timestamp_); | 125 m->WriteInt64(p.timestamp); |
| 126 m->WriteInt(p.offset_); | 126 m->WriteInt(p.offset); |
| 127 m->WriteInt(p.size_); | 127 m->WriteInt(p.size); |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool ParamTraits<GpuVideoDecoderInputBufferParam>::Read( | 130 bool ParamTraits<GpuVideoDecoderInputBufferParam>::Read( |
| 131 const Message* m, void** iter, GpuVideoDecoderInputBufferParam* r) { | 131 const Message* m, void** iter, GpuVideoDecoderInputBufferParam* r) { |
| 132 if (!m->ReadInt64(iter, &r->timestamp_) || | 132 if (!m->ReadInt64(iter, &r->timestamp) || |
| 133 !m->ReadInt(iter, &r->offset_) || | 133 !m->ReadInt(iter, &r->offset) || |
| 134 !m->ReadInt(iter, &r->size_)) | 134 !m->ReadInt(iter, &r->size)) |
| 135 return false; | 135 return false; |
| 136 return true; | 136 return true; |
| 137 } | 137 } |
| 138 | 138 |
| 139 void ParamTraits<GpuVideoDecoderInputBufferParam>::Log( | 139 void ParamTraits<GpuVideoDecoderInputBufferParam>::Log( |
| 140 const GpuVideoDecoderInputBufferParam& p, std::string* l) { | 140 const GpuVideoDecoderInputBufferParam& p, std::string* l) { |
| 141 l->append(StringPrintf("(%d %d %d)", | 141 l->append(StringPrintf("(%d %d %d)", |
| 142 static_cast<int>(p.timestamp_), | 142 static_cast<int>(p.timestamp), |
| 143 p.offset_, p.size_)); | 143 p.offset, p.size)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 /////////////////////////////////////////////////////////////////////////////// | 146 /////////////////////////////////////////////////////////////////////////////// |
| 147 | 147 |
| 148 void ParamTraits<GpuVideoDecoderOutputBufferParam>::Write( | 148 void ParamTraits<GpuVideoDecoderOutputBufferParam>::Write( |
| 149 Message* m, const GpuVideoDecoderOutputBufferParam& p) { | 149 Message* m, const GpuVideoDecoderOutputBufferParam& p) { |
| 150 m->WriteInt64(p.timestamp_); | 150 m->WriteInt64(p.timestamp); |
| 151 m->WriteInt64(p.duration_); | 151 m->WriteInt64(p.duration); |
| 152 m->WriteInt(p.flags_); | 152 m->WriteInt(p.flags); |
| 153 m->WriteInt(p.texture); |
| 153 } | 154 } |
| 154 | 155 |
| 155 bool ParamTraits<GpuVideoDecoderOutputBufferParam>::Read( | 156 bool ParamTraits<GpuVideoDecoderOutputBufferParam>::Read( |
| 156 const Message* m, void** iter, GpuVideoDecoderOutputBufferParam* r) { | 157 const Message* m, void** iter, GpuVideoDecoderOutputBufferParam* r) { |
| 157 if (!m->ReadInt64(iter, &r->timestamp_) || | 158 if (!m->ReadInt64(iter, &r->timestamp) || |
| 158 !m->ReadInt64(iter, &r->duration_) || | 159 !m->ReadInt64(iter, &r->duration) || |
| 159 !m->ReadInt(iter, &r->flags_)) | 160 !m->ReadInt(iter, &r->flags) || |
| 161 !m->ReadInt(iter, &r->texture)) |
| 160 return false; | 162 return false; |
| 161 return true; | 163 return true; |
| 162 } | 164 } |
| 163 | 165 |
| 164 void ParamTraits<GpuVideoDecoderOutputBufferParam>::Log( | 166 void ParamTraits<GpuVideoDecoderOutputBufferParam>::Log( |
| 165 const GpuVideoDecoderOutputBufferParam& p, std::string* l) { | 167 const GpuVideoDecoderOutputBufferParam& p, std::string* l) { |
| 166 l->append(StringPrintf("(%d %d) %x", | 168 l->append(StringPrintf("(%d %d) %x texture = x%d", |
| 167 static_cast<int>(p.timestamp_), | 169 static_cast<int>(p.timestamp), |
| 168 static_cast<int>(p.duration_), | 170 static_cast<int>(p.duration), |
| 169 p.flags_)); | 171 p.flags, |
| 172 p.texture)); |
| 170 } | 173 } |
| 171 | 174 |
| 172 /////////////////////////////////////////////////////////////////////////////// | 175 /////////////////////////////////////////////////////////////////////////////// |
| 173 | 176 |
| 174 void ParamTraits<GpuVideoDecoderErrorInfoParam>::Write( | 177 void ParamTraits<GpuVideoDecoderErrorInfoParam>::Write( |
| 175 Message* m, const GpuVideoDecoderErrorInfoParam& p) { | 178 Message* m, const GpuVideoDecoderErrorInfoParam& p) { |
| 176 m->WriteInt(p.error_id); | 179 m->WriteInt(p.error_id); |
| 177 } | 180 } |
| 178 | 181 |
| 179 bool ParamTraits<GpuVideoDecoderErrorInfoParam>::Read( | 182 bool ParamTraits<GpuVideoDecoderErrorInfoParam>::Read( |
| 180 const Message* m, void** iter, GpuVideoDecoderErrorInfoParam* r) { | 183 const Message* m, void** iter, GpuVideoDecoderErrorInfoParam* r) { |
| 181 if (!m->ReadInt(iter, &r->error_id)) | 184 if (!m->ReadInt(iter, &r->error_id)) |
| 182 return false; | 185 return false; |
| 183 return true; | 186 return true; |
| 184 } | 187 } |
| 185 | 188 |
| 186 void ParamTraits<GpuVideoDecoderErrorInfoParam>::Log( | 189 void ParamTraits<GpuVideoDecoderErrorInfoParam>::Log( |
| 187 const GpuVideoDecoderErrorInfoParam& p, std::string* l) { | 190 const GpuVideoDecoderErrorInfoParam& p, std::string* l) { |
| 188 l->append(StringPrintf("(%d)", p.error_id)); | 191 l->append(StringPrintf("(%d)", p.error_id)); |
| 189 } | 192 } |
| 190 | 193 |
| 191 /////////////////////////////////////////////////////////////////////////////// | 194 /////////////////////////////////////////////////////////////////////////////// |
| 192 | 195 |
| 193 void ParamTraits<GpuVideoDecoderFormatChangeParam>::Write( | 196 void ParamTraits<GpuVideoDecoderFormatChangeParam>::Write( |
| 194 Message* m, const GpuVideoDecoderFormatChangeParam& p) { | 197 Message* m, const GpuVideoDecoderFormatChangeParam& p) { |
| 195 m->WriteInt(p.input_buffer_size_); | 198 m->WriteInt(p.input_buffer_size); |
| 196 m->WriteInt(p.output_buffer_size_); | 199 m->WriteInt(p.output_buffer_size); |
| 197 } | 200 } |
| 198 | 201 |
| 199 bool ParamTraits<GpuVideoDecoderFormatChangeParam>::Read( | 202 bool ParamTraits<GpuVideoDecoderFormatChangeParam>::Read( |
| 200 const Message* m, void** iter, GpuVideoDecoderFormatChangeParam* r) { | 203 const Message* m, void** iter, GpuVideoDecoderFormatChangeParam* r) { |
| 201 if (!m->ReadInt(iter, &r->input_buffer_size_) || | 204 if (!m->ReadInt(iter, &r->input_buffer_size) || |
| 202 !m->ReadInt(iter, &r->output_buffer_size_)) | 205 !m->ReadInt(iter, &r->output_buffer_size)) |
| 203 return false; | 206 return false; |
| 204 return true; | 207 return true; |
| 205 } | 208 } |
| 206 | 209 |
| 207 void ParamTraits<GpuVideoDecoderFormatChangeParam>::Log( | 210 void ParamTraits<GpuVideoDecoderFormatChangeParam>::Log( |
| 208 const GpuVideoDecoderFormatChangeParam& p, std::string* l) { | 211 const GpuVideoDecoderFormatChangeParam& p, std::string* l) { |
| 209 l->append(StringPrintf("(%d %d)", p.input_buffer_size_, | 212 l->append(StringPrintf("(%d %d)", p.input_buffer_size, |
| 210 p.output_buffer_size_)); | 213 p.output_buffer_size)); |
| 211 } | 214 } |
| 212 }; | 215 }; |
| OLD | NEW |