OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_ | 5 #ifndef CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_ |
6 #define CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_ | 6 #define CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "chromecast/common/media/cma_ipc_common.h" | 17 #include "chromecast/common/media/cma_ipc_common.h" |
18 #include "chromecast/media/cma/backend/media_pipeline_device.h" | |
19 #include "chromecast/media/cma/pipeline/load_type.h" | 18 #include "chromecast/media/cma/pipeline/load_type.h" |
20 #include "media/base/pipeline_status.h" | 19 #include "media/base/pipeline_status.h" |
21 | 20 |
22 namespace base { | 21 namespace base { |
23 class SharedMemory; | 22 class SharedMemory; |
24 class SingleThreadTaskRunner; | |
25 } | 23 } |
26 | 24 |
27 namespace media { | 25 namespace media { |
28 class AudioDecoderConfig; | 26 class AudioDecoderConfig; |
29 class VideoDecoderConfig; | 27 class VideoDecoderConfig; |
30 } | 28 } |
31 | 29 |
32 namespace chromecast { | 30 namespace chromecast { |
| 31 class TaskRunnerImpl; |
| 32 |
33 namespace media { | 33 namespace media { |
34 struct AvPipelineClient; | 34 struct AvPipelineClient; |
35 class BrowserCdmCast; | 35 class BrowserCdmCast; |
| 36 class MediaPipelineBackend; |
36 struct MediaPipelineClient; | 37 struct MediaPipelineClient; |
| 38 struct MediaPipelineDeviceParams; |
37 class MediaPipelineImpl; | 39 class MediaPipelineImpl; |
38 struct VideoPipelineClient; | 40 struct VideoPipelineClient; |
39 | 41 |
40 class MediaPipelineHost { | 42 class MediaPipelineHost { |
41 public: | 43 public: |
| 44 // Factory method to create a MediaPipelineBackend |
| 45 typedef base::Callback<scoped_ptr<media::MediaPipelineBackend>( |
| 46 const MediaPipelineDeviceParams&)> CreateDeviceComponentsCB; |
| 47 |
42 MediaPipelineHost(); | 48 MediaPipelineHost(); |
43 ~MediaPipelineHost(); | 49 ~MediaPipelineHost(); |
44 | 50 |
45 void Initialize( | 51 void Initialize(LoadType load_type, |
46 LoadType load_type, | 52 const MediaPipelineClient& client, |
47 const MediaPipelineClient& client, | 53 const CreateDeviceComponentsCB& create_device_components_cb); |
48 const media::CreatePipelineDeviceCB& create_pipeline_device_cb); | |
49 | 54 |
50 void SetAvPipe(TrackId track_id, | 55 void SetAvPipe(TrackId track_id, |
51 scoped_ptr<base::SharedMemory> shared_mem, | 56 scoped_ptr<base::SharedMemory> shared_mem, |
52 const base::Closure& pipe_read_activity_cb, | 57 const base::Closure& pipe_read_activity_cb, |
53 const base::Closure& av_pipe_set_cb); | 58 const base::Closure& av_pipe_set_cb); |
54 void AudioInitialize(TrackId track_id, | 59 void AudioInitialize(TrackId track_id, |
55 const AvPipelineClient& client, | 60 const AvPipelineClient& client, |
56 const ::media::AudioDecoderConfig& config, | 61 const ::media::AudioDecoderConfig& config, |
57 const ::media::PipelineStatusCB& status_cb); | 62 const ::media::PipelineStatusCB& status_cb); |
58 void VideoInitialize(TrackId track_id, | 63 void VideoInitialize(TrackId track_id, |
59 const VideoPipelineClient& client, | 64 const VideoPipelineClient& client, |
60 const std::vector<::media::VideoDecoderConfig>& configs, | 65 const std::vector<::media::VideoDecoderConfig>& configs, |
61 const ::media::PipelineStatusCB& status_cb); | 66 const ::media::PipelineStatusCB& status_cb); |
62 void StartPlayingFrom(base::TimeDelta time); | 67 void StartPlayingFrom(base::TimeDelta time); |
63 void Flush(const ::media::PipelineStatusCB& status_cb); | 68 void Flush(const ::media::PipelineStatusCB& status_cb); |
64 void Stop(); | 69 void Stop(); |
65 | 70 |
66 void SetPlaybackRate(double playback_rate); | 71 void SetPlaybackRate(double playback_rate); |
67 void SetVolume(TrackId track_id, float playback_rate); | 72 void SetVolume(TrackId track_id, float playback_rate); |
68 void SetCdm(BrowserCdmCast* cdm); | 73 void SetCdm(BrowserCdmCast* cdm); |
69 | 74 |
70 void NotifyPipeWrite(TrackId track_id); | 75 void NotifyPipeWrite(TrackId track_id); |
71 | 76 |
72 private: | 77 private: |
73 base::ThreadChecker thread_checker_; | 78 base::ThreadChecker thread_checker_; |
74 | 79 |
| 80 scoped_ptr<TaskRunnerImpl> task_runner_; |
75 scoped_ptr<MediaPipelineImpl> media_pipeline_; | 81 scoped_ptr<MediaPipelineImpl> media_pipeline_; |
76 | 82 |
77 // The shared memory for a track id must be valid until Stop is invoked on | 83 // The shared memory for a track id must be valid until Stop is invoked on |
78 // that track id. | 84 // that track id. |
79 struct MediaTrackHost; | 85 struct MediaTrackHost; |
80 typedef std::map<TrackId, MediaTrackHost*> MediaTrackMap; | 86 typedef std::map<TrackId, MediaTrackHost*> MediaTrackMap; |
81 MediaTrackMap media_track_map_; | 87 MediaTrackMap media_track_map_; |
82 | 88 |
83 DISALLOW_COPY_AND_ASSIGN(MediaPipelineHost); | 89 DISALLOW_COPY_AND_ASSIGN(MediaPipelineHost); |
84 }; | 90 }; |
85 | 91 |
86 } // namespace media | 92 } // namespace media |
87 } // namespace chromecast | 93 } // namespace chromecast |
88 | 94 |
89 #endif // CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_ | 95 #endif // CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_ |
OLD | NEW |