Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: services/media/factory_service/media_player_impl.h

Issue 2069873003: Motown: Define MediaRenderer and make it the way we identify renderers. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix build break...audio_track_controller.* gone for good. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 21
22 namespace mojo { 22 namespace mojo {
23 namespace media { 23 namespace media {
24 24
25 // Mojo agent that renders streams from an origin specified by URL. 25 // Mojo agent that renders streams from an origin specified by URL.
26 class MediaPlayerImpl : public MediaFactoryService::Product<MediaPlayer>, 26 class MediaPlayerImpl : public MediaFactoryService::Product<MediaPlayer>,
27 public MediaPlayer { 27 public MediaPlayer {
28 public: 28 public:
29 static std::shared_ptr<MediaPlayerImpl> Create( 29 static std::shared_ptr<MediaPlayerImpl> Create(
30 InterfaceHandle<SeekingReader> reader, 30 InterfaceHandle<SeekingReader> reader,
31 InterfaceHandle<MediaRenderer> audio_renderer,
32 InterfaceHandle<MediaRenderer> video_renderer,
31 InterfaceRequest<MediaPlayer> request, 33 InterfaceRequest<MediaPlayer> request,
32 MediaFactoryService* owner); 34 MediaFactoryService* owner);
33 35
34 ~MediaPlayerImpl() override; 36 ~MediaPlayerImpl() override;
35 37
36 // MediaPlayer implementation. 38 // MediaPlayer implementation.
37 void GetStatus(uint64_t version_last_seen, 39 void GetStatus(uint64_t version_last_seen,
38 const GetStatusCallback& callback) override; 40 const GetStatusCallback& callback) override;
39 41
40 void Play() override; 42 void Play() override;
(...skipping 15 matching lines...) Expand all
56 struct Stream { 58 struct Stream {
57 Stream(); 59 Stream();
58 ~Stream(); 60 ~Stream();
59 // TODO(dalesat): Have the sink enlist the decoder. 61 // TODO(dalesat): Have the sink enlist the decoder.
60 MediaTypeConverterPtr decoder_; 62 MediaTypeConverterPtr decoder_;
61 MediaSinkPtr sink_; 63 MediaSinkPtr sink_;
62 // The following fields are just temporaries used to solve lambda capture 64 // The following fields are just temporaries used to solve lambda capture
63 // problems. 65 // problems.
64 MediaProducerPtr encoded_producer_; 66 MediaProducerPtr encoded_producer_;
65 MediaProducerPtr decoded_producer_; 67 MediaProducerPtr decoded_producer_;
68 InterfaceHandle<MediaRenderer> renderer_;
66 }; 69 };
67 70
68 MediaPlayerImpl(InterfaceHandle<SeekingReader> reader, 71 MediaPlayerImpl(InterfaceHandle<SeekingReader> reader,
72 InterfaceHandle<MediaRenderer> audio_renderer,
73 InterfaceHandle<MediaRenderer> video_renderer,
69 InterfaceRequest<MediaPlayer> request, 74 InterfaceRequest<MediaPlayer> request,
70 MediaFactoryService* owner); 75 MediaFactoryService* owner);
71 76
72 // Takes action based on current state. 77 // Takes action based on current state.
73 void Update(); 78 void Update();
74 79
75 // Handles seeking in paused state. 80 // Handles seeking in paused state.
76 void WhenPausedAndSeeking(); 81 void WhenPausedAndSeeking();
77 82
78 // Handles seeking in paused state with flushed pipeline. 83 // Handles seeking in paused state with flushed pipeline.
79 void WhenFlushedAndSeeking(); 84 void WhenFlushedAndSeeking();
80 85
81 // Sets the timeline transform. transform_subject_time_ is used for the 86 // Sets the timeline transform. transform_subject_time_ is used for the
82 // subject_time, and the effective_reference_time is now plus 87 // subject_time, and the effective_reference_time is now plus
83 // kMinimumLeadTime. 88 // kMinimumLeadTime.
84 void SetTimelineTransform(uint32_t reference_delta, uint32_t subject_delta); 89 void SetTimelineTransform(uint32_t reference_delta, uint32_t subject_delta);
85 90
86 // Prepares a stream. 91 // Prepares a stream.
87 void PrepareStream(Stream* stream, 92 void PrepareStream(Stream* stream,
88 size_t index, 93 size_t index,
89 const MediaTypePtr& input_media_type, 94 const MediaTypePtr& input_media_type,
90 const String& url,
91 const std::function<void()>& callback); 95 const std::function<void()>& callback);
92 96
93 // Creates a sink for a stream. 97 // Creates a sink for a stream.
94 void CreateSink(Stream* stream, 98 void CreateSink(Stream* stream,
95 const MediaTypePtr& input_media_type, 99 const MediaTypePtr& input_media_type,
96 const String& url,
97 const std::function<void()>& callback); 100 const std::function<void()>& callback);
98 101
99 // Handles a metadata update from the demux. When called with the default 102 // Handles a metadata update from the demux. When called with the default
100 // argument values, initiates demux metadata updates. 103 // argument values, initiates demux metadata updates.
101 void HandleDemuxMetadataUpdates( 104 void HandleDemuxMetadataUpdates(
102 uint64_t version = MediaDemux::kInitialMetadata, 105 uint64_t version = MediaDemux::kInitialMetadata,
103 MediaMetadataPtr metadata = nullptr); 106 MediaMetadataPtr metadata = nullptr);
104 107
105 // Handles a status update from the control site. When called with the default 108 // Handles a status update from the control site. When called with the default
106 // argument values, initiates control site. status updates. 109 // argument values, initiates control site. status updates.
(...skipping 10 matching lines...) Expand all
117 State state_ = State::kWaiting; 120 State state_ = State::kWaiting;
118 State target_state_ = State::kPaused; 121 State target_state_ = State::kPaused;
119 bool flushed_ = true; 122 bool flushed_ = true;
120 bool end_of_stream_ = false; 123 bool end_of_stream_ = false;
121 int64_t target_position_ = kUnspecifiedTime; 124 int64_t target_position_ = kUnspecifiedTime;
122 int64_t transform_subject_time_ = kUnspecifiedTime; 125 int64_t transform_subject_time_ = kUnspecifiedTime;
123 TimelineFunction timeline_function_; 126 TimelineFunction timeline_function_;
124 CallbackJoiner set_transform_joiner_; 127 CallbackJoiner set_transform_joiner_;
125 MediaMetadataPtr metadata_; 128 MediaMetadataPtr metadata_;
126 MojoPublisher<GetStatusCallback> status_publisher_; 129 MojoPublisher<GetStatusCallback> status_publisher_;
130 // The following fields are just temporaries used to solve lambda capture
131 // problems.
132 InterfaceHandle<MediaRenderer> audio_renderer_;
133 InterfaceHandle<MediaRenderer> video_renderer_;
127 }; 134 };
128 135
129 } // namespace media 136 } // namespace media
130 } // namespace mojo 137 } // namespace mojo
131 138
132 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_PLAYER_IMPL_H_ 139 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_PLAYER_IMPL_H_
OLDNEW
« no previous file with comments | « services/media/factory_service/factory_service.cc ('k') | services/media/factory_service/media_player_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698