| 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; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 abstract class AudioTrack { | 579 abstract class AudioTrack { |
| 580 static const String serviceName = null; | 580 static const String serviceName = null; |
| 581 dynamic describe([Function responseFactory = null]); | 581 dynamic describe([Function responseFactory = null]); |
| 582 void configure(AudioTrackConfiguration configuration, Object pipe); | 582 void configure(AudioTrackConfiguration configuration, Object pipe); |
| 583 void getRateControl(Object rateControl); | 583 void getRateControl(Object rateControl); |
| 584 void setGain(double dbGain); | 584 void setGain(double dbGain); |
| 585 static const double kMutedGain = -160.0; | 585 static const double kMutedGain = -160.0; |
| 586 static const double kMaxGain = 20.0; | 586 static const double kMaxGain = 20.0; |
| 587 } | 587 } |
| 588 | 588 |
| 589 | 589 class _AudioTrackProxyControl |
| 590 class _AudioTrackProxyControl extends bindings.ProxyMessageHandler | 590 extends bindings.ProxyMessageHandler |
| 591 implements bindings.ProxyControl { | 591 implements bindings.ProxyControl { |
| 592 _AudioTrackProxyControl.fromEndpoint( | 592 _AudioTrackProxyControl.fromEndpoint( |
| 593 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 593 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 594 | 594 |
| 595 _AudioTrackProxyControl.fromHandle( | 595 _AudioTrackProxyControl.fromHandle( |
| 596 core.MojoHandle handle) : super.fromHandle(handle); | 596 core.MojoHandle handle) : super.fromHandle(handle); |
| 597 | 597 |
| 598 _AudioTrackProxyControl.unbound() : super.unbound(); | 598 _AudioTrackProxyControl.unbound() : super.unbound(); |
| 599 | 599 |
| 600 service_describer.ServiceDescription get serviceDescription => | 600 service_describer.ServiceDescription get serviceDescription => |
| 601 new _AudioTrackServiceDescription(); | 601 new _AudioTrackServiceDescription(); |
| 602 | 602 |
| 603 String get serviceName => AudioTrack.serviceName; | 603 String get serviceName => AudioTrack.serviceName; |
| 604 | 604 |
| 605 @override | |
| 606 void handleResponse(bindings.ServiceMessage message) { | 605 void handleResponse(bindings.ServiceMessage message) { |
| 607 switch (message.header.type) { | 606 switch (message.header.type) { |
| 608 case _audioTrackMethodDescribeName: | 607 case _audioTrackMethodDescribeName: |
| 609 var r = AudioTrackDescribeResponseParams.deserialize( | 608 var r = AudioTrackDescribeResponseParams.deserialize( |
| 610 message.payload); | 609 message.payload); |
| 611 if (!message.header.hasRequestId) { | 610 if (!message.header.hasRequestId) { |
| 612 proxyError("Expected a message with a valid request Id."); | 611 proxyError("Expected a message with a valid request Id."); |
| 613 return; | 612 return; |
| 614 } | 613 } |
| 615 Completer c = completerMap[message.header.requestId]; | 614 Completer c = completerMap[message.header.requestId]; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 632 } | 631 } |
| 633 } | 632 } |
| 634 | 633 |
| 635 @override | 634 @override |
| 636 String toString() { | 635 String toString() { |
| 637 var superString = super.toString(); | 636 var superString = super.toString(); |
| 638 return "_AudioTrackProxyControl($superString)"; | 637 return "_AudioTrackProxyControl($superString)"; |
| 639 } | 638 } |
| 640 } | 639 } |
| 641 | 640 |
| 642 | 641 class AudioTrackProxy |
| 643 class AudioTrackProxy extends bindings.Proxy | 642 extends bindings.Proxy |
| 644 implements AudioTrack { | 643 implements AudioTrack { |
| 645 AudioTrackProxy.fromEndpoint( | 644 AudioTrackProxy.fromEndpoint( |
| 646 core.MojoMessagePipeEndpoint endpoint) | 645 core.MojoMessagePipeEndpoint endpoint) |
| 647 : super(new _AudioTrackProxyControl.fromEndpoint(endpoint)); | 646 : super(new _AudioTrackProxyControl.fromEndpoint(endpoint)); |
| 648 | 647 |
| 649 AudioTrackProxy.fromHandle(core.MojoHandle handle) | 648 AudioTrackProxy.fromHandle(core.MojoHandle handle) |
| 650 : super(new _AudioTrackProxyControl.fromHandle(handle)); | 649 : super(new _AudioTrackProxyControl.fromHandle(handle)); |
| 651 | 650 |
| 652 AudioTrackProxy.unbound() | 651 AudioTrackProxy.unbound() |
| 653 : super(new _AudioTrackProxyControl.unbound()); | 652 : super(new _AudioTrackProxyControl.unbound()); |
| 654 | 653 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 ctrl.proxyError("The Proxy is closed."); | 699 ctrl.proxyError("The Proxy is closed."); |
| 701 return; | 700 return; |
| 702 } | 701 } |
| 703 var params = new _AudioTrackSetGainParams(); | 702 var params = new _AudioTrackSetGainParams(); |
| 704 params.dbGain = dbGain; | 703 params.dbGain = dbGain; |
| 705 ctrl.sendMessage(params, | 704 ctrl.sendMessage(params, |
| 706 _audioTrackMethodSetGainName); | 705 _audioTrackMethodSetGainName); |
| 707 } | 706 } |
| 708 } | 707 } |
| 709 | 708 |
| 710 | 709 class _AudioTrackStubControl |
| 711 class AudioTrackStub extends bindings.Stub { | 710 extends bindings.StubMessageHandler |
| 711 implements bindings.StubControl<AudioTrack> { |
| 712 AudioTrack _impl; | 712 AudioTrack _impl; |
| 713 | 713 |
| 714 AudioTrackStub.fromEndpoint( | 714 _AudioTrackStubControl.fromEndpoint( |
| 715 core.MojoMessagePipeEndpoint endpoint, [AudioTrack impl]) | 715 core.MojoMessagePipeEndpoint endpoint, [AudioTrack impl]) |
| 716 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 716 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 717 _impl = impl; | 717 _impl = impl; |
| 718 } | 718 } |
| 719 | 719 |
| 720 AudioTrackStub.fromHandle( | 720 _AudioTrackStubControl.fromHandle( |
| 721 core.MojoHandle handle, [AudioTrack impl]) | 721 core.MojoHandle handle, [AudioTrack impl]) |
| 722 : super.fromHandle(handle, autoBegin: impl != null) { | 722 : super.fromHandle(handle, autoBegin: impl != null) { |
| 723 _impl = impl; | 723 _impl = impl; |
| 724 } | 724 } |
| 725 | 725 |
| 726 AudioTrackStub.unbound([this._impl]) : super.unbound(); | 726 _AudioTrackStubControl.unbound([this._impl]) : super.unbound(); |
| 727 | |
| 728 static AudioTrackStub newFromEndpoint( | |
| 729 core.MojoMessagePipeEndpoint endpoint) { | |
| 730 assert(endpoint.setDescription("For AudioTrackStub")); | |
| 731 return new AudioTrackStub.fromEndpoint(endpoint); | |
| 732 } | |
| 733 | 727 |
| 734 | 728 |
| 735 AudioTrackDescribeResponseParams _audioTrackDescribeResponseParamsFactory(Audi
oTrackDescriptor descriptor) { | 729 AudioTrackDescribeResponseParams _audioTrackDescribeResponseParamsFactory(Audi
oTrackDescriptor descriptor) { |
| 736 var result = new AudioTrackDescribeResponseParams(); | 730 var result = new AudioTrackDescribeResponseParams(); |
| 737 result.descriptor = descriptor; | 731 result.descriptor = descriptor; |
| 738 return result; | 732 return result; |
| 739 } | 733 } |
| 740 | 734 |
| 741 dynamic handleMessage(bindings.ServiceMessage message) { | 735 dynamic handleMessage(bindings.ServiceMessage message) { |
| 742 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 736 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 } | 796 } |
| 803 | 797 |
| 804 @override | 798 @override |
| 805 void bind(core.MojoMessagePipeEndpoint endpoint) { | 799 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 806 super.bind(endpoint); | 800 super.bind(endpoint); |
| 807 if (!isOpen && (_impl != null)) { | 801 if (!isOpen && (_impl != null)) { |
| 808 beginHandlingEvents(); | 802 beginHandlingEvents(); |
| 809 } | 803 } |
| 810 } | 804 } |
| 811 | 805 |
| 806 @override |
| 812 String toString() { | 807 String toString() { |
| 813 var superString = super.toString(); | 808 var superString = super.toString(); |
| 814 return "AudioTrackStub($superString)"; | 809 return "_AudioTrackStubControl($superString)"; |
| 815 } | 810 } |
| 816 | 811 |
| 817 int get version => 0; | 812 int get version => 0; |
| 818 | 813 |
| 819 static service_describer.ServiceDescription _cachedServiceDescription; | 814 static service_describer.ServiceDescription _cachedServiceDescription; |
| 820 static service_describer.ServiceDescription get serviceDescription { | 815 static service_describer.ServiceDescription get serviceDescription { |
| 821 if (_cachedServiceDescription == null) { | 816 if (_cachedServiceDescription == null) { |
| 822 _cachedServiceDescription = new _AudioTrackServiceDescription(); | 817 _cachedServiceDescription = new _AudioTrackServiceDescription(); |
| 823 } | 818 } |
| 824 return _cachedServiceDescription; | 819 return _cachedServiceDescription; |
| 825 } | 820 } |
| 826 } | 821 } |
| 827 | 822 |
| 823 class AudioTrackStub |
| 824 extends bindings.Stub<AudioTrack> |
| 825 implements AudioTrack { |
| 826 AudioTrackStub.fromEndpoint( |
| 827 core.MojoMessagePipeEndpoint endpoint, [AudioTrack impl]) |
| 828 : super(new _AudioTrackStubControl.fromEndpoint(endpoint, impl)); |
| 829 |
| 830 AudioTrackStub.fromHandle( |
| 831 core.MojoHandle handle, [AudioTrack impl]) |
| 832 : super(new _AudioTrackStubControl.fromHandle(handle, impl)); |
| 833 |
| 834 AudioTrackStub.unbound([AudioTrack impl]) |
| 835 : super(new _AudioTrackStubControl.unbound(impl)); |
| 836 |
| 837 static AudioTrackStub newFromEndpoint( |
| 838 core.MojoMessagePipeEndpoint endpoint) { |
| 839 assert(endpoint.setDescription("For AudioTrackStub")); |
| 840 return new AudioTrackStub.fromEndpoint(endpoint); |
| 841 } |
| 842 |
| 843 static service_describer.ServiceDescription get serviceDescription => |
| 844 _AudioTrackStubControl.serviceDescription; |
| 845 |
| 846 |
| 847 dynamic describe([Function responseFactory = null]) { |
| 848 return impl.describe(responseFactory); |
| 849 } |
| 850 void configure(AudioTrackConfiguration configuration, Object pipe) { |
| 851 return impl.configure(configuration, pipe); |
| 852 } |
| 853 void getRateControl(Object rateControl) { |
| 854 return impl.getRateControl(rateControl); |
| 855 } |
| 856 void setGain(double dbGain) { |
| 857 return impl.setGain(dbGain); |
| 858 } |
| 859 } |
| 860 |
| 828 | 861 |
| 829 | 862 |
| OLD | NEW |