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
3 // found in the LICENSE file.
5 #ifndef CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_
6 #define CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/threading/thread_checker.h"
16 #include "base/time/time.h"
17 #include "chromecast/common/media/cma_ipc_common.h"
18 #include "chromecast/media/cma/pipeline/load_type.h"
19 #include "media/base/pipeline_status.h"
26 class AudioDecoderConfig
;
27 class VideoDecoderConfig
;
30 namespace chromecast
{
34 struct AvPipelineClient
;
36 class MediaPipelineBackend
;
37 struct MediaPipelineClient
;
38 struct MediaPipelineDeviceParams
;
39 class MediaPipelineImpl
;
40 struct VideoPipelineClient
;
42 class MediaPipelineHost
{
44 // Factory method to create a MediaPipelineBackend
45 typedef base::Callback
<scoped_ptr
<media::MediaPipelineBackend
>(
46 const MediaPipelineDeviceParams
&)> CreateDeviceComponentsCB
;
51 void Initialize(LoadType load_type
,
52 const MediaPipelineClient
& client
,
53 const CreateDeviceComponentsCB
& create_device_components_cb
);
55 void SetAvPipe(TrackId track_id
,
56 scoped_ptr
<base::SharedMemory
> shared_mem
,
57 const base::Closure
& pipe_read_activity_cb
,
58 const base::Closure
& av_pipe_set_cb
);
59 void AudioInitialize(TrackId track_id
,
60 const AvPipelineClient
& client
,
61 const ::media::AudioDecoderConfig
& config
,
62 const ::media::PipelineStatusCB
& status_cb
);
63 void VideoInitialize(TrackId track_id
,
64 const VideoPipelineClient
& client
,
65 const std::vector
<::media::VideoDecoderConfig
>& configs
,
66 const ::media::PipelineStatusCB
& status_cb
);
67 void StartPlayingFrom(base::TimeDelta time
);
68 void Flush(const ::media::PipelineStatusCB
& status_cb
);
71 void SetPlaybackRate(double playback_rate
);
72 void SetVolume(TrackId track_id
, float playback_rate
);
73 void SetCdm(BrowserCdmCast
* cdm
);
75 void NotifyPipeWrite(TrackId track_id
);
78 base::ThreadChecker thread_checker_
;
80 scoped_ptr
<TaskRunnerImpl
> task_runner_
;
81 scoped_ptr
<MediaPipelineImpl
> media_pipeline_
;
83 // The shared memory for a track id must be valid until Stop is invoked on
85 struct MediaTrackHost
;
86 typedef std::map
<TrackId
, MediaTrackHost
*> MediaTrackMap
;
87 MediaTrackMap media_track_map_
;
89 DISALLOW_COPY_AND_ASSIGN(MediaPipelineHost
);
93 } // namespace chromecast
95 #endif // CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_