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_RENDERER_MEDIA_MEDIA_PIPELINE_PROXY_H_
6 #define CHROMECAST_RENDERER_MEDIA_MEDIA_PIPELINE_PROXY_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h"
13 #include "chromecast/media/cma/pipeline/load_type.h"
14 #include "chromecast/media/cma/pipeline/media_pipeline.h"
15 #include "chromecast/media/cma/pipeline/media_pipeline_client.h"
16 #include "media/base/serial_runner.h"
19 class MessageLoopProxy
;
22 namespace chromecast
{
24 class AudioPipelineProxy
;
25 class MediaChannelProxy
;
26 class MediaPipelineProxyInternal
;
27 class VideoPipelineProxy
;
29 class MediaPipelineProxy
: public MediaPipeline
{
33 scoped_refptr
<base::MessageLoopProxy
> message_loop_proxy
,
35 ~MediaPipelineProxy() override
;
37 // MediaPipeline implementation.
38 void SetClient(const MediaPipelineClient
& client
) override
;
39 void SetCdm(int cdm_id
) override
;
40 AudioPipeline
* GetAudioPipeline() const override
;
41 VideoPipeline
* GetVideoPipeline() const override
;
43 const ::media::AudioDecoderConfig
& config
,
44 scoped_ptr
<CodedFrameProvider
> frame_provider
,
45 const ::media::PipelineStatusCB
& status_cb
) override
;
47 const ::media::VideoDecoderConfig
& config
,
48 scoped_ptr
<CodedFrameProvider
> frame_provider
,
49 const ::media::PipelineStatusCB
& status_cb
) override
;
50 void StartPlayingFrom(base::TimeDelta time
) override
;
51 void Flush(const ::media::PipelineStatusCB
& status_cb
) override
;
53 void SetPlaybackRate(double playback_rate
) override
;
56 void OnProxyFlushDone(const ::media::PipelineStatusCB
& status_cb
,
57 ::media::PipelineStatus status
);
59 base::ThreadChecker thread_checker_
;
61 scoped_refptr
<base::MessageLoopProxy
> io_message_loop_proxy_
;
63 const int render_frame_id_
;
65 // CMA channel to convey IPC messages.
66 scoped_refptr
<MediaChannelProxy
> const media_channel_proxy_
;
68 scoped_ptr
<MediaPipelineProxyInternal
> proxy_
;
72 scoped_ptr
<AudioPipelineProxy
> audio_pipeline_
;
73 scoped_ptr
<VideoPipelineProxy
> video_pipeline_
;
74 scoped_ptr
< ::media::SerialRunner
> pending_callbacks_
;
76 base::WeakPtr
<MediaPipelineProxy
> weak_this_
;
77 base::WeakPtrFactory
<MediaPipelineProxy
> weak_factory_
;
79 DISALLOW_COPY_AND_ASSIGN(MediaPipelineProxy
);
83 } // namespace chromecast
85 #endif // CHROMECAST_RENDERER_MEDIA_MEDIA_PIPELINE_PROXY_H_