OLD | NEW |
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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "mojo/public/c/system/main.h" | 7 #include "mojo/public/c/system/main.h" |
8 #include "mojo/public/cpp/application/application_delegate.h" | 8 #include "mojo/public/cpp/application/application_delegate.h" |
9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
10 #include "mojo/public/cpp/application/application_runner.h" | 10 #include "mojo/public/cpp/application/application_runner.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 LocalDuration::period::den); | 264 LocalDuration::period::den); |
265 LinearTransform::Ratio tmp; | 265 LinearTransform::Ratio tmp; |
266 bool success = LinearTransform::Ratio::Compose(audio_rate, local_rate, &tmp); | 266 bool success = LinearTransform::Ratio::Compose(audio_rate, local_rate, &tmp); |
267 MOJO_DCHECK(success); | 267 MOJO_DCHECK(success); |
268 | 268 |
269 AudioTrackConfigurationPtr cfg; | 269 AudioTrackConfigurationPtr cfg; |
270 cfg = AudioTrackConfiguration::New(); | 270 cfg = AudioTrackConfiguration::New(); |
271 cfg->audio_frame_ratio = tmp.numerator; | 271 cfg->audio_frame_ratio = tmp.numerator; |
272 cfg->media_time_ratio = tmp.denominator; | 272 cfg->media_time_ratio = tmp.denominator; |
273 | 273 |
274 LpcmMediaTypeDetailsPtr pcm_cfg = LpcmMediaTypeDetails::New(); | 274 AudioMediaTypeDetailsPtr pcm_cfg = AudioMediaTypeDetails::New(); |
275 pcm_cfg->sample_format = (wav_info_.bits_per_sample == 8) | 275 pcm_cfg->sample_format = (wav_info_.bits_per_sample == 8) |
276 ? LpcmSampleFormat::UNSIGNED_8 | 276 ? AudioSampleFormat::UNSIGNED_8 |
277 : LpcmSampleFormat::SIGNED_16; | 277 : AudioSampleFormat::SIGNED_16; |
278 pcm_cfg->channels = wav_info_.channel_count; | 278 pcm_cfg->channels = wav_info_.channel_count; |
279 pcm_cfg->frames_per_second = wav_info_.frame_rate; | 279 pcm_cfg->frames_per_second = wav_info_.frame_rate; |
280 | 280 |
281 cfg->media_type = MediaType::New(); | 281 cfg->media_type = MediaType::New(); |
282 cfg->media_type->scheme = MediaTypeScheme::LPCM; | 282 cfg->media_type->medium = MediaTypeMedium::AUDIO; |
283 cfg->media_type->details = MediaTypeDetails::New(); | 283 cfg->media_type->details = MediaTypeDetails::New(); |
284 cfg->media_type->details->set_lpcm(pcm_cfg.Pass()); | 284 cfg->media_type->details->set_audio(pcm_cfg.Pass()); |
| 285 cfg->media_type->encoding = MediaType::kAudioEncodingLpcm; |
285 | 286 |
286 // Configure the track based on the WAV header information. | 287 // Configure the track based on the WAV header information. |
287 MediaConsumerPtr media_pipe; | 288 MediaConsumerPtr media_pipe; |
288 audio_track_->Configure(cfg.Pass(), GetProxy(&media_pipe)); | 289 audio_track_->Configure(cfg.Pass(), GetProxy(&media_pipe)); |
289 | 290 |
290 // Grab the rate control interface for our audio renderer. | 291 // Grab the rate control interface for our audio renderer. |
291 audio_track_->GetRateControl(GetProxy(&rate_control_)); | 292 audio_track_->GetRateControl(GetProxy(&rate_control_)); |
292 rate_control_.set_connection_error_handler([this]() { | 293 rate_control_.set_connection_error_handler([this]() { |
293 OnConnectionError("rate_control"); | 294 OnConnectionError("rate_control"); |
294 }); | 295 }); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } // namespace audio | 551 } // namespace audio |
551 } // namespace media | 552 } // namespace media |
552 } // namespace mojo | 553 } // namespace mojo |
553 | 554 |
554 MojoResult MojoMain(MojoHandle app_request) { | 555 MojoResult MojoMain(MojoHandle app_request) { |
555 mojo::ApplicationRunner runner( | 556 mojo::ApplicationRunner runner( |
556 std::unique_ptr<mojo::media::audio::examples::PlayWAVApp>( | 557 std::unique_ptr<mojo::media::audio::examples::PlayWAVApp>( |
557 new mojo::media::audio::examples::PlayWAVApp())); | 558 new mojo::media::audio::examples::PlayWAVApp())); |
558 return runner.Run(app_request); | 559 return runner.Run(app_request); |
559 } | 560 } |
OLD | NEW |