| OLD | NEW |
| 1 // WARNING: DO NOT EDIT. This file was generated by a program. | 1 // WARNING: DO NOT EDIT. This file was generated by a program. |
| 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. | 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. |
| 3 | 3 |
| 4 library audio_track_mojom; | 4 library audio_track_mojom; |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:mojo/bindings.dart' as bindings; | 6 import 'package:mojo/bindings.dart' as bindings; |
| 7 import 'package:mojo/core.dart' as core; | 7 import 'package:mojo/core.dart' as core; |
| 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
| 9 import 'package:mojo_services/mojo/media/media_transport.mojom.dart' as media_tr
ansport_mojom; | |
| 10 import 'package:mojo_services/mojo/media/media_types.mojom.dart' as media_types_
mojom; | |
| 11 import 'package:mojo_services/mojo/media/timeline_controller.mojom.dart' as time
line_controller_mojom; | |
| 12 | 9 |
| 13 | 10 |
| 14 | 11 |
| 15 class AudioTrackDescriptor extends bindings.Struct { | |
| 16 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 17 const bindings.StructDataHeader(16, 0) | |
| 18 ]; | |
| 19 List<media_types_mojom.MediaTypeSet> supportedMediaTypes = null; | |
| 20 | |
| 21 AudioTrackDescriptor() : super(kVersions.last.size); | |
| 22 | |
| 23 AudioTrackDescriptor.init( | |
| 24 List<media_types_mojom.MediaTypeSet> this.supportedMediaTypes | |
| 25 ) : super(kVersions.last.size); | |
| 26 | |
| 27 static AudioTrackDescriptor deserialize(bindings.Message message) { | |
| 28 var decoder = new bindings.Decoder(message); | |
| 29 var result = decode(decoder); | |
| 30 if (decoder.excessHandles != null) { | |
| 31 decoder.excessHandles.forEach((h) => h.close()); | |
| 32 } | |
| 33 return result; | |
| 34 } | |
| 35 | |
| 36 static AudioTrackDescriptor decode(bindings.Decoder decoder0) { | |
| 37 if (decoder0 == null) { | |
| 38 return null; | |
| 39 } | |
| 40 AudioTrackDescriptor result = new AudioTrackDescriptor(); | |
| 41 | |
| 42 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 43 if (mainDataHeader.version <= kVersions.last.version) { | |
| 44 // Scan in reverse order to optimize for more recent versions. | |
| 45 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 46 if (mainDataHeader.version >= kVersions[i].version) { | |
| 47 if (mainDataHeader.size == kVersions[i].size) { | |
| 48 // Found a match. | |
| 49 break; | |
| 50 } | |
| 51 throw new bindings.MojoCodecError( | |
| 52 'Header size doesn\'t correspond to known version size.'); | |
| 53 } | |
| 54 } | |
| 55 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 56 throw new bindings.MojoCodecError( | |
| 57 'Message newer than the last known version cannot be shorter than ' | |
| 58 'required by the last known version.'); | |
| 59 } | |
| 60 if (mainDataHeader.version >= 0) { | |
| 61 | |
| 62 var decoder1 = decoder0.decodePointer(8, false); | |
| 63 { | |
| 64 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified
ArrayLength); | |
| 65 result.supportedMediaTypes = new List<media_types_mojom.MediaTypeSet>(si
1.numElements); | |
| 66 for (int i1 = 0; i1 < si1.numElements; ++i1) { | |
| 67 | |
| 68 var decoder2 = decoder1.decodePointer(bindings.ArrayDataHeader.kHeader
Size + bindings.kPointerSize * i1, false); | |
| 69 result.supportedMediaTypes[i1] = media_types_mojom.MediaTypeSet.decode
(decoder2); | |
| 70 } | |
| 71 } | |
| 72 } | |
| 73 return result; | |
| 74 } | |
| 75 | |
| 76 void encode(bindings.Encoder encoder) { | |
| 77 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
| 78 try { | |
| 79 if (supportedMediaTypes == null) { | |
| 80 encoder0.encodeNullPointer(8, false); | |
| 81 } else { | |
| 82 var encoder1 = encoder0.encodePointerArray(supportedMediaTypes.length, 8
, bindings.kUnspecifiedArrayLength); | |
| 83 for (int i0 = 0; i0 < supportedMediaTypes.length; ++i0) { | |
| 84 encoder1.encodeStruct(supportedMediaTypes[i0], bindings.ArrayDataHeade
r.kHeaderSize + bindings.kPointerSize * i0, false); | |
| 85 } | |
| 86 } | |
| 87 } on bindings.MojoCodecError catch(e) { | |
| 88 e.message = "Error encountered while encoding field " | |
| 89 "supportedMediaTypes of struct AudioTrackDescriptor: $e"; | |
| 90 rethrow; | |
| 91 } | |
| 92 } | |
| 93 | |
| 94 String toString() { | |
| 95 return "AudioTrackDescriptor(" | |
| 96 "supportedMediaTypes: $supportedMediaTypes" ")"; | |
| 97 } | |
| 98 | |
| 99 Map toJson() { | |
| 100 Map map = new Map(); | |
| 101 map["supportedMediaTypes"] = supportedMediaTypes; | |
| 102 return map; | |
| 103 } | |
| 104 } | |
| 105 | |
| 106 | |
| 107 class AudioTrackConfiguration extends bindings.Struct { | |
| 108 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 109 const bindings.StructDataHeader(24, 0) | |
| 110 ]; | |
| 111 media_types_mojom.MediaType mediaType = null; | |
| 112 int audioFrameRatio = 1; | |
| 113 int mediaTimeRatio = 1; | |
| 114 | |
| 115 AudioTrackConfiguration() : super(kVersions.last.size); | |
| 116 | |
| 117 AudioTrackConfiguration.init( | |
| 118 media_types_mojom.MediaType this.mediaType, | |
| 119 int this.audioFrameRatio, | |
| 120 int this.mediaTimeRatio | |
| 121 ) : super(kVersions.last.size); | |
| 122 | |
| 123 static AudioTrackConfiguration deserialize(bindings.Message message) { | |
| 124 var decoder = new bindings.Decoder(message); | |
| 125 var result = decode(decoder); | |
| 126 if (decoder.excessHandles != null) { | |
| 127 decoder.excessHandles.forEach((h) => h.close()); | |
| 128 } | |
| 129 return result; | |
| 130 } | |
| 131 | |
| 132 static AudioTrackConfiguration decode(bindings.Decoder decoder0) { | |
| 133 if (decoder0 == null) { | |
| 134 return null; | |
| 135 } | |
| 136 AudioTrackConfiguration result = new AudioTrackConfiguration(); | |
| 137 | |
| 138 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 139 if (mainDataHeader.version <= kVersions.last.version) { | |
| 140 // Scan in reverse order to optimize for more recent versions. | |
| 141 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 142 if (mainDataHeader.version >= kVersions[i].version) { | |
| 143 if (mainDataHeader.size == kVersions[i].size) { | |
| 144 // Found a match. | |
| 145 break; | |
| 146 } | |
| 147 throw new bindings.MojoCodecError( | |
| 148 'Header size doesn\'t correspond to known version size.'); | |
| 149 } | |
| 150 } | |
| 151 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 152 throw new bindings.MojoCodecError( | |
| 153 'Message newer than the last known version cannot be shorter than ' | |
| 154 'required by the last known version.'); | |
| 155 } | |
| 156 if (mainDataHeader.version >= 0) { | |
| 157 | |
| 158 var decoder1 = decoder0.decodePointer(8, false); | |
| 159 result.mediaType = media_types_mojom.MediaType.decode(decoder1); | |
| 160 } | |
| 161 if (mainDataHeader.version >= 0) { | |
| 162 | |
| 163 result.audioFrameRatio = decoder0.decodeUint32(16); | |
| 164 } | |
| 165 if (mainDataHeader.version >= 0) { | |
| 166 | |
| 167 result.mediaTimeRatio = decoder0.decodeUint32(20); | |
| 168 } | |
| 169 return result; | |
| 170 } | |
| 171 | |
| 172 void encode(bindings.Encoder encoder) { | |
| 173 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
| 174 try { | |
| 175 encoder0.encodeStruct(mediaType, 8, false); | |
| 176 } on bindings.MojoCodecError catch(e) { | |
| 177 e.message = "Error encountered while encoding field " | |
| 178 "mediaType of struct AudioTrackConfiguration: $e"; | |
| 179 rethrow; | |
| 180 } | |
| 181 try { | |
| 182 encoder0.encodeUint32(audioFrameRatio, 16); | |
| 183 } on bindings.MojoCodecError catch(e) { | |
| 184 e.message = "Error encountered while encoding field " | |
| 185 "audioFrameRatio of struct AudioTrackConfiguration: $e"; | |
| 186 rethrow; | |
| 187 } | |
| 188 try { | |
| 189 encoder0.encodeUint32(mediaTimeRatio, 20); | |
| 190 } on bindings.MojoCodecError catch(e) { | |
| 191 e.message = "Error encountered while encoding field " | |
| 192 "mediaTimeRatio of struct AudioTrackConfiguration: $e"; | |
| 193 rethrow; | |
| 194 } | |
| 195 } | |
| 196 | |
| 197 String toString() { | |
| 198 return "AudioTrackConfiguration(" | |
| 199 "mediaType: $mediaType" ", " | |
| 200 "audioFrameRatio: $audioFrameRatio" ", " | |
| 201 "mediaTimeRatio: $mediaTimeRatio" ")"; | |
| 202 } | |
| 203 | |
| 204 Map toJson() { | |
| 205 Map map = new Map(); | |
| 206 map["mediaType"] = mediaType; | |
| 207 map["audioFrameRatio"] = audioFrameRatio; | |
| 208 map["mediaTimeRatio"] = mediaTimeRatio; | |
| 209 return map; | |
| 210 } | |
| 211 } | |
| 212 | |
| 213 | |
| 214 class _AudioTrackDescribeParams extends bindings.Struct { | |
| 215 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 216 const bindings.StructDataHeader(8, 0) | |
| 217 ]; | |
| 218 | |
| 219 _AudioTrackDescribeParams() : super(kVersions.last.size); | |
| 220 | |
| 221 _AudioTrackDescribeParams.init( | |
| 222 ) : super(kVersions.last.size); | |
| 223 | |
| 224 static _AudioTrackDescribeParams deserialize(bindings.Message message) { | |
| 225 var decoder = new bindings.Decoder(message); | |
| 226 var result = decode(decoder); | |
| 227 if (decoder.excessHandles != null) { | |
| 228 decoder.excessHandles.forEach((h) => h.close()); | |
| 229 } | |
| 230 return result; | |
| 231 } | |
| 232 | |
| 233 static _AudioTrackDescribeParams decode(bindings.Decoder decoder0) { | |
| 234 if (decoder0 == null) { | |
| 235 return null; | |
| 236 } | |
| 237 _AudioTrackDescribeParams result = new _AudioTrackDescribeParams(); | |
| 238 | |
| 239 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 240 if (mainDataHeader.version <= kVersions.last.version) { | |
| 241 // Scan in reverse order to optimize for more recent versions. | |
| 242 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 243 if (mainDataHeader.version >= kVersions[i].version) { | |
| 244 if (mainDataHeader.size == kVersions[i].size) { | |
| 245 // Found a match. | |
| 246 break; | |
| 247 } | |
| 248 throw new bindings.MojoCodecError( | |
| 249 'Header size doesn\'t correspond to known version size.'); | |
| 250 } | |
| 251 } | |
| 252 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 253 throw new bindings.MojoCodecError( | |
| 254 'Message newer than the last known version cannot be shorter than ' | |
| 255 'required by the last known version.'); | |
| 256 } | |
| 257 return result; | |
| 258 } | |
| 259 | |
| 260 void encode(bindings.Encoder encoder) { | |
| 261 encoder.getStructEncoderAtOffset(kVersions.last); | |
| 262 } | |
| 263 | |
| 264 String toString() { | |
| 265 return "_AudioTrackDescribeParams("")"; | |
| 266 } | |
| 267 | |
| 268 Map toJson() { | |
| 269 Map map = new Map(); | |
| 270 return map; | |
| 271 } | |
| 272 } | |
| 273 | |
| 274 | |
| 275 class AudioTrackDescribeResponseParams extends bindings.Struct { | |
| 276 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 277 const bindings.StructDataHeader(16, 0) | |
| 278 ]; | |
| 279 AudioTrackDescriptor descriptor = null; | |
| 280 | |
| 281 AudioTrackDescribeResponseParams() : super(kVersions.last.size); | |
| 282 | |
| 283 AudioTrackDescribeResponseParams.init( | |
| 284 AudioTrackDescriptor this.descriptor | |
| 285 ) : super(kVersions.last.size); | |
| 286 | |
| 287 static AudioTrackDescribeResponseParams deserialize(bindings.Message message)
{ | |
| 288 var decoder = new bindings.Decoder(message); | |
| 289 var result = decode(decoder); | |
| 290 if (decoder.excessHandles != null) { | |
| 291 decoder.excessHandles.forEach((h) => h.close()); | |
| 292 } | |
| 293 return result; | |
| 294 } | |
| 295 | |
| 296 static AudioTrackDescribeResponseParams decode(bindings.Decoder decoder0) { | |
| 297 if (decoder0 == null) { | |
| 298 return null; | |
| 299 } | |
| 300 AudioTrackDescribeResponseParams result = new AudioTrackDescribeResponsePara
ms(); | |
| 301 | |
| 302 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 303 if (mainDataHeader.version <= kVersions.last.version) { | |
| 304 // Scan in reverse order to optimize for more recent versions. | |
| 305 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 306 if (mainDataHeader.version >= kVersions[i].version) { | |
| 307 if (mainDataHeader.size == kVersions[i].size) { | |
| 308 // Found a match. | |
| 309 break; | |
| 310 } | |
| 311 throw new bindings.MojoCodecError( | |
| 312 'Header size doesn\'t correspond to known version size.'); | |
| 313 } | |
| 314 } | |
| 315 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 316 throw new bindings.MojoCodecError( | |
| 317 'Message newer than the last known version cannot be shorter than ' | |
| 318 'required by the last known version.'); | |
| 319 } | |
| 320 if (mainDataHeader.version >= 0) { | |
| 321 | |
| 322 var decoder1 = decoder0.decodePointer(8, false); | |
| 323 result.descriptor = AudioTrackDescriptor.decode(decoder1); | |
| 324 } | |
| 325 return result; | |
| 326 } | |
| 327 | |
| 328 void encode(bindings.Encoder encoder) { | |
| 329 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
| 330 try { | |
| 331 encoder0.encodeStruct(descriptor, 8, false); | |
| 332 } on bindings.MojoCodecError catch(e) { | |
| 333 e.message = "Error encountered while encoding field " | |
| 334 "descriptor of struct AudioTrackDescribeResponseParams: $e"; | |
| 335 rethrow; | |
| 336 } | |
| 337 } | |
| 338 | |
| 339 String toString() { | |
| 340 return "AudioTrackDescribeResponseParams(" | |
| 341 "descriptor: $descriptor" ")"; | |
| 342 } | |
| 343 | |
| 344 Map toJson() { | |
| 345 Map map = new Map(); | |
| 346 map["descriptor"] = descriptor; | |
| 347 return map; | |
| 348 } | |
| 349 } | |
| 350 | |
| 351 | |
| 352 class _AudioTrackConfigureParams extends bindings.Struct { | |
| 353 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 354 const bindings.StructDataHeader(24, 0) | |
| 355 ]; | |
| 356 AudioTrackConfiguration configuration = null; | |
| 357 media_transport_mojom.MediaConsumerInterfaceRequest pipe = null; | |
| 358 | |
| 359 _AudioTrackConfigureParams() : super(kVersions.last.size); | |
| 360 | |
| 361 _AudioTrackConfigureParams.init( | |
| 362 AudioTrackConfiguration this.configuration, | |
| 363 media_transport_mojom.MediaConsumerInterfaceRequest this.pipe | |
| 364 ) : super(kVersions.last.size); | |
| 365 | |
| 366 static _AudioTrackConfigureParams deserialize(bindings.Message message) { | |
| 367 var decoder = new bindings.Decoder(message); | |
| 368 var result = decode(decoder); | |
| 369 if (decoder.excessHandles != null) { | |
| 370 decoder.excessHandles.forEach((h) => h.close()); | |
| 371 } | |
| 372 return result; | |
| 373 } | |
| 374 | |
| 375 static _AudioTrackConfigureParams decode(bindings.Decoder decoder0) { | |
| 376 if (decoder0 == null) { | |
| 377 return null; | |
| 378 } | |
| 379 _AudioTrackConfigureParams result = new _AudioTrackConfigureParams(); | |
| 380 | |
| 381 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 382 if (mainDataHeader.version <= kVersions.last.version) { | |
| 383 // Scan in reverse order to optimize for more recent versions. | |
| 384 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 385 if (mainDataHeader.version >= kVersions[i].version) { | |
| 386 if (mainDataHeader.size == kVersions[i].size) { | |
| 387 // Found a match. | |
| 388 break; | |
| 389 } | |
| 390 throw new bindings.MojoCodecError( | |
| 391 'Header size doesn\'t correspond to known version size.'); | |
| 392 } | |
| 393 } | |
| 394 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 395 throw new bindings.MojoCodecError( | |
| 396 'Message newer than the last known version cannot be shorter than ' | |
| 397 'required by the last known version.'); | |
| 398 } | |
| 399 if (mainDataHeader.version >= 0) { | |
| 400 | |
| 401 var decoder1 = decoder0.decodePointer(8, false); | |
| 402 result.configuration = AudioTrackConfiguration.decode(decoder1); | |
| 403 } | |
| 404 if (mainDataHeader.version >= 0) { | |
| 405 | |
| 406 result.pipe = decoder0.decodeInterfaceRequest(16, false, media_transport_m
ojom.MediaConsumerStub.newFromEndpoint); | |
| 407 } | |
| 408 return result; | |
| 409 } | |
| 410 | |
| 411 void encode(bindings.Encoder encoder) { | |
| 412 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
| 413 try { | |
| 414 encoder0.encodeStruct(configuration, 8, false); | |
| 415 } on bindings.MojoCodecError catch(e) { | |
| 416 e.message = "Error encountered while encoding field " | |
| 417 "configuration of struct _AudioTrackConfigureParams: $e"; | |
| 418 rethrow; | |
| 419 } | |
| 420 try { | |
| 421 encoder0.encodeInterfaceRequest(pipe, 16, false); | |
| 422 } on bindings.MojoCodecError catch(e) { | |
| 423 e.message = "Error encountered while encoding field " | |
| 424 "pipe of struct _AudioTrackConfigureParams: $e"; | |
| 425 rethrow; | |
| 426 } | |
| 427 } | |
| 428 | |
| 429 String toString() { | |
| 430 return "_AudioTrackConfigureParams(" | |
| 431 "configuration: $configuration" ", " | |
| 432 "pipe: $pipe" ")"; | |
| 433 } | |
| 434 | |
| 435 Map toJson() { | |
| 436 throw new bindings.MojoCodecError( | |
| 437 'Object containing handles cannot be encoded to JSON.'); | |
| 438 } | |
| 439 } | |
| 440 | |
| 441 | |
| 442 class _AudioTrackGetTimelineControlSiteParams extends bindings.Struct { | |
| 443 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 444 const bindings.StructDataHeader(16, 0) | |
| 445 ]; | |
| 446 timeline_controller_mojom.MediaTimelineControlSiteInterfaceRequest timelineCon
trolSite = null; | |
| 447 | |
| 448 _AudioTrackGetTimelineControlSiteParams() : super(kVersions.last.size); | |
| 449 | |
| 450 _AudioTrackGetTimelineControlSiteParams.init( | |
| 451 timeline_controller_mojom.MediaTimelineControlSiteInterfaceRequest this.time
lineControlSite | |
| 452 ) : super(kVersions.last.size); | |
| 453 | |
| 454 static _AudioTrackGetTimelineControlSiteParams deserialize(bindings.Message me
ssage) { | |
| 455 var decoder = new bindings.Decoder(message); | |
| 456 var result = decode(decoder); | |
| 457 if (decoder.excessHandles != null) { | |
| 458 decoder.excessHandles.forEach((h) => h.close()); | |
| 459 } | |
| 460 return result; | |
| 461 } | |
| 462 | |
| 463 static _AudioTrackGetTimelineControlSiteParams decode(bindings.Decoder decoder
0) { | |
| 464 if (decoder0 == null) { | |
| 465 return null; | |
| 466 } | |
| 467 _AudioTrackGetTimelineControlSiteParams result = new _AudioTrackGetTimelineC
ontrolSiteParams(); | |
| 468 | |
| 469 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 470 if (mainDataHeader.version <= kVersions.last.version) { | |
| 471 // Scan in reverse order to optimize for more recent versions. | |
| 472 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 473 if (mainDataHeader.version >= kVersions[i].version) { | |
| 474 if (mainDataHeader.size == kVersions[i].size) { | |
| 475 // Found a match. | |
| 476 break; | |
| 477 } | |
| 478 throw new bindings.MojoCodecError( | |
| 479 'Header size doesn\'t correspond to known version size.'); | |
| 480 } | |
| 481 } | |
| 482 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 483 throw new bindings.MojoCodecError( | |
| 484 'Message newer than the last known version cannot be shorter than ' | |
| 485 'required by the last known version.'); | |
| 486 } | |
| 487 if (mainDataHeader.version >= 0) { | |
| 488 | |
| 489 result.timelineControlSite = decoder0.decodeInterfaceRequest(8, false, tim
eline_controller_mojom.MediaTimelineControlSiteStub.newFromEndpoint); | |
| 490 } | |
| 491 return result; | |
| 492 } | |
| 493 | |
| 494 void encode(bindings.Encoder encoder) { | |
| 495 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
| 496 try { | |
| 497 encoder0.encodeInterfaceRequest(timelineControlSite, 8, false); | |
| 498 } on bindings.MojoCodecError catch(e) { | |
| 499 e.message = "Error encountered while encoding field " | |
| 500 "timelineControlSite of struct _AudioTrackGetTimelineControlSiteParams
: $e"; | |
| 501 rethrow; | |
| 502 } | |
| 503 } | |
| 504 | |
| 505 String toString() { | |
| 506 return "_AudioTrackGetTimelineControlSiteParams(" | |
| 507 "timelineControlSite: $timelineControlSite" ")"; | |
| 508 } | |
| 509 | |
| 510 Map toJson() { | |
| 511 throw new bindings.MojoCodecError( | |
| 512 'Object containing handles cannot be encoded to JSON.'); | |
| 513 } | |
| 514 } | |
| 515 | |
| 516 | |
| 517 class _AudioTrackSetGainParams extends bindings.Struct { | 12 class _AudioTrackSetGainParams extends bindings.Struct { |
| 518 static const List<bindings.StructDataHeader> kVersions = const [ | 13 static const List<bindings.StructDataHeader> kVersions = const [ |
| 519 const bindings.StructDataHeader(16, 0) | 14 const bindings.StructDataHeader(16, 0) |
| 520 ]; | 15 ]; |
| 521 double dbGain = 0.0; | 16 double dbGain = 0.0; |
| 522 | 17 |
| 523 _AudioTrackSetGainParams() : super(kVersions.last.size); | 18 _AudioTrackSetGainParams() : super(kVersions.last.size); |
| 524 | 19 |
| 525 _AudioTrackSetGainParams.init( | 20 _AudioTrackSetGainParams.init( |
| 526 double this.dbGain | 21 double this.dbGain |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 "dbGain: $dbGain" ")"; | 77 "dbGain: $dbGain" ")"; |
| 583 } | 78 } |
| 584 | 79 |
| 585 Map toJson() { | 80 Map toJson() { |
| 586 Map map = new Map(); | 81 Map map = new Map(); |
| 587 map["dbGain"] = dbGain; | 82 map["dbGain"] = dbGain; |
| 588 return map; | 83 return map; |
| 589 } | 84 } |
| 590 } | 85 } |
| 591 | 86 |
| 592 const int _audioTrackMethodDescribeName = 0; | 87 const int _audioTrackMethodSetGainName = 0; |
| 593 const int _audioTrackMethodConfigureName = 1; | |
| 594 const int _audioTrackMethodGetTimelineControlSiteName = 2; | |
| 595 const int _audioTrackMethodSetGainName = 3; | |
| 596 | 88 |
| 597 class _AudioTrackServiceDescription implements service_describer.ServiceDescript
ion { | 89 class _AudioTrackServiceDescription implements service_describer.ServiceDescript
ion { |
| 598 void getTopLevelInterface(Function responder) { | 90 void getTopLevelInterface(Function responder) { |
| 599 responder(null); | 91 responder(null); |
| 600 } | 92 } |
| 601 | 93 |
| 602 void getTypeDefinition(String typeKey, Function responder) { | 94 void getTypeDefinition(String typeKey, Function responder) { |
| 603 responder(null); | 95 responder(null); |
| 604 } | 96 } |
| 605 | 97 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 623 bindings.ServiceConnector s, String url, [String serviceName]) { | 115 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 624 AudioTrackProxy p = new AudioTrackProxy.unbound(); | 116 AudioTrackProxy p = new AudioTrackProxy.unbound(); |
| 625 String name = serviceName ?? AudioTrack.serviceName; | 117 String name = serviceName ?? AudioTrack.serviceName; |
| 626 if ((name == null) || name.isEmpty) { | 118 if ((name == null) || name.isEmpty) { |
| 627 throw new core.MojoApiError( | 119 throw new core.MojoApiError( |
| 628 "If an interface has no ServiceName, then one must be provided."); | 120 "If an interface has no ServiceName, then one must be provided."); |
| 629 } | 121 } |
| 630 s.connectToService(url, p, name); | 122 s.connectToService(url, p, name); |
| 631 return p; | 123 return p; |
| 632 } | 124 } |
| 633 void describe(void callback(AudioTrackDescriptor descriptor)); | |
| 634 void configure(AudioTrackConfiguration configuration, media_transport_mojom.Me
diaConsumerInterfaceRequest pipe); | |
| 635 void getTimelineControlSite(timeline_controller_mojom.MediaTimelineControlSite
InterfaceRequest timelineControlSite); | |
| 636 void setGain(double dbGain); | 125 void setGain(double dbGain); |
| 637 static const double kMutedGain = -160.0; | 126 static const double kMutedGain = -160.0; |
| 638 static const double kMaxGain = 20.0; | 127 static const double kMaxGain = 20.0; |
| 639 } | 128 } |
| 640 | 129 |
| 641 abstract class AudioTrackInterface | 130 abstract class AudioTrackInterface |
| 642 implements bindings.MojoInterface<AudioTrack>, | 131 implements bindings.MojoInterface<AudioTrack>, |
| 643 AudioTrack { | 132 AudioTrack { |
| 644 factory AudioTrackInterface([AudioTrack impl]) => | 133 factory AudioTrackInterface([AudioTrack impl]) => |
| 645 new AudioTrackStub.unbound(impl); | 134 new AudioTrackStub.unbound(impl); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 671 | 160 |
| 672 _AudioTrackProxyControl.fromHandle( | 161 _AudioTrackProxyControl.fromHandle( |
| 673 core.MojoHandle handle) : super.fromHandle(handle); | 162 core.MojoHandle handle) : super.fromHandle(handle); |
| 674 | 163 |
| 675 _AudioTrackProxyControl.unbound() : super.unbound(); | 164 _AudioTrackProxyControl.unbound() : super.unbound(); |
| 676 | 165 |
| 677 String get serviceName => AudioTrack.serviceName; | 166 String get serviceName => AudioTrack.serviceName; |
| 678 | 167 |
| 679 void handleResponse(bindings.ServiceMessage message) { | 168 void handleResponse(bindings.ServiceMessage message) { |
| 680 switch (message.header.type) { | 169 switch (message.header.type) { |
| 681 case _audioTrackMethodDescribeName: | |
| 682 var r = AudioTrackDescribeResponseParams.deserialize( | |
| 683 message.payload); | |
| 684 if (!message.header.hasRequestId) { | |
| 685 proxyError("Expected a message with a valid request Id."); | |
| 686 return; | |
| 687 } | |
| 688 Function callback = callbackMap[message.header.requestId]; | |
| 689 if (callback == null) { | |
| 690 proxyError( | |
| 691 "Message had unknown request Id: ${message.header.requestId}"); | |
| 692 return; | |
| 693 } | |
| 694 callbackMap.remove(message.header.requestId); | |
| 695 callback(r.descriptor ); | |
| 696 break; | |
| 697 default: | 170 default: |
| 698 proxyError("Unexpected message type: ${message.header.type}"); | 171 proxyError("Unexpected message type: ${message.header.type}"); |
| 699 close(immediate: true); | 172 close(immediate: true); |
| 700 break; | 173 break; |
| 701 } | 174 } |
| 702 } | 175 } |
| 703 | 176 |
| 704 @override | 177 @override |
| 705 String toString() { | 178 String toString() { |
| 706 var superString = super.toString(); | 179 var superString = super.toString(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 730 return newMockedProxy; | 203 return newMockedProxy; |
| 731 } | 204 } |
| 732 | 205 |
| 733 static AudioTrackProxy newFromEndpoint( | 206 static AudioTrackProxy newFromEndpoint( |
| 734 core.MojoMessagePipeEndpoint endpoint) { | 207 core.MojoMessagePipeEndpoint endpoint) { |
| 735 assert(endpoint.setDescription("For AudioTrackProxy")); | 208 assert(endpoint.setDescription("For AudioTrackProxy")); |
| 736 return new AudioTrackProxy.fromEndpoint(endpoint); | 209 return new AudioTrackProxy.fromEndpoint(endpoint); |
| 737 } | 210 } |
| 738 | 211 |
| 739 | 212 |
| 740 void describe(void callback(AudioTrackDescriptor descriptor)) { | |
| 741 if (impl != null) { | |
| 742 impl.describe(callback); | |
| 743 return; | |
| 744 } | |
| 745 var params = new _AudioTrackDescribeParams(); | |
| 746 Function zonedCallback; | |
| 747 if (identical(Zone.current, Zone.ROOT)) { | |
| 748 zonedCallback = callback; | |
| 749 } else { | |
| 750 Zone z = Zone.current; | |
| 751 zonedCallback = ((AudioTrackDescriptor descriptor) { | |
| 752 z.bindCallback(() { | |
| 753 callback(descriptor); | |
| 754 })(); | |
| 755 }); | |
| 756 } | |
| 757 ctrl.sendMessageWithRequestId( | |
| 758 params, | |
| 759 _audioTrackMethodDescribeName, | |
| 760 -1, | |
| 761 bindings.MessageHeader.kMessageExpectsResponse, | |
| 762 zonedCallback); | |
| 763 } | |
| 764 void configure(AudioTrackConfiguration configuration, media_transport_mojom.Me
diaConsumerInterfaceRequest pipe) { | |
| 765 if (impl != null) { | |
| 766 impl.configure(configuration, pipe); | |
| 767 return; | |
| 768 } | |
| 769 if (!ctrl.isBound) { | |
| 770 ctrl.proxyError("The Proxy is closed."); | |
| 771 return; | |
| 772 } | |
| 773 var params = new _AudioTrackConfigureParams(); | |
| 774 params.configuration = configuration; | |
| 775 params.pipe = pipe; | |
| 776 ctrl.sendMessage(params, | |
| 777 _audioTrackMethodConfigureName); | |
| 778 } | |
| 779 void getTimelineControlSite(timeline_controller_mojom.MediaTimelineControlSite
InterfaceRequest timelineControlSite) { | |
| 780 if (impl != null) { | |
| 781 impl.getTimelineControlSite(timelineControlSite); | |
| 782 return; | |
| 783 } | |
| 784 if (!ctrl.isBound) { | |
| 785 ctrl.proxyError("The Proxy is closed."); | |
| 786 return; | |
| 787 } | |
| 788 var params = new _AudioTrackGetTimelineControlSiteParams(); | |
| 789 params.timelineControlSite = timelineControlSite; | |
| 790 ctrl.sendMessage(params, | |
| 791 _audioTrackMethodGetTimelineControlSiteName); | |
| 792 } | |
| 793 void setGain(double dbGain) { | 213 void setGain(double dbGain) { |
| 794 if (impl != null) { | 214 if (impl != null) { |
| 795 impl.setGain(dbGain); | 215 impl.setGain(dbGain); |
| 796 return; | 216 return; |
| 797 } | 217 } |
| 798 if (!ctrl.isBound) { | 218 if (!ctrl.isBound) { |
| 799 ctrl.proxyError("The Proxy is closed."); | 219 ctrl.proxyError("The Proxy is closed."); |
| 800 return; | 220 return; |
| 801 } | 221 } |
| 802 var params = new _AudioTrackSetGainParams(); | 222 var params = new _AudioTrackSetGainParams(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 821 core.MojoHandle handle, [AudioTrack impl]) | 241 core.MojoHandle handle, [AudioTrack impl]) |
| 822 : super.fromHandle(handle, autoBegin: impl != null) { | 242 : super.fromHandle(handle, autoBegin: impl != null) { |
| 823 _impl = impl; | 243 _impl = impl; |
| 824 } | 244 } |
| 825 | 245 |
| 826 _AudioTrackStubControl.unbound([this._impl]) : super.unbound(); | 246 _AudioTrackStubControl.unbound([this._impl]) : super.unbound(); |
| 827 | 247 |
| 828 String get serviceName => AudioTrack.serviceName; | 248 String get serviceName => AudioTrack.serviceName; |
| 829 | 249 |
| 830 | 250 |
| 831 Function _audioTrackDescribeResponseParamsResponder( | |
| 832 int requestId) { | |
| 833 return (AudioTrackDescriptor descriptor) { | |
| 834 var result = new AudioTrackDescribeResponseParams(); | |
| 835 result.descriptor = descriptor; | |
| 836 sendResponse(buildResponseWithId( | |
| 837 result, | |
| 838 _audioTrackMethodDescribeName, | |
| 839 requestId, | |
| 840 bindings.MessageHeader.kMessageIsResponse)); | |
| 841 }; | |
| 842 } | |
| 843 | 251 |
| 844 void handleMessage(bindings.ServiceMessage message) { | 252 void handleMessage(bindings.ServiceMessage message) { |
| 845 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 253 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 846 bindings.ControlMessageHandler.handleMessage( | 254 bindings.ControlMessageHandler.handleMessage( |
| 847 this, 0, message); | 255 this, 0, message); |
| 848 return; | 256 return; |
| 849 } | 257 } |
| 850 if (_impl == null) { | 258 if (_impl == null) { |
| 851 throw new core.MojoApiError("$this has no implementation set"); | 259 throw new core.MojoApiError("$this has no implementation set"); |
| 852 } | 260 } |
| 853 switch (message.header.type) { | 261 switch (message.header.type) { |
| 854 case _audioTrackMethodDescribeName: | |
| 855 _impl.describe(_audioTrackDescribeResponseParamsResponder(message.header
.requestId)); | |
| 856 break; | |
| 857 case _audioTrackMethodConfigureName: | |
| 858 var params = _AudioTrackConfigureParams.deserialize( | |
| 859 message.payload); | |
| 860 _impl.configure(params.configuration, params.pipe); | |
| 861 break; | |
| 862 case _audioTrackMethodGetTimelineControlSiteName: | |
| 863 var params = _AudioTrackGetTimelineControlSiteParams.deserialize( | |
| 864 message.payload); | |
| 865 _impl.getTimelineControlSite(params.timelineControlSite); | |
| 866 break; | |
| 867 case _audioTrackMethodSetGainName: | 262 case _audioTrackMethodSetGainName: |
| 868 var params = _AudioTrackSetGainParams.deserialize( | 263 var params = _AudioTrackSetGainParams.deserialize( |
| 869 message.payload); | 264 message.payload); |
| 870 _impl.setGain(params.dbGain); | 265 _impl.setGain(params.dbGain); |
| 871 break; | 266 break; |
| 872 default: | 267 default: |
| 873 throw new bindings.MojoCodecError("Unexpected message name"); | 268 throw new bindings.MojoCodecError("Unexpected message name"); |
| 874 break; | 269 break; |
| 875 } | 270 } |
| 876 } | 271 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 core.MojoHandle handle, [AudioTrack impl]) | 314 core.MojoHandle handle, [AudioTrack impl]) |
| 920 : super(new _AudioTrackStubControl.fromHandle(handle, impl)); | 315 : super(new _AudioTrackStubControl.fromHandle(handle, impl)); |
| 921 | 316 |
| 922 static AudioTrackStub newFromEndpoint( | 317 static AudioTrackStub newFromEndpoint( |
| 923 core.MojoMessagePipeEndpoint endpoint) { | 318 core.MojoMessagePipeEndpoint endpoint) { |
| 924 assert(endpoint.setDescription("For AudioTrackStub")); | 319 assert(endpoint.setDescription("For AudioTrackStub")); |
| 925 return new AudioTrackStub.fromEndpoint(endpoint); | 320 return new AudioTrackStub.fromEndpoint(endpoint); |
| 926 } | 321 } |
| 927 | 322 |
| 928 | 323 |
| 929 void describe(void callback(AudioTrackDescriptor descriptor)) { | |
| 930 return impl.describe(callback); | |
| 931 } | |
| 932 void configure(AudioTrackConfiguration configuration, media_transport_mojom.Me
diaConsumerInterfaceRequest pipe) { | |
| 933 return impl.configure(configuration, pipe); | |
| 934 } | |
| 935 void getTimelineControlSite(timeline_controller_mojom.MediaTimelineControlSite
InterfaceRequest timelineControlSite) { | |
| 936 return impl.getTimelineControlSite(timelineControlSite); | |
| 937 } | |
| 938 void setGain(double dbGain) { | 324 void setGain(double dbGain) { |
| 939 return impl.setGain(dbGain); | 325 return impl.setGain(dbGain); |
| 940 } | 326 } |
| 941 } | 327 } |
| 942 | 328 |
| 943 | 329 |
| 944 | 330 |
| OLD | NEW |