OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 library audio_track_mojom; | 5 library audio_track_mojom; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:mojo/bindings.dart' as bindings; | 7 import 'package:mojo/bindings.dart' as bindings; |
8 import 'package:mojo/core.dart' as core; | 8 import 'package:mojo/core.dart' as core; |
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
10 import 'package:mojo_services/mojo/media/media_transport.mojom.dart' as media_tr
ansport_mojom; | 10 import 'package:mojo_services/mojo/media/media_transport.mojom.dart' as media_tr
ansport_mojom; |
11 import 'package:mojo_services/mojo/media/media_types.mojom.dart' as media_types_
mojom; | 11 import 'package:mojo_services/mojo/media/media_types.mojom.dart' as media_types_
mojom; |
12 import 'package:mojo_services/mojo/media/rate_control.mojom.dart' as rate_contro
l_mojom; | 12 import 'package:mojo_services/mojo/media/timeline_controller.mojom.dart' as time
line_controller_mojom; |
13 | 13 |
14 | 14 |
15 | 15 |
16 class AudioTrackDescriptor extends bindings.Struct { | 16 class AudioTrackDescriptor extends bindings.Struct { |
17 static const List<bindings.StructDataHeader> kVersions = const [ | 17 static const List<bindings.StructDataHeader> kVersions = const [ |
18 const bindings.StructDataHeader(16, 0) | 18 const bindings.StructDataHeader(16, 0) |
19 ]; | 19 ]; |
20 List<media_types_mojom.MediaTypeSet> supportedMediaTypes = null; | 20 List<media_types_mojom.MediaTypeSet> supportedMediaTypes = null; |
21 | 21 |
22 AudioTrackDescriptor() : super(kVersions.last.size); | 22 AudioTrackDescriptor() : super(kVersions.last.size); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 "pipe: $pipe" ")"; | 411 "pipe: $pipe" ")"; |
412 } | 412 } |
413 | 413 |
414 Map toJson() { | 414 Map toJson() { |
415 throw new bindings.MojoCodecError( | 415 throw new bindings.MojoCodecError( |
416 'Object containing handles cannot be encoded to JSON.'); | 416 'Object containing handles cannot be encoded to JSON.'); |
417 } | 417 } |
418 } | 418 } |
419 | 419 |
420 | 420 |
421 class _AudioTrackGetRateControlParams extends bindings.Struct { | 421 class _AudioTrackGetTimelineControlSiteParams extends bindings.Struct { |
422 static const List<bindings.StructDataHeader> kVersions = const [ | 422 static const List<bindings.StructDataHeader> kVersions = const [ |
423 const bindings.StructDataHeader(16, 0) | 423 const bindings.StructDataHeader(16, 0) |
424 ]; | 424 ]; |
425 rate_control_mojom.RateControlInterfaceRequest rateControl = null; | 425 Object timelineControlSite = null; |
426 | 426 |
427 _AudioTrackGetRateControlParams() : super(kVersions.last.size); | 427 _AudioTrackGetTimelineControlSiteParams() : super(kVersions.last.size); |
428 | 428 |
429 static _AudioTrackGetRateControlParams deserialize(bindings.Message message) { | 429 static _AudioTrackGetTimelineControlSiteParams deserialize(bindings.Message me
ssage) { |
430 var decoder = new bindings.Decoder(message); | 430 var decoder = new bindings.Decoder(message); |
431 var result = decode(decoder); | 431 var result = decode(decoder); |
432 if (decoder.excessHandles != null) { | 432 if (decoder.excessHandles != null) { |
433 decoder.excessHandles.forEach((h) => h.close()); | 433 decoder.excessHandles.forEach((h) => h.close()); |
434 } | 434 } |
435 return result; | 435 return result; |
436 } | 436 } |
437 | 437 |
438 static _AudioTrackGetRateControlParams decode(bindings.Decoder decoder0) { | 438 static _AudioTrackGetTimelineControlSiteParams decode(bindings.Decoder decoder
0) { |
439 if (decoder0 == null) { | 439 if (decoder0 == null) { |
440 return null; | 440 return null; |
441 } | 441 } |
442 _AudioTrackGetRateControlParams result = new _AudioTrackGetRateControlParams
(); | 442 _AudioTrackGetTimelineControlSiteParams result = new _AudioTrackGetTimelineC
ontrolSiteParams(); |
443 | 443 |
444 var mainDataHeader = decoder0.decodeStructDataHeader(); | 444 var mainDataHeader = decoder0.decodeStructDataHeader(); |
445 if (mainDataHeader.version <= kVersions.last.version) { | 445 if (mainDataHeader.version <= kVersions.last.version) { |
446 // Scan in reverse order to optimize for more recent versions. | 446 // Scan in reverse order to optimize for more recent versions. |
447 for (int i = kVersions.length - 1; i >= 0; --i) { | 447 for (int i = kVersions.length - 1; i >= 0; --i) { |
448 if (mainDataHeader.version >= kVersions[i].version) { | 448 if (mainDataHeader.version >= kVersions[i].version) { |
449 if (mainDataHeader.size == kVersions[i].size) { | 449 if (mainDataHeader.size == kVersions[i].size) { |
450 // Found a match. | 450 // Found a match. |
451 break; | 451 break; |
452 } | 452 } |
453 throw new bindings.MojoCodecError( | 453 throw new bindings.MojoCodecError( |
454 'Header size doesn\'t correspond to known version size.'); | 454 'Header size doesn\'t correspond to known version size.'); |
455 } | 455 } |
456 } | 456 } |
457 } else if (mainDataHeader.size < kVersions.last.size) { | 457 } else if (mainDataHeader.size < kVersions.last.size) { |
458 throw new bindings.MojoCodecError( | 458 throw new bindings.MojoCodecError( |
459 'Message newer than the last known version cannot be shorter than ' | 459 'Message newer than the last known version cannot be shorter than ' |
460 'required by the last known version.'); | 460 'required by the last known version.'); |
461 } | 461 } |
462 if (mainDataHeader.version >= 0) { | 462 if (mainDataHeader.version >= 0) { |
463 | 463 |
464 result.rateControl = decoder0.decodeInterfaceRequest(8, false, rate_contro
l_mojom.RateControlStub.newFromEndpoint); | 464 result.timelineControlSite = decoder0.decodeInterfaceRequest(8, false, tim
eline_controller_mojom.MediaTimelineControlSiteStub.newFromEndpoint); |
465 } | 465 } |
466 return result; | 466 return result; |
467 } | 467 } |
468 | 468 |
469 void encode(bindings.Encoder encoder) { | 469 void encode(bindings.Encoder encoder) { |
470 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | 470 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
471 try { | 471 try { |
472 encoder0.encodeInterfaceRequest(rateControl, 8, false); | 472 encoder0.encodeInterfaceRequest(timelineControlSite, 8, false); |
473 } on bindings.MojoCodecError catch(e) { | 473 } on bindings.MojoCodecError catch(e) { |
474 e.message = "Error encountered while encoding field " | 474 e.message = "Error encountered while encoding field " |
475 "rateControl of struct _AudioTrackGetRateControlParams: $e"; | 475 "timelineControlSite of struct _AudioTrackGetTimelineControlSiteParams
: $e"; |
476 rethrow; | 476 rethrow; |
477 } | 477 } |
478 } | 478 } |
479 | 479 |
480 String toString() { | 480 String toString() { |
481 return "_AudioTrackGetRateControlParams(" | 481 return "_AudioTrackGetTimelineControlSiteParams(" |
482 "rateControl: $rateControl" ")"; | 482 "timelineControlSite: $timelineControlSite" ")"; |
483 } | 483 } |
484 | 484 |
485 Map toJson() { | 485 Map toJson() { |
486 throw new bindings.MojoCodecError( | 486 throw new bindings.MojoCodecError( |
487 'Object containing handles cannot be encoded to JSON.'); | 487 'Object containing handles cannot be encoded to JSON.'); |
488 } | 488 } |
489 } | 489 } |
490 | 490 |
491 | 491 |
492 class _AudioTrackSetGainParams extends bindings.Struct { | 492 class _AudioTrackSetGainParams extends bindings.Struct { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 555 |
556 Map toJson() { | 556 Map toJson() { |
557 Map map = new Map(); | 557 Map map = new Map(); |
558 map["dbGain"] = dbGain; | 558 map["dbGain"] = dbGain; |
559 return map; | 559 return map; |
560 } | 560 } |
561 } | 561 } |
562 | 562 |
563 const int _audioTrackMethodDescribeName = 0; | 563 const int _audioTrackMethodDescribeName = 0; |
564 const int _audioTrackMethodConfigureName = 1; | 564 const int _audioTrackMethodConfigureName = 1; |
565 const int _audioTrackMethodGetRateControlName = 2; | 565 const int _audioTrackMethodGetTimelineControlSiteName = 2; |
566 const int _audioTrackMethodSetGainName = 3; | 566 const int _audioTrackMethodSetGainName = 3; |
567 | 567 |
568 class _AudioTrackServiceDescription implements service_describer.ServiceDescript
ion { | 568 class _AudioTrackServiceDescription implements service_describer.ServiceDescript
ion { |
569 dynamic getTopLevelInterface([Function responseFactory]) => | 569 dynamic getTopLevelInterface([Function responseFactory]) => |
570 responseFactory(null); | 570 responseFactory(null); |
571 | 571 |
572 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 572 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
573 responseFactory(null); | 573 responseFactory(null); |
574 | 574 |
575 dynamic getAllTypeDefinitions([Function responseFactory]) => | 575 dynamic getAllTypeDefinitions([Function responseFactory]) => |
(...skipping 16 matching lines...) Expand all Loading... |
592 AudioTrackProxy p = new AudioTrackProxy.unbound(); | 592 AudioTrackProxy p = new AudioTrackProxy.unbound(); |
593 String name = serviceName ?? AudioTrack.serviceName; | 593 String name = serviceName ?? AudioTrack.serviceName; |
594 if ((name == null) || name.isEmpty) { | 594 if ((name == null) || name.isEmpty) { |
595 throw new core.MojoApiError( | 595 throw new core.MojoApiError( |
596 "If an interface has no ServiceName, then one must be provided."); | 596 "If an interface has no ServiceName, then one must be provided."); |
597 } | 597 } |
598 s.connectToService(url, p, name); | 598 s.connectToService(url, p, name); |
599 return p; | 599 return p; |
600 } | 600 } |
601 dynamic describe([Function responseFactory = null]); | 601 dynamic describe([Function responseFactory = null]); |
602 void configure(AudioTrackConfiguration configuration, media_transport_mojom.Me
diaConsumerInterfaceRequest pipe); | 602 void configure(AudioTrackConfiguration configuration, Object pipe); |
603 void getRateControl(rate_control_mojom.RateControlInterfaceRequest rateControl
); | 603 void getTimelineControlSite(Object timelineControlSite); |
604 void setGain(double dbGain); | 604 void setGain(double dbGain); |
605 static const double kMutedGain = -160.0; | 605 static const double kMutedGain = -160.0; |
606 static const double kMaxGain = 20.0; | 606 static const double kMaxGain = 20.0; |
607 } | 607 } |
608 | 608 |
609 abstract class AudioTrackInterface | 609 abstract class AudioTrackInterface |
610 implements bindings.MojoInterface<AudioTrack>, | 610 implements bindings.MojoInterface<AudioTrack>, |
611 AudioTrack { | 611 AudioTrack { |
612 factory AudioTrackInterface([AudioTrack impl]) => | 612 factory AudioTrackInterface([AudioTrack impl]) => |
613 new AudioTrackStub.unbound(impl); | 613 new AudioTrackStub.unbound(impl); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 if (!ctrl.isBound) { | 712 if (!ctrl.isBound) { |
713 ctrl.proxyError("The Proxy is closed."); | 713 ctrl.proxyError("The Proxy is closed."); |
714 return; | 714 return; |
715 } | 715 } |
716 var params = new _AudioTrackConfigureParams(); | 716 var params = new _AudioTrackConfigureParams(); |
717 params.configuration = configuration; | 717 params.configuration = configuration; |
718 params.pipe = pipe; | 718 params.pipe = pipe; |
719 ctrl.sendMessage(params, | 719 ctrl.sendMessage(params, |
720 _audioTrackMethodConfigureName); | 720 _audioTrackMethodConfigureName); |
721 } | 721 } |
722 void getRateControl(rate_control_mojom.RateControlInterfaceRequest rateControl
) { | 722 void getTimelineControlSite(Object timelineControlSite) { |
723 if (!ctrl.isBound) { | 723 if (!ctrl.isBound) { |
724 ctrl.proxyError("The Proxy is closed."); | 724 ctrl.proxyError("The Proxy is closed."); |
725 return; | 725 return; |
726 } | 726 } |
727 var params = new _AudioTrackGetRateControlParams(); | 727 var params = new _AudioTrackGetTimelineControlSiteParams(); |
728 params.rateControl = rateControl; | 728 params.timelineControlSite = timelineControlSite; |
729 ctrl.sendMessage(params, | 729 ctrl.sendMessage(params, |
730 _audioTrackMethodGetRateControlName); | 730 _audioTrackMethodGetTimelineControlSiteName); |
731 } | 731 } |
732 void setGain(double dbGain) { | 732 void setGain(double dbGain) { |
733 if (!ctrl.isBound) { | 733 if (!ctrl.isBound) { |
734 ctrl.proxyError("The Proxy is closed."); | 734 ctrl.proxyError("The Proxy is closed."); |
735 return; | 735 return; |
736 } | 736 } |
737 var params = new _AudioTrackSetGainParams(); | 737 var params = new _AudioTrackSetGainParams(); |
738 params.dbGain = dbGain; | 738 params.dbGain = dbGain; |
739 ctrl.sendMessage(params, | 739 ctrl.sendMessage(params, |
740 _audioTrackMethodSetGainName); | 740 _audioTrackMethodSetGainName); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 _audioTrackMethodDescribeName, | 797 _audioTrackMethodDescribeName, |
798 message.header.requestId, | 798 message.header.requestId, |
799 bindings.MessageHeader.kMessageIsResponse); | 799 bindings.MessageHeader.kMessageIsResponse); |
800 } | 800 } |
801 break; | 801 break; |
802 case _audioTrackMethodConfigureName: | 802 case _audioTrackMethodConfigureName: |
803 var params = _AudioTrackConfigureParams.deserialize( | 803 var params = _AudioTrackConfigureParams.deserialize( |
804 message.payload); | 804 message.payload); |
805 _impl.configure(params.configuration, params.pipe); | 805 _impl.configure(params.configuration, params.pipe); |
806 break; | 806 break; |
807 case _audioTrackMethodGetRateControlName: | 807 case _audioTrackMethodGetTimelineControlSiteName: |
808 var params = _AudioTrackGetRateControlParams.deserialize( | 808 var params = _AudioTrackGetTimelineControlSiteParams.deserialize( |
809 message.payload); | 809 message.payload); |
810 _impl.getRateControl(params.rateControl); | 810 _impl.getTimelineControlSite(params.timelineControlSite); |
811 break; | 811 break; |
812 case _audioTrackMethodSetGainName: | 812 case _audioTrackMethodSetGainName: |
813 var params = _AudioTrackSetGainParams.deserialize( | 813 var params = _AudioTrackSetGainParams.deserialize( |
814 message.payload); | 814 message.payload); |
815 _impl.setGain(params.dbGain); | 815 _impl.setGain(params.dbGain); |
816 break; | 816 break; |
817 default: | 817 default: |
818 throw new bindings.MojoCodecError("Unexpected message name"); | 818 throw new bindings.MojoCodecError("Unexpected message name"); |
819 break; | 819 break; |
820 } | 820 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 return new AudioTrackStub.fromEndpoint(endpoint); | 871 return new AudioTrackStub.fromEndpoint(endpoint); |
872 } | 872 } |
873 | 873 |
874 | 874 |
875 dynamic describe([Function responseFactory = null]) { | 875 dynamic describe([Function responseFactory = null]) { |
876 return impl.describe(responseFactory); | 876 return impl.describe(responseFactory); |
877 } | 877 } |
878 void configure(AudioTrackConfiguration configuration, media_transport_mojom.Me
diaConsumerInterfaceRequest pipe) { | 878 void configure(AudioTrackConfiguration configuration, media_transport_mojom.Me
diaConsumerInterfaceRequest pipe) { |
879 return impl.configure(configuration, pipe); | 879 return impl.configure(configuration, pipe); |
880 } | 880 } |
881 void getRateControl(rate_control_mojom.RateControlInterfaceRequest rateControl
) { | 881 void getTimelineControlSite(Object timelineControlSite) { |
882 return impl.getRateControl(rateControl); | 882 return impl.getTimelineControlSite(timelineControlSite); |
883 } | 883 } |
884 void setGain(double dbGain) { | 884 void setGain(double dbGain) { |
885 return impl.setGain(dbGain); | 885 return impl.setGain(dbGain); |
886 } | 886 } |
887 } | 887 } |
888 | 888 |
889 | 889 |
890 | 890 |
OLD | NEW |