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