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_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_DEVICE_H_
6 #define CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_DEVICE_H_
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
12 namespace chromecast
{
14 class AudioPipelineDevice
;
15 class MediaClockDevice
;
16 class MediaPipelineDeviceFactory
;
17 class MediaPipelineDeviceParams
;
18 class VideoPipelineDevice
;
20 // MediaPipelineDevice is the owner of the underlying audio/video/clock
21 // devices. It ensures that the clock outlives the audio and video devices, so
22 // it is safe for them to reference the clock with a raw pointer.
23 class MediaPipelineDevice
{
25 // Constructs object using clock, audio, video created by given factory.
26 explicit MediaPipelineDevice(scoped_ptr
<MediaPipelineDeviceFactory
> factory
);
28 // Constructs explicitly from separate clock, audio, video elements
29 MediaPipelineDevice(scoped_ptr
<MediaClockDevice
> media_clock_device
,
30 scoped_ptr
<AudioPipelineDevice
> audio_pipeline_device
,
31 scoped_ptr
<VideoPipelineDevice
> video_pipeline_device
);
32 ~MediaPipelineDevice();
34 AudioPipelineDevice
* GetAudioPipelineDevice() const {
35 return audio_pipeline_device_
.get();
37 VideoPipelineDevice
* GetVideoPipelineDevice() const {
38 return video_pipeline_device_
.get();
40 MediaClockDevice
* GetMediaClockDevice() const {
41 return media_clock_device_
.get();
45 scoped_ptr
<MediaClockDevice
> media_clock_device_
;
46 scoped_ptr
<AudioPipelineDevice
> audio_pipeline_device_
;
47 scoped_ptr
<VideoPipelineDevice
> video_pipeline_device_
;
49 DISALLOW_COPY_AND_ASSIGN(MediaPipelineDevice
);
52 // Factory method to create a MediaPipelineDevice.
53 typedef base::Callback
<scoped_ptr
<MediaPipelineDevice
>(
54 const MediaPipelineDeviceParams
&)> CreatePipelineDeviceCB
;
57 } // namespace chromecast
59 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_DEVICE_H_