| 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" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 static void SaveStatusAndSignal(base::WaitableEvent* event, | 103 static void SaveStatusAndSignal(base::WaitableEvent* event, |
| 104 media::PipelineStatus* status_out, | 104 media::PipelineStatus* status_out, |
| 105 media::PipelineStatus status) { | 105 media::PipelineStatus status) { |
| 106 *status_out = status; | 106 *status_out = status; |
| 107 event->Signal(); | 107 event->Signal(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 // TODO(vrk): Re-enabled audio. (crbug.com/112159) | 110 // TODO(vrk): Re-enabled audio. (crbug.com/112159) |
| 111 void InitPipeline(media::Pipeline* pipeline, | 111 void InitPipeline( |
| 112 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 112 media::Pipeline* pipeline, |
| 113 media::Demuxer* demuxer, | 113 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 114 const PaintCB& paint_cb, | 114 media::Demuxer* demuxer, |
| 115 bool /* enable_audio */, | 115 const PaintCB& paint_cb, |
| 116 base::MessageLoop* paint_message_loop) { | 116 bool /* enable_audio */, |
| 117 base::MessageLoop* paint_message_loop) { |
| 117 // Create our filter factories. | 118 // Create our filter factories. |
| 118 scoped_ptr<media::FilterCollection> collection( | 119 scoped_ptr<media::FilterCollection> collection( |
| 119 new media::FilterCollection()); | 120 new media::FilterCollection()); |
| 120 collection->SetDemuxer(demuxer); | 121 collection->SetDemuxer(demuxer); |
| 121 | 122 |
| 122 ScopedVector<media::VideoDecoder> video_decoders; | 123 ScopedVector<media::VideoDecoder> video_decoders; |
| 123 video_decoders.push_back(new media::FFmpegVideoDecoder(message_loop)); | 124 video_decoders.push_back(new media::FFmpegVideoDecoder(task_runner)); |
| 124 scoped_ptr<media::VideoRenderer> video_renderer(new media::VideoRendererBase( | 125 scoped_ptr<media::VideoRenderer> video_renderer(new media::VideoRendererBase( |
| 125 message_loop, | 126 task_runner, |
| 126 video_decoders.Pass(), | 127 video_decoders.Pass(), |
| 127 media::SetDecryptorReadyCB(), | 128 media::SetDecryptorReadyCB(), |
| 128 base::Bind(&Paint, paint_message_loop, paint_cb), | 129 base::Bind(&Paint, paint_message_loop, paint_cb), |
| 129 base::Bind(&SetOpaque), | 130 base::Bind(&SetOpaque), |
| 130 true)); | 131 true)); |
| 131 collection->SetVideoRenderer(video_renderer.Pass()); | 132 collection->SetVideoRenderer(video_renderer.Pass()); |
| 132 | 133 |
| 133 ScopedVector<media::AudioDecoder> audio_decoders; | 134 ScopedVector<media::AudioDecoder> audio_decoders; |
| 134 audio_decoders.push_back(new media::FFmpegAudioDecoder(message_loop)); | 135 audio_decoders.push_back(new media::FFmpegAudioDecoder(task_runner)); |
| 135 scoped_ptr<media::AudioRenderer> audio_renderer(new media::AudioRendererImpl( | 136 scoped_ptr<media::AudioRenderer> audio_renderer(new media::AudioRendererImpl( |
| 136 message_loop, | 137 task_runner, |
| 137 new media::NullAudioSink(message_loop), | 138 new media::NullAudioSink(task_runner), |
| 138 audio_decoders.Pass(), | 139 audio_decoders.Pass(), |
| 139 media::SetDecryptorReadyCB(), | 140 media::SetDecryptorReadyCB(), |
| 140 true)); | 141 true)); |
| 141 collection->SetAudioRenderer(audio_renderer.Pass()); | 142 collection->SetAudioRenderer(audio_renderer.Pass()); |
| 142 | 143 |
| 143 base::WaitableEvent event(true, false); | 144 base::WaitableEvent event(true, false); |
| 144 media::PipelineStatus status; | 145 media::PipelineStatus status; |
| 145 | 146 |
| 146 pipeline->Start( | 147 pipeline->Start( |
| 147 collection.Pass(), base::Closure(), media::PipelineStatusCB(), | 148 collection.Pass(), base::Closure(), media::PipelineStatusCB(), |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // Release callback which releases video renderer. Do this before cleaning up | 301 // Release callback which releases video renderer. Do this before cleaning up |
| 301 // X below since the video renderer has some X cleanup duties as well. | 302 // X below since the video renderer has some X cleanup duties as well. |
| 302 paint_cb.Reset(); | 303 paint_cb.Reset(); |
| 303 | 304 |
| 304 XDestroyWindow(g_display, g_window); | 305 XDestroyWindow(g_display, g_window); |
| 305 XCloseDisplay(g_display); | 306 XCloseDisplay(g_display); |
| 306 g_audio_manager = NULL; | 307 g_audio_manager = NULL; |
| 307 | 308 |
| 308 return 0; | 309 return 0; |
| 309 } | 310 } |
| OLD | NEW |