| 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 MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ | 5 #ifndef MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ |
| 6 #define MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ | 6 #define MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "media/base/audio_decoder_config.h" |
| 13 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
| 14 #include "media/base/pipeline.h" | 15 #include "media/base/pipeline.h" |
| 15 #include "media/base/renderer.h" | 16 #include "media/base/renderer.h" |
| 17 #include "media/base/video_decoder_config.h" |
| 18 #include "media/filters/remoting_controller.h" |
| 16 | 19 |
| 17 namespace media { | 20 namespace media { |
| 18 | 21 |
| 19 class Demuxer; | 22 class Demuxer; |
| 20 | 23 |
| 21 // PipelineController wraps a Pipeline to expose the one-at-a-time operations | 24 // PipelineController wraps a Pipeline to expose the one-at-a-time operations |
| 22 // (Seek(), Suspend(), and Resume()) with a simpler API. Internally it tracks | 25 // (Seek(), Suspend(), and Resume()) with a simpler API. Internally it tracks |
| 23 // pending operations and dispatches them when possible. Duplicate requests | 26 // pending operations and dispatches them when possible. Duplicate requests |
| 24 // (such as seeking twice to the same time) may be elided. | 27 // (such as seeking twice to the same time) may be elided. |
| 25 // | 28 // |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // - Start() is processed immediately while in the CREATED state. | 98 // - Start() is processed immediately while in the CREATED state. |
| 96 // - Resume() is processed immediately while in the SUSPENDED state. | 99 // - Resume() is processed immediately while in the SUSPENDED state. |
| 97 bool IsStable(); | 100 bool IsStable(); |
| 98 | 101 |
| 99 // Returns true if the current target state is suspended. | 102 // Returns true if the current target state is suspended. |
| 100 bool IsSuspended(); | 103 bool IsSuspended(); |
| 101 | 104 |
| 102 // Returns true if |pipeline_| is suspended. | 105 // Returns true if |pipeline_| is suspended. |
| 103 bool IsPipelineSuspended(); | 106 bool IsPipelineSuspended(); |
| 104 | 107 |
| 108 // Switch between the media renderer for local playing back and the remoting |
| 109 // media renderer when pipeline is started. |
| 110 void ToggleRenderer(); |
| 111 |
| 112 // Set whether any fullscreen button is pressed. |
| 113 void SetFullscreenMode(bool is_fullscreen); |
| 114 |
| 115 void SetIsEncryptedContent(); |
| 116 |
| 117 // Get the current video/audio config. |
| 118 VideoDecoderConfig GetVideoDecoderConfig() const; |
| 119 AudioDecoderConfig GetAudioDecoderConfig() const; |
| 120 |
| 121 // This is used to indicate which renderer to be created. |
| 122 bool ShouldUseRemotingRenderer() const; |
| 123 |
| 105 private: | 124 private: |
| 106 // Attempts to make progress from the current state to the target state. | 125 // Attempts to make progress from the current state to the target state. |
| 107 void Dispatch(); | 126 void Dispatch(); |
| 108 | 127 |
| 109 // PipelineStaus callback that also carries the target state. | 128 // PipelineStaus callback that also carries the target state. |
| 110 void OnPipelineStatus(State state, PipelineStatus pipeline_status); | 129 void OnPipelineStatus(State state, PipelineStatus pipeline_status); |
| 111 | 130 |
| 112 // The Pipeline we are managing state for. | 131 // The Pipeline we are managing state for. |
| 113 Pipeline* pipeline_ = nullptr; | 132 Pipeline* pipeline_ = nullptr; |
| 114 | 133 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // The target time of the active seek; valid while SEEKING or RESUMING. | 170 // The target time of the active seek; valid while SEEKING or RESUMING. |
| 152 base::TimeDelta seek_time_; | 171 base::TimeDelta seek_time_; |
| 153 | 172 |
| 154 // Target state which we will work to achieve. |pending_seek_time_| is only | 173 // Target state which we will work to achieve. |pending_seek_time_| is only |
| 155 // valid when |pending_seek_| is true. | 174 // valid when |pending_seek_| is true. |
| 156 bool pending_seek_ = false; | 175 bool pending_seek_ = false; |
| 157 base::TimeDelta pending_seek_time_; | 176 base::TimeDelta pending_seek_time_; |
| 158 bool pending_suspend_ = false; | 177 bool pending_suspend_ = false; |
| 159 bool pending_resume_ = false; | 178 bool pending_resume_ = false; |
| 160 | 179 |
| 180 std::unique_ptr<RemotingController> remoting_controller_; |
| 181 |
| 161 base::ThreadChecker thread_checker_; | 182 base::ThreadChecker thread_checker_; |
| 162 base::WeakPtrFactory<PipelineController> weak_factory_; | 183 base::WeakPtrFactory<PipelineController> weak_factory_; |
| 163 | 184 |
| 164 DISALLOW_COPY_AND_ASSIGN(PipelineController); | 185 DISALLOW_COPY_AND_ASSIGN(PipelineController); |
| 165 }; | 186 }; |
| 166 | 187 |
| 167 } // namespace media | 188 } // namespace media |
| 168 | 189 |
| 169 #endif // MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ | 190 #endif // MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ |
| OLD | NEW |