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 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_DEFAULT_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_DEFAULT_H_ |
6 #define CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_DEFAULT_H_ | 6 #define CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_DEFAULT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/time/time.h" | |
14 #include "chromecast/public/media/media_pipeline_backend.h" | 13 #include "chromecast/public/media/media_pipeline_backend.h" |
15 | 14 |
16 namespace chromecast { | 15 namespace chromecast { |
17 namespace media { | 16 namespace media { |
18 class AudioDecoderDefault; | 17 class AudioDecoderDefault; |
19 class VideoDecoderDefault; | 18 class VideoDecoderDefault; |
20 | 19 |
21 // Factory that instantiates default (stub) media pipeline device elements. | 20 // Factory that instantiates default (stub) media pipeline device elements. |
22 class MediaPipelineBackendDefault : public MediaPipelineBackend { | 21 class MediaPipelineBackendDefault : public MediaPipelineBackend { |
23 public: | 22 public: |
24 MediaPipelineBackendDefault(); | 23 MediaPipelineBackendDefault(); |
25 ~MediaPipelineBackendDefault() override; | 24 ~MediaPipelineBackendDefault() override; |
26 | 25 |
27 bool running() const { return running_; } | |
28 const AudioDecoderDefault* audio_decoder() const { | 26 const AudioDecoderDefault* audio_decoder() const { |
29 return audio_decoder_.get(); | 27 return audio_decoder_.get(); |
30 } | 28 } |
31 const VideoDecoderDefault* video_decoder() const { | 29 const VideoDecoderDefault* video_decoder() const { |
32 return video_decoder_.get(); | 30 return video_decoder_.get(); |
33 } | 31 } |
34 | 32 |
35 // MediaPipelineBackend implementation: | 33 // MediaPipelineBackend implementation: |
36 AudioDecoder* CreateAudioDecoder() override; | 34 AudioDecoder* CreateAudioDecoder() override; |
37 VideoDecoder* CreateVideoDecoder() override; | 35 VideoDecoder* CreateVideoDecoder() override; |
38 bool Initialize() override; | 36 bool Initialize() override; |
39 bool Start(int64_t start_pts) override; | 37 bool Start(int64_t start_pts) override; |
40 void Stop() override; | 38 void Stop() override; |
41 bool Pause() override; | 39 bool Pause() override; |
42 bool Resume() override; | 40 bool Resume() override; |
43 int64_t GetCurrentPts() override; | 41 int64_t GetCurrentPts() override; |
44 bool SetPlaybackRate(float rate) override; | 42 bool SetPlaybackRate(float rate) override; |
45 | 43 |
46 private: | 44 private: |
47 int64_t start_pts_; | 45 enum State { |
48 base::TimeTicks start_clock_; | 46 kStateUninitialized, |
49 bool running_; | 47 kStateInitialized, |
| 48 kStatePlaying, |
| 49 kStatePaused, |
| 50 }; |
| 51 State state_; |
50 float rate_; | 52 float rate_; |
51 | |
52 std::unique_ptr<AudioDecoderDefault> audio_decoder_; | 53 std::unique_ptr<AudioDecoderDefault> audio_decoder_; |
53 std::unique_ptr<VideoDecoderDefault> video_decoder_; | 54 std::unique_ptr<VideoDecoderDefault> video_decoder_; |
54 | 55 |
55 DISALLOW_COPY_AND_ASSIGN(MediaPipelineBackendDefault); | 56 DISALLOW_COPY_AND_ASSIGN(MediaPipelineBackendDefault); |
56 }; | 57 }; |
57 | 58 |
58 } // namespace media | 59 } // namespace media |
59 } // namespace chromecast | 60 } // namespace chromecast |
60 | 61 |
61 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_DEFAULT_H_ | 62 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_BACKEND_DEFAULT_H_ |
OLD | NEW |