Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: examples/media_test/media_test.cc

Issue 2069873003: Motown: Define MediaRenderer and make it the way we identify renderers. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix build break...audio_track_controller.* gone for good. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "examples/media_test/media_test.h" 5 #include "examples/media_test/media_test.h"
6 #include "mojo/public/cpp/application/connect.h" 6 #include "mojo/public/cpp/application/connect.h"
7 #include "mojo/services/media/audio/interfaces/audio_server.mojom.h"
8 #include "mojo/services/media/audio/interfaces/audio_track.mojom.h"
7 #include "mojo/services/media/common/cpp/timeline.h" 9 #include "mojo/services/media/common/cpp/timeline.h"
8 #include "mojo/services/media/common/cpp/timeline_function.h" 10 #include "mojo/services/media/common/cpp/timeline_function.h"
9 #include "mojo/services/media/control/interfaces/media_factory.mojom.h" 11 #include "mojo/services/media/control/interfaces/media_factory.mojom.h"
10 12
11 namespace mojo { 13 namespace mojo {
12 namespace media { 14 namespace media {
13 namespace examples { 15 namespace examples {
14 16
15 // static 17 // static
16 std::unique_ptr<MediaTest> MediaTest::Create( 18 std::unique_ptr<MediaTest> MediaTest::Create(
17 mojo::Shell* shell, 19 mojo::Shell* shell,
18 const std::string& input_file_name) { 20 const std::string& input_file_name) {
19 return std::unique_ptr<MediaTest>(new MediaTest(shell, input_file_name)); 21 return std::unique_ptr<MediaTest>(new MediaTest(shell, input_file_name));
20 } 22 }
21 23
22 MediaTest::MediaTest(mojo::Shell* shell, const std::string& input_file_name) { 24 MediaTest::MediaTest(mojo::Shell* shell, const std::string& input_file_name) {
23 MediaFactoryPtr factory; 25 MediaFactoryPtr factory;
24 ConnectToService(shell, "mojo:media_factory", GetProxy(&factory)); 26 ConnectToService(shell, "mojo:media_factory", GetProxy(&factory));
25 27
28 AudioServerPtr audio_service;
29 ConnectToService(shell, "mojo:audio_server", GetProxy(&audio_service));
30 AudioTrackPtr audio_track;
31 MediaRendererPtr audio_renderer;
32 audio_service->CreateTrack(GetProxy(&audio_track), GetProxy(&audio_renderer));
33
26 SeekingReaderPtr reader; 34 SeekingReaderPtr reader;
27 factory->CreateNetworkReader(input_file_name, GetProxy(&reader)); 35 factory->CreateNetworkReader(input_file_name, GetProxy(&reader));
28 factory->CreatePlayer(reader.Pass(), GetProxy(&media_player_)); 36
37 factory->CreatePlayer(reader.Pass(), audio_renderer.Pass(), nullptr,
38 GetProxy(&media_player_));
29 39
30 HandleStatusUpdates(); 40 HandleStatusUpdates();
31 } 41 }
32 42
33 MediaTest::~MediaTest() {} 43 MediaTest::~MediaTest() {}
34 44
35 int64_t MediaTest::position_ns() const { 45 int64_t MediaTest::position_ns() const {
36 // Apply the timeline function to the current time. 46 // Apply the timeline function to the current time.
37 int64_t position = timeline_function_(Timeline::local_now()); 47 int64_t position = timeline_function_(Timeline::local_now());
38 48
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // Request a status update. 88 // Request a status update.
79 media_player_->GetStatus( 89 media_player_->GetStatus(
80 version, [this](uint64_t version, MediaPlayerStatusPtr status) { 90 version, [this](uint64_t version, MediaPlayerStatusPtr status) {
81 HandleStatusUpdates(version, status.Pass()); 91 HandleStatusUpdates(version, status.Pass());
82 }); 92 });
83 } 93 }
84 94
85 } // namespace examples 95 } // namespace examples
86 } // namespace media 96 } // namespace media
87 } // namespace mojo 97 } // namespace mojo
OLDNEW
« no previous file with comments | « examples/media_test/BUILD.gn ('k') | mojo/dart/packages/mojo_services/lib/mojo/media/audio_server.mojom.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698