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 media_factory_mojom; | 5 library media_factory_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_demux.mojom.dart' as media_demux_
mojom; | 10 import 'package:mojo_services/mojo/media/media_demux.mojom.dart' as media_demux_
mojom; |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 abstract class MediaFactory { | 587 abstract class MediaFactory { |
588 static const String serviceName = "mojo::media::MediaFactory"; | 588 static const String serviceName = "mojo::media::MediaFactory"; |
589 void createPlayer(Object reader, Object player); | 589 void createPlayer(Object reader, Object player); |
590 void createSource(Object reader, List<media_types_mojom.MediaTypeSet> allowedM
ediaTypes, Object source); | 590 void createSource(Object reader, List<media_types_mojom.MediaTypeSet> allowedM
ediaTypes, Object source); |
591 void createSink(String destinationUrl, media_types_mojom.MediaType mediaType,
Object sink); | 591 void createSink(String destinationUrl, media_types_mojom.MediaType mediaType,
Object sink); |
592 void createDemux(Object reader, Object demux); | 592 void createDemux(Object reader, Object demux); |
593 void createDecoder(media_types_mojom.MediaType inputMediaType, Object decoder)
; | 593 void createDecoder(media_types_mojom.MediaType inputMediaType, Object decoder)
; |
594 void createNetworkReader(String url, Object reader); | 594 void createNetworkReader(String url, Object reader); |
595 } | 595 } |
596 | 596 |
597 | 597 class _MediaFactoryProxyControl |
598 class _MediaFactoryProxyControl extends bindings.ProxyMessageHandler | 598 extends bindings.ProxyMessageHandler |
599 implements bindings.ProxyControl { | 599 implements bindings.ProxyControl { |
600 _MediaFactoryProxyControl.fromEndpoint( | 600 _MediaFactoryProxyControl.fromEndpoint( |
601 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 601 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
602 | 602 |
603 _MediaFactoryProxyControl.fromHandle( | 603 _MediaFactoryProxyControl.fromHandle( |
604 core.MojoHandle handle) : super.fromHandle(handle); | 604 core.MojoHandle handle) : super.fromHandle(handle); |
605 | 605 |
606 _MediaFactoryProxyControl.unbound() : super.unbound(); | 606 _MediaFactoryProxyControl.unbound() : super.unbound(); |
607 | 607 |
608 service_describer.ServiceDescription get serviceDescription => | 608 service_describer.ServiceDescription get serviceDescription => |
609 new _MediaFactoryServiceDescription(); | 609 new _MediaFactoryServiceDescription(); |
610 | 610 |
611 String get serviceName => MediaFactory.serviceName; | 611 String get serviceName => MediaFactory.serviceName; |
612 | 612 |
613 @override | |
614 void handleResponse(bindings.ServiceMessage message) { | 613 void handleResponse(bindings.ServiceMessage message) { |
615 switch (message.header.type) { | 614 switch (message.header.type) { |
616 default: | 615 default: |
617 proxyError("Unexpected message type: ${message.header.type}"); | 616 proxyError("Unexpected message type: ${message.header.type}"); |
618 close(immediate: true); | 617 close(immediate: true); |
619 break; | 618 break; |
620 } | 619 } |
621 } | 620 } |
622 | 621 |
623 @override | 622 @override |
624 String toString() { | 623 String toString() { |
625 var superString = super.toString(); | 624 var superString = super.toString(); |
626 return "_MediaFactoryProxyControl($superString)"; | 625 return "_MediaFactoryProxyControl($superString)"; |
627 } | 626 } |
628 } | 627 } |
629 | 628 |
630 | 629 class MediaFactoryProxy |
631 class MediaFactoryProxy extends bindings.Proxy | 630 extends bindings.Proxy |
632 implements MediaFactory { | 631 implements MediaFactory { |
633 MediaFactoryProxy.fromEndpoint( | 632 MediaFactoryProxy.fromEndpoint( |
634 core.MojoMessagePipeEndpoint endpoint) | 633 core.MojoMessagePipeEndpoint endpoint) |
635 : super(new _MediaFactoryProxyControl.fromEndpoint(endpoint)); | 634 : super(new _MediaFactoryProxyControl.fromEndpoint(endpoint)); |
636 | 635 |
637 MediaFactoryProxy.fromHandle(core.MojoHandle handle) | 636 MediaFactoryProxy.fromHandle(core.MojoHandle handle) |
638 : super(new _MediaFactoryProxyControl.fromHandle(handle)); | 637 : super(new _MediaFactoryProxyControl.fromHandle(handle)); |
639 | 638 |
640 MediaFactoryProxy.unbound() | 639 MediaFactoryProxy.unbound() |
641 : super(new _MediaFactoryProxyControl.unbound()); | 640 : super(new _MediaFactoryProxyControl.unbound()); |
642 | 641 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 return; | 716 return; |
718 } | 717 } |
719 var params = new _MediaFactoryCreateNetworkReaderParams(); | 718 var params = new _MediaFactoryCreateNetworkReaderParams(); |
720 params.url = url; | 719 params.url = url; |
721 params.reader = reader; | 720 params.reader = reader; |
722 ctrl.sendMessage(params, | 721 ctrl.sendMessage(params, |
723 _mediaFactoryMethodCreateNetworkReaderName); | 722 _mediaFactoryMethodCreateNetworkReaderName); |
724 } | 723 } |
725 } | 724 } |
726 | 725 |
727 | 726 class _MediaFactoryStubControl |
728 class MediaFactoryStub extends bindings.Stub { | 727 extends bindings.StubMessageHandler |
| 728 implements bindings.StubControl<MediaFactory> { |
729 MediaFactory _impl; | 729 MediaFactory _impl; |
730 | 730 |
731 MediaFactoryStub.fromEndpoint( | 731 _MediaFactoryStubControl.fromEndpoint( |
732 core.MojoMessagePipeEndpoint endpoint, [MediaFactory impl]) | 732 core.MojoMessagePipeEndpoint endpoint, [MediaFactory impl]) |
733 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 733 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
734 _impl = impl; | 734 _impl = impl; |
735 } | 735 } |
736 | 736 |
737 MediaFactoryStub.fromHandle( | 737 _MediaFactoryStubControl.fromHandle( |
738 core.MojoHandle handle, [MediaFactory impl]) | 738 core.MojoHandle handle, [MediaFactory impl]) |
739 : super.fromHandle(handle, autoBegin: impl != null) { | 739 : super.fromHandle(handle, autoBegin: impl != null) { |
740 _impl = impl; | 740 _impl = impl; |
741 } | 741 } |
742 | 742 |
743 MediaFactoryStub.unbound([this._impl]) : super.unbound(); | 743 _MediaFactoryStubControl.unbound([this._impl]) : super.unbound(); |
744 | |
745 static MediaFactoryStub newFromEndpoint( | |
746 core.MojoMessagePipeEndpoint endpoint) { | |
747 assert(endpoint.setDescription("For MediaFactoryStub")); | |
748 return new MediaFactoryStub.fromEndpoint(endpoint); | |
749 } | |
750 | 744 |
751 | 745 |
752 | 746 |
753 dynamic handleMessage(bindings.ServiceMessage message) { | 747 dynamic handleMessage(bindings.ServiceMessage message) { |
754 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 748 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
755 return bindings.ControlMessageHandler.handleMessage(this, | 749 return bindings.ControlMessageHandler.handleMessage(this, |
756 0, | 750 0, |
757 message); | 751 message); |
758 } | 752 } |
759 if (_impl == null) { | 753 if (_impl == null) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 } | 803 } |
810 | 804 |
811 @override | 805 @override |
812 void bind(core.MojoMessagePipeEndpoint endpoint) { | 806 void bind(core.MojoMessagePipeEndpoint endpoint) { |
813 super.bind(endpoint); | 807 super.bind(endpoint); |
814 if (!isOpen && (_impl != null)) { | 808 if (!isOpen && (_impl != null)) { |
815 beginHandlingEvents(); | 809 beginHandlingEvents(); |
816 } | 810 } |
817 } | 811 } |
818 | 812 |
| 813 @override |
819 String toString() { | 814 String toString() { |
820 var superString = super.toString(); | 815 var superString = super.toString(); |
821 return "MediaFactoryStub($superString)"; | 816 return "_MediaFactoryStubControl($superString)"; |
822 } | 817 } |
823 | 818 |
824 int get version => 0; | 819 int get version => 0; |
825 | 820 |
826 static service_describer.ServiceDescription _cachedServiceDescription; | 821 static service_describer.ServiceDescription _cachedServiceDescription; |
827 static service_describer.ServiceDescription get serviceDescription { | 822 static service_describer.ServiceDescription get serviceDescription { |
828 if (_cachedServiceDescription == null) { | 823 if (_cachedServiceDescription == null) { |
829 _cachedServiceDescription = new _MediaFactoryServiceDescription(); | 824 _cachedServiceDescription = new _MediaFactoryServiceDescription(); |
830 } | 825 } |
831 return _cachedServiceDescription; | 826 return _cachedServiceDescription; |
832 } | 827 } |
833 } | 828 } |
834 | 829 |
| 830 class MediaFactoryStub |
| 831 extends bindings.Stub<MediaFactory> |
| 832 implements MediaFactory { |
| 833 MediaFactoryStub.fromEndpoint( |
| 834 core.MojoMessagePipeEndpoint endpoint, [MediaFactory impl]) |
| 835 : super(new _MediaFactoryStubControl.fromEndpoint(endpoint, impl)); |
| 836 |
| 837 MediaFactoryStub.fromHandle( |
| 838 core.MojoHandle handle, [MediaFactory impl]) |
| 839 : super(new _MediaFactoryStubControl.fromHandle(handle, impl)); |
| 840 |
| 841 MediaFactoryStub.unbound([MediaFactory impl]) |
| 842 : super(new _MediaFactoryStubControl.unbound(impl)); |
| 843 |
| 844 static MediaFactoryStub newFromEndpoint( |
| 845 core.MojoMessagePipeEndpoint endpoint) { |
| 846 assert(endpoint.setDescription("For MediaFactoryStub")); |
| 847 return new MediaFactoryStub.fromEndpoint(endpoint); |
| 848 } |
| 849 |
| 850 static service_describer.ServiceDescription get serviceDescription => |
| 851 _MediaFactoryStubControl.serviceDescription; |
| 852 |
| 853 |
| 854 void createPlayer(Object reader, Object player) { |
| 855 return impl.createPlayer(reader, player); |
| 856 } |
| 857 void createSource(Object reader, List<media_types_mojom.MediaTypeSet> allowedM
ediaTypes, Object source) { |
| 858 return impl.createSource(reader, allowedMediaTypes, source); |
| 859 } |
| 860 void createSink(String destinationUrl, media_types_mojom.MediaType mediaType,
Object sink) { |
| 861 return impl.createSink(destinationUrl, mediaType, sink); |
| 862 } |
| 863 void createDemux(Object reader, Object demux) { |
| 864 return impl.createDemux(reader, demux); |
| 865 } |
| 866 void createDecoder(media_types_mojom.MediaType inputMediaType, Object decoder)
{ |
| 867 return impl.createDecoder(inputMediaType, decoder); |
| 868 } |
| 869 void createNetworkReader(String url, Object reader) { |
| 870 return impl.createNetworkReader(url, reader); |
| 871 } |
| 872 } |
| 873 |
835 | 874 |
836 | 875 |
OLD | NEW |