| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <list> | 5 #include <list> |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "mojo/public/cpp/application/connect.h" | 9 #include "mojo/public/cpp/application/connect.h" |
| 10 #include "mojo/services/media/audio/interfaces/audio_server.mojom.h" | 10 #include "mojo/services/media/audio/interfaces/audio_server.mojom.h" |
| 11 #include "mojo/services/media/audio/interfaces/audio_track.mojom.h" | 11 #include "mojo/services/media/audio/interfaces/audio_track.mojom.h" |
| 12 #include "services/media/factory_service/audio_track_controller.h" | 12 #include "services/media/factory_service/audio_track_controller.h" |
| 13 #include "services/media/framework_mojo/mojo_type_conversions.h" | 13 #include "services/media/framework_mojo/mojo_type_conversions.h" |
| 14 | 14 |
| 15 namespace mojo { | 15 namespace mojo { |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 AudioTrackController::AudioTrackController(const String& url, | 18 AudioTrackController::AudioTrackController(const String& url, Shell* shell) { |
| 19 ApplicationImpl* app) { | |
| 20 // TODO(dalesat): Handle connection errors. | 19 // TODO(dalesat): Handle connection errors. |
| 21 DCHECK(app); | 20 DCHECK(shell); |
| 22 | 21 |
| 23 AudioServerPtr audio_server; | 22 AudioServerPtr audio_server; |
| 24 ConnectToService(app->shell(), url, GetProxy(&audio_server)); | 23 ConnectToService(shell, url, GetProxy(&audio_server)); |
| 25 audio_server->CreateTrack(GetProxy(&audio_track_)); | 24 audio_server->CreateTrack(GetProxy(&audio_track_)); |
| 26 } | 25 } |
| 27 | 26 |
| 28 AudioTrackController::~AudioTrackController() {} | 27 AudioTrackController::~AudioTrackController() {} |
| 29 | 28 |
| 30 void AudioTrackController::GetSupportedMediaTypes( | 29 void AudioTrackController::GetSupportedMediaTypes( |
| 31 const GetSupportedMediaTypesCallback& callback) { | 30 const GetSupportedMediaTypesCallback& callback) { |
| 32 // Query the track's format capabilities. | 31 // Query the track's format capabilities. |
| 33 audio_track_->Describe([this, callback](AudioTrackDescriptorPtr descriptor) { | 32 audio_track_->Describe([this, callback](AudioTrackDescriptorPtr descriptor) { |
| 34 callback(descriptor->supported_media_types.To<std::unique_ptr< | 33 callback(descriptor->supported_media_types.To<std::unique_ptr< |
| (...skipping 13 matching lines...) Expand all Loading... |
| 48 callback(consumer.Pass()); | 47 callback(consumer.Pass()); |
| 49 } | 48 } |
| 50 | 49 |
| 51 void AudioTrackController::GetTimelineControlSite( | 50 void AudioTrackController::GetTimelineControlSite( |
| 52 InterfaceRequest<MediaTimelineControlSite> req) { | 51 InterfaceRequest<MediaTimelineControlSite> req) { |
| 53 audio_track_->GetTimelineControlSite(req.Pass()); | 52 audio_track_->GetTimelineControlSite(req.Pass()); |
| 54 } | 53 } |
| 55 | 54 |
| 56 } // namespace media | 55 } // namespace media |
| 57 } // namespace mojo | 56 } // namespace mojo |
| OLD | NEW |