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_
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/thread_checker.h"
15 #include "base/time/time.h"
16 #include "chromecast/common/media/cma_ipc_common.h"
17 #include "chromecast/media/cma/pipeline/load_type.h"
18 #include "media/base/pipeline_status.h"
22 class SingleThreadTaskRunner
;
26 class AudioDecoderConfig
;
27 class VideoDecoderConfig
;
30 namespace chromecast
{
32 struct AvPipelineClient
;
33 struct MediaPipelineClient
;
34 class MediaPipelineImpl
;
35 struct VideoPipelineClient
;
37 class MediaPipelineHost
{
42 void Initialize(LoadType load_type
,
43 const MediaPipelineClient
& client
);
45 void SetAvPipe(TrackId track_id
,
46 scoped_ptr
<base::SharedMemory
> shared_mem
,
47 const base::Closure
& pipe_read_activity_cb
,
48 const base::Closure
& av_pipe_set_cb
);
49 void AudioInitialize(TrackId track_id
,
50 const AvPipelineClient
& client
,
51 const ::media::AudioDecoderConfig
& config
,
52 const ::media::PipelineStatusCB
& status_cb
);
53 void VideoInitialize(TrackId track_id
,
54 const VideoPipelineClient
& client
,
55 const ::media::VideoDecoderConfig
& config
,
56 const ::media::PipelineStatusCB
& status_cb
);
57 void StartPlayingFrom(base::TimeDelta time
);
58 void Flush(const ::media::PipelineStatusCB
& status_cb
);
61 void SetPlaybackRate(float playback_rate
);
62 void SetVolume(TrackId track_id
, float playback_rate
);
63 void SetCdm(int render_process_id
, int render_frame_id
, int cdm_id
);
65 void NotifyPipeWrite(TrackId track_id
);
68 base::ThreadChecker thread_checker_
;
70 scoped_ptr
<MediaPipelineImpl
> media_pipeline_
;
72 // The shared memory for a track id must be valid until Stop is invoked on
74 struct MediaTrackHost
;
75 typedef std::map
<TrackId
, MediaTrackHost
*> MediaTrackMap
;
76 MediaTrackMap media_track_map_
;
78 DISALLOW_COPY_AND_ASSIGN(MediaPipelineHost
);
82 } // namespace chromecast
84 #endif // CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_