| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SINK_IMPL_H_ | 5 #ifndef MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SINK_IMPL_H_ |
| 6 #define MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SINK_IMPL_H_ | 6 #define MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SINK_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
| 11 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
| 12 #include "mojo/services/media/common/cpp/linear_transform.h" | 12 #include "mojo/services/media/common/cpp/linear_transform.h" |
| 13 #include "mojo/services/media/control/interfaces/media_sink.mojom.h" | 13 #include "mojo/services/media/control/interfaces/media_sink.mojom.h" |
| 14 #include "services/media/factory_service/audio_track_controller.h" | 14 #include "services/media/factory_service/audio_track_controller.h" |
| 15 #include "services/media/factory_service/factory_service.h" | 15 #include "services/media/factory_service/factory_service.h" |
| 16 #include "services/media/factory_service/mojo_publisher.h" | 16 #include "services/media/factory_service/mojo_publisher.h" |
| 17 #include "services/media/framework/graph.h" | 17 #include "services/media/framework/graph.h" |
| 18 #include "services/media/framework/parts/decoder.h" | 18 #include "services/media/framework/parts/decoder.h" |
| 19 #include "services/media/framework/util/incident.h" | 19 #include "services/media/framework/util/incident.h" |
| 20 #include "services/media/framework_mojo/mojo_consumer.h" | 20 #include "services/media/framework_mojo/mojo_consumer.h" |
| 21 #include "services/media/framework_mojo/mojo_producer.h" | 21 #include "services/media/framework_mojo/mojo_producer.h" |
| 22 | 22 |
| 23 namespace mojo { | 23 namespace mojo { |
| 24 namespace media { | 24 namespace media { |
| 25 | 25 |
| 26 // Mojo agent that consumes a stream and delivers it to a destination specified | 26 // Mojo agent that consumes a stream and delivers it to a destination specified |
| 27 // by URL. | 27 // by URL. |
| 28 class MediaSinkImpl : public MediaFactoryService::Product, public MediaSink { | 28 class MediaSinkImpl : public MediaFactoryService::Product<MediaSink>, |
| 29 public MediaSink { |
| 29 public: | 30 public: |
| 30 static std::shared_ptr<MediaSinkImpl> Create( | 31 static std::shared_ptr<MediaSinkImpl> Create( |
| 31 const String& destination_url, | 32 const String& destination_url, |
| 32 MediaTypePtr media_type, | 33 MediaTypePtr media_type, |
| 33 InterfaceRequest<MediaSink> request, | 34 InterfaceRequest<MediaSink> request, |
| 34 MediaFactoryService* owner); | 35 MediaFactoryService* owner); |
| 35 | 36 |
| 36 ~MediaSinkImpl() override; | 37 ~MediaSinkImpl() override; |
| 37 | 38 |
| 38 // MediaSink implementation. | 39 // MediaSink implementation. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 49 MediaSinkImpl(const String& destination_url, | 50 MediaSinkImpl(const String& destination_url, |
| 50 MediaTypePtr media_type, | 51 MediaTypePtr media_type, |
| 51 InterfaceRequest<MediaSink> request, | 52 InterfaceRequest<MediaSink> request, |
| 52 MediaFactoryService* owner); | 53 MediaFactoryService* owner); |
| 53 | 54 |
| 54 // Sets the rate if the producer is ready and the target rate differs from | 55 // Sets the rate if the producer is ready and the target rate differs from |
| 55 // the current rate. | 56 // the current rate. |
| 56 void MaybeSetRate(); | 57 void MaybeSetRate(); |
| 57 | 58 |
| 58 Incident ready_; | 59 Incident ready_; |
| 59 Binding<MediaSink> binding_; | |
| 60 Graph graph_; | 60 Graph graph_; |
| 61 std::shared_ptr<MojoConsumer> consumer_; | 61 std::shared_ptr<MojoConsumer> consumer_; |
| 62 std::shared_ptr<MojoProducer> producer_; | 62 std::shared_ptr<MojoProducer> producer_; |
| 63 std::unique_ptr<AudioTrackController> controller_; | 63 std::unique_ptr<AudioTrackController> controller_; |
| 64 RateControlPtr rate_control_; | 64 RateControlPtr rate_control_; |
| 65 float rate_ = 0.0f; | 65 float rate_ = 0.0f; |
| 66 float target_rate_ = 0.0f; | 66 float target_rate_ = 0.0f; |
| 67 MediaState producer_state_ = MediaState::UNPREPARED; | 67 MediaState producer_state_ = MediaState::UNPREPARED; |
| 68 LinearTransform transform_ = LinearTransform(0, 0, 1, 0); | 68 LinearTransform transform_ = LinearTransform(0, 0, 1, 0); |
| 69 TimelineTransformPtr status_transform_; | 69 TimelineTransformPtr status_transform_; |
| 70 uint32_t frames_per_second_ = 0u; | 70 uint32_t frames_per_second_ = 0u; |
| 71 bool flushed_ = true; | 71 bool flushed_ = true; |
| 72 MojoPublisher<GetStatusCallback> status_publisher_; | 72 MojoPublisher<GetStatusCallback> status_publisher_; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace media | 75 } // namespace media |
| 76 } // namespace mojo | 76 } // namespace mojo |
| 77 | 77 |
| 78 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SINK_IMPL_H_ | 78 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SINK_IMPL_H_ |
| OLD | NEW |