1 // Copyright 2015 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/browser/media/cma_media_pipeline_client.h"
6 #include "chromecast/public/cast_media_shlib.h"
11 CmaMediaPipelineClient::CmaMediaPipelineClient() : client_(nullptr) {}
13 CmaMediaPipelineClient::~CmaMediaPipelineClient() {}
15 scoped_ptr
<MediaPipelineBackend
>
16 CmaMediaPipelineClient::CreateMediaPipelineBackend(
17 const media::MediaPipelineDeviceParams
& params
) {
18 return make_scoped_ptr(CastMediaShlib::CreateMediaPipelineBackend(params
));
21 void CmaMediaPipelineClient::OnMediaPipelineBackendCreated() {
23 client_
->OnResourceAcquired(this);
26 void CmaMediaPipelineClient::OnMediaPipelineBackendDestroyed() {
28 client_
->OnResourceReleased(this, CastResource::kResourceNone
);
31 void CmaMediaPipelineClient::ReleaseResource(CastResource::Resource resource
) {
32 CastResource::Resource audio_video_resource
=
33 static_cast<CastResource::Resource
>(CastResource::kResourceAudio
|
34 CastResource::kResourceScreenPrimary
);
36 // TODO(yucliu): media pipeline need to stop audio video seperately
37 if (!(resource
& audio_video_resource
)) {
39 client_
->OnResourceReleased(this, audio_video_resource
);
43 void CmaMediaPipelineClient::SetCastResourceClient(
44 CastResource::Client
* client
) {
49 } // namespace chromecast