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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 typedef base::Callback<void(media::VideoFrame*)> PaintCB; | 85 typedef base::Callback<void(media::VideoFrame*)> PaintCB; |
86 void Paint(MessageLoop* message_loop, const PaintCB& paint_cb) { | 86 void Paint(MessageLoop* message_loop, const PaintCB& paint_cb) { |
87 if (message_loop != MessageLoop::current()) { | 87 if (message_loop != MessageLoop::current()) { |
88 message_loop->PostTask(FROM_HERE, base::Bind( | 88 message_loop->PostTask(FROM_HERE, base::Bind( |
89 &Paint, message_loop, paint_cb)); | 89 &Paint, message_loop, paint_cb)); |
90 return; | 90 return; |
91 } | 91 } |
92 | 92 |
93 scoped_refptr<media::VideoFrame> video_frame; | 93 scoped_refptr<media::VideoFrame> video_frame; |
94 g_video_renderer->GetCurrentFrame(&video_frame); | 94 g_video_renderer->GetCurrentFrame(&video_frame); |
95 if (video_frame) | 95 if (video_frame.get()) |
96 paint_cb.Run(video_frame); | 96 paint_cb.Run(video_frame.get()); |
97 g_video_renderer->PutCurrentFrame(video_frame); | 97 g_video_renderer->PutCurrentFrame(video_frame); |
98 } | 98 } |
99 | 99 |
100 static void OnBufferingState(media::Pipeline::BufferingState buffering_state) {} | 100 static void OnBufferingState(media::Pipeline::BufferingState buffering_state) {} |
101 | 101 |
102 // TODO(vrk): Re-enabled audio. (crbug.com/112159) | 102 // TODO(vrk): Re-enabled audio. (crbug.com/112159) |
103 bool InitPipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, | 103 bool InitPipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, |
104 const scoped_refptr<media::DataSource>& data_source, | 104 const scoped_refptr<media::DataSource>& data_source, |
105 const PaintCB& paint_cb, | 105 const PaintCB& paint_cb, |
106 bool /* enable_audio */, | 106 bool /* enable_audio */, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // Release callback which releases video renderer. Do this before cleaning up | 306 // Release callback which releases video renderer. Do this before cleaning up |
307 // X below since the video renderer has some X cleanup duties as well. | 307 // X below since the video renderer has some X cleanup duties as well. |
308 paint_cb.Reset(); | 308 paint_cb.Reset(); |
309 | 309 |
310 XDestroyWindow(g_display, g_window); | 310 XDestroyWindow(g_display, g_window); |
311 XCloseDisplay(g_display); | 311 XCloseDisplay(g_display); |
312 g_audio_manager = NULL; | 312 g_audio_manager = NULL; |
313 | 313 |
314 return 0; | 314 return 0; |
315 } | 315 } |
OLD | NEW |