| 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_PLAYER_IMPL_H_ | 5 #ifndef MOJO_SERVICES_MEDIA_FACTORY_MEDIA_PLAYER_IMPL_H_ |
| 6 #define MOJO_SERVICES_MEDIA_FACTORY_MEDIA_PLAYER_IMPL_H_ | 6 #define MOJO_SERVICES_MEDIA_FACTORY_MEDIA_PLAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "mojo/public/cpp/application/application_impl.h" | 11 #include "mojo/public/cpp/application/application_impl.h" |
| 12 #include "mojo/public/cpp/bindings/binding.h" | 12 #include "mojo/public/cpp/bindings/binding.h" |
| 13 #include "mojo/services/media/common/interfaces/media_transport.mojom.h" | 13 #include "mojo/services/media/common/interfaces/media_transport.mojom.h" |
| 14 #include "mojo/services/media/control/interfaces/media_factory.mojom.h" | 14 #include "mojo/services/media/control/interfaces/media_factory.mojom.h" |
| 15 #include "mojo/services/media/core/interfaces/seeking_reader.mojom.h" | 15 #include "mojo/services/media/core/interfaces/seeking_reader.mojom.h" |
| 16 #include "services/media/factory_service/factory_service.h" | 16 #include "services/media/factory_service/factory_service.h" |
| 17 #include "services/media/factory_service/mojo_publisher.h" | 17 #include "services/media/factory_service/mojo_publisher.h" |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 namespace media { | 20 namespace media { |
| 21 | 21 |
| 22 // Mojo agent that renders streams from an origin specified by URL. | 22 // Mojo agent that renders streams from an origin specified by URL. |
| 23 class MediaPlayerImpl : public MediaFactoryService::Product, | 23 class MediaPlayerImpl : public MediaFactoryService::Product<MediaPlayer>, |
| 24 public MediaPlayer { | 24 public MediaPlayer { |
| 25 public: | 25 public: |
| 26 static std::shared_ptr<MediaPlayerImpl> Create( | 26 static std::shared_ptr<MediaPlayerImpl> Create( |
| 27 InterfaceHandle<SeekingReader> reader, | 27 InterfaceHandle<SeekingReader> reader, |
| 28 InterfaceRequest<MediaPlayer> request, | 28 InterfaceRequest<MediaPlayer> request, |
| 29 MediaFactoryService* owner); | 29 MediaFactoryService* owner); |
| 30 | 30 |
| 31 ~MediaPlayerImpl() override; | 31 ~MediaPlayerImpl() override; |
| 32 | 32 |
| 33 // MediaPlayer implementation. | 33 // MediaPlayer implementation. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void HandleDemuxMetadataUpdates( | 112 void HandleDemuxMetadataUpdates( |
| 113 uint64_t version = MediaDemux::kInitialMetadata, | 113 uint64_t version = MediaDemux::kInitialMetadata, |
| 114 MediaMetadataPtr metadata = nullptr); | 114 MediaMetadataPtr metadata = nullptr); |
| 115 | 115 |
| 116 // Handles a status update from a sink. When called with the default | 116 // Handles a status update from a sink. When called with the default |
| 117 // argument values, initiates sink status updates. | 117 // argument values, initiates sink status updates. |
| 118 void HandleSinkStatusUpdates(Stream* stream, | 118 void HandleSinkStatusUpdates(Stream* stream, |
| 119 uint64_t version = MediaSink::kInitialStatus, | 119 uint64_t version = MediaSink::kInitialStatus, |
| 120 MediaSinkStatusPtr status = nullptr); | 120 MediaSinkStatusPtr status = nullptr); |
| 121 | 121 |
| 122 Binding<MediaPlayer> binding_; | |
| 123 MediaFactoryPtr factory_; | 122 MediaFactoryPtr factory_; |
| 124 MediaDemuxPtr demux_; | 123 MediaDemuxPtr demux_; |
| 125 std::vector<std::unique_ptr<Stream>> streams_; | 124 std::vector<std::unique_ptr<Stream>> streams_; |
| 126 State state_ = State::kWaiting; | 125 State state_ = State::kWaiting; |
| 127 bool flushed_ = true; | 126 bool flushed_ = true; |
| 128 MediaState reported_media_state_ = MediaState::UNPREPARED; | 127 MediaState reported_media_state_ = MediaState::UNPREPARED; |
| 129 MediaState target_state_ = MediaState::PAUSED; | 128 MediaState target_state_ = MediaState::PAUSED; |
| 130 int64_t target_position_ = kNotSeeking; | 129 int64_t target_position_ = kNotSeeking; |
| 131 TimelineTransformPtr transform_; | 130 TimelineTransformPtr transform_; |
| 132 MediaMetadataPtr metadata_; | 131 MediaMetadataPtr metadata_; |
| 133 MojoPublisher<GetStatusCallback> status_publisher_; | 132 MojoPublisher<GetStatusCallback> status_publisher_; |
| 134 }; | 133 }; |
| 135 | 134 |
| 136 } // namespace media | 135 } // namespace media |
| 137 } // namespace mojo | 136 } // namespace mojo |
| 138 | 137 |
| 139 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_PLAYER_IMPL_H_ | 138 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_PLAYER_IMPL_H_ |
| OLD | NEW |