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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 static void OnStatus(media::PipelineStatus status) {} | 88 static void OnStatus(media::PipelineStatus status) {} |
89 | 89 |
90 static void OnMetadata(media::PipelineMetadata metadata) {} | 90 static void OnMetadata(media::PipelineMetadata metadata) {} |
91 | 91 |
92 static void OnBufferingStateChanged(media::BufferingState buffering_state) {} | 92 static void OnBufferingStateChanged(media::BufferingState buffering_state) {} |
93 | 93 |
94 static void OnAddTextTrack(const media::TextTrackConfig& config, | 94 static void OnAddTextTrack(const media::TextTrackConfig& config, |
95 const media::AddTextTrackDoneCB& done_cb) { | 95 const media::AddTextTrackDoneCB& done_cb) { |
96 } | 96 } |
97 | 97 |
98 static void NeedKey(const std::string& type, | 98 static void OnEncryptedMediaInitData(const std::string& init_data_type, |
99 const std::vector<uint8>& init_data) { | 99 const std::vector<uint8>& init_data) { |
100 std::cout << "File is encrypted." << std::endl; | 100 std::cout << "File is encrypted." << std::endl; |
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 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 &GlVideoRenderer::Paint, new GlVideoRenderer(g_display, g_window))); | 274 &GlVideoRenderer::Paint, new GlVideoRenderer(g_display, g_window))); |
275 } else { | 275 } else { |
276 paint_cb = media::BindToCurrentLoop(base::Bind( | 276 paint_cb = media::BindToCurrentLoop(base::Bind( |
277 &X11VideoRenderer::Paint, new X11VideoRenderer(g_display, g_window))); | 277 &X11VideoRenderer::Paint, new X11VideoRenderer(g_display, g_window))); |
278 } | 278 } |
279 | 279 |
280 scoped_ptr<media::DataSource> data_source(new DataSourceLogger( | 280 scoped_ptr<media::DataSource> data_source(new DataSourceLogger( |
281 CreateDataSource(filename), command_line->HasSwitch("streaming"))); | 281 CreateDataSource(filename), command_line->HasSwitch("streaming"))); |
282 scoped_ptr<media::Demuxer> demuxer(new media::FFmpegDemuxer( | 282 scoped_ptr<media::Demuxer> demuxer(new media::FFmpegDemuxer( |
283 media_thread.message_loop_proxy(), data_source.get(), | 283 media_thread.message_loop_proxy(), data_source.get(), |
284 base::Bind(&NeedKey), new media::MediaLog())); | 284 base::Bind(&OnEncryptedMediaInitData), new media::MediaLog())); |
285 | 285 |
286 media::Pipeline pipeline(media_thread.message_loop_proxy(), | 286 media::Pipeline pipeline(media_thread.message_loop_proxy(), |
287 new media::MediaLog()); | 287 new media::MediaLog()); |
288 InitPipeline(&pipeline, media_thread.message_loop_proxy(), demuxer.get(), | 288 InitPipeline(&pipeline, media_thread.message_loop_proxy(), demuxer.get(), |
289 paint_cb, command_line->HasSwitch("audio")); | 289 paint_cb, command_line->HasSwitch("audio")); |
290 | 290 |
291 // Main loop of the application. | 291 // Main loop of the application. |
292 g_running = true; | 292 g_running = true; |
293 | 293 |
294 message_loop.PostTask(FROM_HERE, base::Bind( | 294 message_loop.PostTask(FROM_HERE, base::Bind( |
295 &PeriodicalUpdate, base::Unretained(&pipeline), &message_loop)); | 295 &PeriodicalUpdate, base::Unretained(&pipeline), &message_loop)); |
296 message_loop.Run(); | 296 message_loop.Run(); |
297 | 297 |
298 // Cleanup tasks. | 298 // Cleanup tasks. |
299 media_thread.Stop(); | 299 media_thread.Stop(); |
300 | 300 |
301 // Release callback which releases video renderer. Do this before cleaning up | 301 // Release callback which releases video renderer. Do this before cleaning up |
302 // 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. |
303 paint_cb.Reset(); | 303 paint_cb.Reset(); |
304 | 304 |
305 XDestroyWindow(g_display, g_window); | 305 XDestroyWindow(g_display, g_window); |
306 XCloseDisplay(g_display); | 306 XCloseDisplay(g_display); |
307 g_audio_manager = NULL; | 307 g_audio_manager = NULL; |
308 | 308 |
309 return 0; | 309 return 0; |
310 } | 310 } |
OLD | NEW |