| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <signal.h> | 5 #include <signal.h> |
| 6 | 6 |
| 7 #include <iostream> // NOLINT | 7 #include <iostream> // NOLINT |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "media/audio/audio_manager.h" | 17 #include "media/audio/audio_manager.h" |
| 18 #include "media/audio/null_audio_sink.h" | 18 #include "media/audio/null_audio_sink.h" |
| 19 #include "media/base/audio_hardware_config.h" |
| 19 #include "media/base/decryptor.h" | 20 #include "media/base/decryptor.h" |
| 20 #include "media/base/filter_collection.h" | 21 #include "media/base/filter_collection.h" |
| 21 #include "media/base/media.h" | 22 #include "media/base/media.h" |
| 22 #include "media/base/media_log.h" | 23 #include "media/base/media_log.h" |
| 23 #include "media/base/media_switches.h" | 24 #include "media/base/media_switches.h" |
| 24 #include "media/base/pipeline.h" | 25 #include "media/base/pipeline.h" |
| 25 #include "media/base/video_frame.h" | 26 #include "media/base/video_frame.h" |
| 26 #include "media/filters/audio_renderer_impl.h" | 27 #include "media/filters/audio_renderer_impl.h" |
| 27 #include "media/filters/ffmpeg_audio_decoder.h" | 28 #include "media/filters/ffmpeg_audio_decoder.h" |
| 28 #include "media/filters/ffmpeg_demuxer.h" | 29 #include "media/filters/ffmpeg_demuxer.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 task_runner, | 131 task_runner, |
| 131 video_decoders.Pass(), | 132 video_decoders.Pass(), |
| 132 media::SetDecryptorReadyCB(), | 133 media::SetDecryptorReadyCB(), |
| 133 base::Bind(&Paint, paint_message_loop, paint_cb), | 134 base::Bind(&Paint, paint_message_loop, paint_cb), |
| 134 base::Bind(&SetOpaque), | 135 base::Bind(&SetOpaque), |
| 135 true)); | 136 true)); |
| 136 collection->SetVideoRenderer(video_renderer.Pass()); | 137 collection->SetVideoRenderer(video_renderer.Pass()); |
| 137 | 138 |
| 138 ScopedVector<media::AudioDecoder> audio_decoders; | 139 ScopedVector<media::AudioDecoder> audio_decoders; |
| 139 audio_decoders.push_back(new media::FFmpegAudioDecoder(task_runner)); | 140 audio_decoders.push_back(new media::FFmpegAudioDecoder(task_runner)); |
| 140 scoped_ptr<media::AudioRenderer> audio_renderer(new media::AudioRendererImpl( | 141 media::AudioParameters out_params( |
| 141 task_runner, | 142 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 142 new media::NullAudioSink(task_runner), | 143 media::CHANNEL_LAYOUT_STEREO, |
| 143 audio_decoders.Pass(), | 144 44100, |
| 144 media::SetDecryptorReadyCB())); | 145 16, |
| 146 512); |
| 147 media::AudioHardwareConfig hardware_config(out_params, out_params); |
| 148 |
| 149 scoped_ptr<media::AudioRenderer> audio_renderer( |
| 150 new media::AudioRendererImpl(task_runner, |
| 151 new media::NullAudioSink(task_runner), |
| 152 audio_decoders.Pass(), |
| 153 media::SetDecryptorReadyCB(), |
| 154 &hardware_config)); |
| 155 |
| 145 collection->SetAudioRenderer(audio_renderer.Pass()); | 156 collection->SetAudioRenderer(audio_renderer.Pass()); |
| 146 | 157 |
| 147 base::WaitableEvent event(true, false); | 158 base::WaitableEvent event(true, false); |
| 148 media::PipelineStatus status; | 159 media::PipelineStatus status; |
| 149 | 160 |
| 150 pipeline->Start( | 161 pipeline->Start( |
| 151 collection.Pass(), base::Bind(&DoNothing), base::Bind(&OnStatus), | 162 collection.Pass(), base::Bind(&DoNothing), base::Bind(&OnStatus), |
| 152 base::Bind(&SaveStatusAndSignal, &event, &status), | 163 base::Bind(&SaveStatusAndSignal, &event, &status), |
| 153 base::Bind(&OnMetadata), base::Bind(&DoNothing), | 164 base::Bind(&OnMetadata), base::Bind(&DoNothing), |
| 154 base::Bind(&DoNothing)); | 165 base::Bind(&DoNothing)); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // Release callback which releases video renderer. Do this before cleaning up | 314 // Release callback which releases video renderer. Do this before cleaning up |
| 304 // X below since the video renderer has some X cleanup duties as well. | 315 // X below since the video renderer has some X cleanup duties as well. |
| 305 paint_cb.Reset(); | 316 paint_cb.Reset(); |
| 306 | 317 |
| 307 XDestroyWindow(g_display, g_window); | 318 XDestroyWindow(g_display, g_window); |
| 308 XCloseDisplay(g_display); | 319 XCloseDisplay(g_display); |
| 309 g_audio_manager = NULL; | 320 g_audio_manager = NULL; |
| 310 | 321 |
| 311 return 0; | 322 return 0; |
| 312 } | 323 } |
| OLD | NEW |