[MacViews] Show comboboxes with a native NSMenu
[chromium-blink-merge.git] / chromecast / browser / media / cma_media_pipeline_client.cc
blob7286c766ebfb496045781fe25191942d83039253
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"
8 namespace chromecast {
9 namespace media {
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() {
22 if (client_)
23 client_->OnResourceAcquired(this);
26 void CmaMediaPipelineClient::OnMediaPipelineBackendDestroyed() {
27 if (client_)
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)) {
38 if (client_)
39 client_->OnResourceReleased(this, audio_video_resource);
43 void CmaMediaPipelineClient::SetCastResourceClient(
44 CastResource::Client* client) {
45 client_ = client;
48 } // namespace media
49 } // namespace chromecast