OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chromecast/media/cma/backend/alsa/media_pipeline_backend_alsa.h" | 5 #include "chromecast/media/cma/backend/alsa/media_pipeline_backend_alsa.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "chromecast/base/task_runner_impl.h" | 9 #include "chromecast/base/task_runner_impl.h" |
10 #include "chromecast/media/cma/backend/alsa/audio_decoder_alsa.h" | 10 #include "chromecast/media/cma/backend/alsa/audio_decoder_alsa.h" |
11 #include "chromecast/media/cma/backend/video_decoder_default.h" | 11 #include "chromecast/media/cma/backend/alsa/video_decoder_alsa.h" |
12 | 12 |
13 namespace chromecast { | 13 namespace chromecast { |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 MediaPipelineBackendAlsa::MediaPipelineBackendAlsa( | 16 MediaPipelineBackendAlsa::MediaPipelineBackendAlsa( |
17 const MediaPipelineDeviceParams& params) | 17 const MediaPipelineDeviceParams& params) |
18 : state_(kStateUninitialized), params_(params) { | 18 : state_(kStateUninitialized), params_(params) { |
19 } | 19 } |
20 | 20 |
21 MediaPipelineBackendAlsa::~MediaPipelineBackendAlsa() { | 21 MediaPipelineBackendAlsa::~MediaPipelineBackendAlsa() { |
22 } | 22 } |
23 | 23 |
24 MediaPipelineBackendAlsa::AudioDecoder* | 24 MediaPipelineBackendAlsa::AudioDecoder* |
25 MediaPipelineBackendAlsa::CreateAudioDecoder() { | 25 MediaPipelineBackendAlsa::CreateAudioDecoder() { |
26 DCHECK_EQ(kStateUninitialized, state_); | 26 DCHECK_EQ(kStateUninitialized, state_); |
27 if (audio_decoder_) | 27 if (audio_decoder_) |
28 return nullptr; | 28 return nullptr; |
29 audio_decoder_.reset(new AudioDecoderAlsa(this)); | 29 audio_decoder_.reset(new AudioDecoderAlsa(this)); |
30 return audio_decoder_.get(); | 30 return audio_decoder_.get(); |
31 } | 31 } |
32 | 32 |
33 MediaPipelineBackendAlsa::VideoDecoder* | 33 MediaPipelineBackendAlsa::VideoDecoder* |
34 MediaPipelineBackendAlsa::CreateVideoDecoder() { | 34 MediaPipelineBackendAlsa::CreateVideoDecoder() { |
35 DCHECK_EQ(kStateUninitialized, state_); | 35 DCHECK_EQ(kStateUninitialized, state_); |
36 if (video_decoder_) | 36 if (video_decoder_) |
37 return nullptr; | 37 return nullptr; |
38 video_decoder_.reset(new VideoDecoderDefault()); | 38 video_decoder_.reset(new VideoDecoderAlsa()); |
39 return video_decoder_.get(); | 39 return video_decoder_.get(); |
40 } | 40 } |
41 | 41 |
42 bool MediaPipelineBackendAlsa::Initialize() { | 42 bool MediaPipelineBackendAlsa::Initialize() { |
43 DCHECK_EQ(kStateUninitialized, state_); | 43 DCHECK_EQ(kStateUninitialized, state_); |
44 if (audio_decoder_) | 44 if (audio_decoder_) |
45 audio_decoder_->Initialize(); | 45 audio_decoder_->Initialize(); |
46 state_ = kStateInitialized; | 46 state_ = kStateInitialized; |
47 return true; | 47 return true; |
48 } | 48 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 MediaPipelineDeviceParams::kAudioStreamSoundEffects); | 98 MediaPipelineDeviceParams::kAudioStreamSoundEffects); |
99 } | 99 } |
100 | 100 |
101 const scoped_refptr<base::SingleThreadTaskRunner>& | 101 const scoped_refptr<base::SingleThreadTaskRunner>& |
102 MediaPipelineBackendAlsa::GetTaskRunner() const { | 102 MediaPipelineBackendAlsa::GetTaskRunner() const { |
103 return static_cast<TaskRunnerImpl*>(params_.task_runner)->runner(); | 103 return static_cast<TaskRunnerImpl*>(params_.task_runner)->runner(); |
104 } | 104 } |
105 | 105 |
106 } // namespace media | 106 } // namespace media |
107 } // namespace chromecast | 107 } // namespace chromecast |
OLD | NEW |