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 #include "chromecast/renderer/media/media_channel_proxy.h"
7 #include "base/logging.h"
8 #include "chromecast/common/media/cma_messages.h"
10 namespace chromecast
{
13 MediaChannelProxy::MediaChannelProxy()
16 filter_
= CmaMessageFilterProxy::Get();
17 DCHECK(filter_
.get());
20 MediaChannelProxy::~MediaChannelProxy() {
23 void MediaChannelProxy::Open(LoadType load_type
) {
26 id_
= filter_
->CreateChannel();
31 scoped_ptr
<IPC::Message
>(new CmaHostMsg_CreateMedia(id_
, load_type
)));
38 void MediaChannelProxy::Close() {
43 Send(scoped_ptr
<IPC::Message
>(new CmaHostMsg_DestroyMedia(id_
)));
47 filter_
->DestroyChannel(id_
);
51 bool MediaChannelProxy::SetMediaDelegate(
52 const CmaMessageFilterProxy::MediaDelegate
& media_delegate
) {
55 return filter_
->SetMediaDelegate(id_
, media_delegate
);
58 bool MediaChannelProxy::SetAudioDelegate(
59 const CmaMessageFilterProxy::AudioDelegate
& audio_delegate
) {
62 return filter_
->SetAudioDelegate(id_
, audio_delegate
);
65 bool MediaChannelProxy::SetVideoDelegate(
66 const CmaMessageFilterProxy::VideoDelegate
& video_delegate
) {
69 return filter_
->SetVideoDelegate(id_
, video_delegate
);
72 bool MediaChannelProxy::Send(scoped_ptr
<IPC::Message
> message
) {
75 return filter_
->Send(message
.Pass());
79 } // namespace chromecast