| 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 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Tells the sinks to change state. | 90 // Tells the sinks to change state. |
| 91 void ChangeSinkStates(MediaState media_state); | 91 void ChangeSinkStates(MediaState media_state); |
| 92 | 92 |
| 93 // Determines if all the enabled sinks have the specified state. | 93 // Determines if all the enabled sinks have the specified state. |
| 94 bool AllSinksAre(SinkState sink_state); | 94 bool AllSinksAre(SinkState sink_state); |
| 95 | 95 |
| 96 // Sets the reported_media_state_ field, calling StatusUpdated as needed. | 96 // Sets the reported_media_state_ field, calling StatusUpdated as needed. |
| 97 void SetReportedMediaState(MediaState media_state); | 97 void SetReportedMediaState(MediaState media_state); |
| 98 | 98 |
| 99 // Prepares a stream. | 99 // Prepares a stream. |
| 100 void PrepareStream(const std::unique_ptr<Stream>& stream, | 100 void PrepareStream(Stream* stream, |
| 101 const String& url, | 101 const String& url, |
| 102 const std::function<void()>& callback); | 102 const std::function<void()>& callback); |
| 103 | 103 |
| 104 // Creates a sink for a stream. | 104 // Creates a sink for a stream. |
| 105 // TODO(dalesat): Use raw pointers rather than const std::unique_ptr<>&. | 105 void CreateSink(Stream* stream, |
| 106 void CreateSink(const std::unique_ptr<Stream>& stream, | |
| 107 const MediaTypePtr& input_media_type, | 106 const MediaTypePtr& input_media_type, |
| 108 const String& url, | 107 const String& url, |
| 109 const std::function<void()>& callback); | 108 const std::function<void()>& callback); |
| 110 | 109 |
| 111 // Handles a metadata update from the demux. When called with the default | 110 // Handles a metadata update from the demux. When called with the default |
| 112 // argument values, initiates demux metadata updates. | 111 // argument values, initiates demux metadata updates. |
| 113 void HandleDemuxMetadataUpdates( | 112 void HandleDemuxMetadataUpdates( |
| 114 uint64_t version = MediaDemux::kInitialMetadata, | 113 uint64_t version = MediaDemux::kInitialMetadata, |
| 115 MediaMetadataPtr metadata = nullptr); | 114 MediaMetadataPtr metadata = nullptr); |
| 116 | 115 |
| 117 // 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 |
| 118 // argument values, initiates sink status updates. | 117 // argument values, initiates sink status updates. |
| 119 void HandleSinkStatusUpdates(const std::unique_ptr<Stream>& stream, | 118 void HandleSinkStatusUpdates(Stream* stream, |
| 120 uint64_t version = MediaSink::kInitialStatus, | 119 uint64_t version = MediaSink::kInitialStatus, |
| 121 MediaSinkStatusPtr status = nullptr); | 120 MediaSinkStatusPtr status = nullptr); |
| 122 | 121 |
| 123 Binding<MediaPlayer> binding_; | 122 Binding<MediaPlayer> binding_; |
| 124 MediaFactoryPtr factory_; | 123 MediaFactoryPtr factory_; |
| 125 MediaDemuxPtr demux_; | 124 MediaDemuxPtr demux_; |
| 126 std::vector<std::unique_ptr<Stream>> streams_; | 125 std::vector<std::unique_ptr<Stream>> streams_; |
| 127 State state_ = State::kWaiting; | 126 State state_ = State::kWaiting; |
| 128 bool flushed_ = true; | 127 bool flushed_ = true; |
| 129 MediaState reported_media_state_ = MediaState::UNPREPARED; | 128 MediaState reported_media_state_ = MediaState::UNPREPARED; |
| 130 MediaState target_state_ = MediaState::PAUSED; | 129 MediaState target_state_ = MediaState::PAUSED; |
| 131 int64_t target_position_ = kNotSeeking; | 130 int64_t target_position_ = kNotSeeking; |
| 132 TimelineTransformPtr transform_; | 131 TimelineTransformPtr transform_; |
| 133 MediaMetadataPtr metadata_; | 132 MediaMetadataPtr metadata_; |
| 134 MojoPublisher<GetStatusCallback> status_publisher_; | 133 MojoPublisher<GetStatusCallback> status_publisher_; |
| 135 }; | 134 }; |
| 136 | 135 |
| 137 } // namespace media | 136 } // namespace media |
| 138 } // namespace mojo | 137 } // namespace mojo |
| 139 | 138 |
| 140 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_PLAYER_IMPL_H_ | 139 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_PLAYER_IMPL_H_ |
| OLD | NEW |