| 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 CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ |
| 6 #define CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ | 6 #define CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "chromecast/public/media/media_pipeline_backend.h" | 15 #include "chromecast/public/media/media_pipeline_backend.h" |
| 16 #include "chromecast/public/media/media_pipeline_device_params.h" | 16 #include "chromecast/public/media/media_pipeline_device_params.h" |
| 17 | 17 |
| 18 namespace chromecast { | 18 namespace chromecast { |
| 19 namespace media { | 19 namespace media { |
| 20 | 20 |
| 21 // This class manages created media pipelines, and provides volume control by | 21 // This class manages created media pipelines, and provides volume control by |
| 22 // stream type. | 22 // stream type. |
| 23 // All functions in this class should be called on the media thread. | 23 // All functions in this class should be called on the media thread. |
| 24 class MediaPipelineBackendManager { | 24 class MediaPipelineBackendManager { |
| 25 public: | 25 public: |
| 26 explicit MediaPipelineBackendManager( | 26 explicit MediaPipelineBackendManager( |
| 27 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner); | 27 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner); |
| 28 ~MediaPipelineBackendManager(); | 28 ~MediaPipelineBackendManager(); |
| 29 | 29 |
| 30 // Create media pipeline backend. | 30 // Create media pipeline backend. |
| 31 scoped_ptr<MediaPipelineBackend> CreateMediaPipelineBackend( | 31 std::unique_ptr<MediaPipelineBackend> CreateMediaPipelineBackend( |
| 32 const MediaPipelineDeviceParams& params); | 32 const MediaPipelineDeviceParams& params); |
| 33 | 33 |
| 34 // Create media pipeline backend with a specific stream_type. | 34 // Create media pipeline backend with a specific stream_type. |
| 35 scoped_ptr<MediaPipelineBackend> CreateMediaPipelineBackend( | 35 std::unique_ptr<MediaPipelineBackend> CreateMediaPipelineBackend( |
| 36 const MediaPipelineDeviceParams& params, | 36 const MediaPipelineDeviceParams& params, |
| 37 int stream_type); | 37 int stream_type); |
| 38 | 38 |
| 39 // Sets the relative volume for a specified stream type, | 39 // Sets the relative volume for a specified stream type, |
| 40 // with range [0.0, 1.0] inclusive. If |multiplier| is outside the | 40 // with range [0.0, 1.0] inclusive. If |multiplier| is outside the |
| 41 // range [0.0, 1.0], it is clamped to that range. | 41 // range [0.0, 1.0], it is clamped to that range. |
| 42 // TODO(tianyuwang): change stream_type to use a enum. | 42 // TODO(tianyuwang): change stream_type to use a enum. |
| 43 void SetVolumeMultiplier(int stream_type, float volume); | 43 void SetVolumeMultiplier(int stream_type, float volume); |
| 44 | 44 |
| 45 base::SingleThreadTaskRunner* task_runner() const { | 45 base::SingleThreadTaskRunner* task_runner() const { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 62 // Volume multiplier for each type of audio streams. | 62 // Volume multiplier for each type of audio streams. |
| 63 std::map<int, float> volume_by_stream_type_; | 63 std::map<int, float> volume_by_stream_type_; |
| 64 | 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(MediaPipelineBackendManager); | 65 DISALLOW_COPY_AND_ASSIGN(MediaPipelineBackendManager); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 } // namespace media | 68 } // namespace media |
| 69 } // namespace chromecast | 69 } // namespace chromecast |
| 70 | 70 |
| 71 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ | 71 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_MANAGER_H_ |
| OLD | NEW |