Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: media/tools/player_x11/player_x11.cc

Issue 12096081: Replace VideoRendererBase Get/PutCurrentFrame() with a VideoFrame-containing callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 XSelectInput(g_display, g_window, 76 XSelectInput(g_display, g_window,
77 ExposureMask | ButtonPressMask | KeyPressMask); 77 ExposureMask | ButtonPressMask | KeyPressMask);
78 XMapWindow(g_display, g_window); 78 XMapWindow(g_display, g_window);
79 return true; 79 return true;
80 } 80 }
81 81
82 void SetOpaque(bool /*opaque*/) { 82 void SetOpaque(bool /*opaque*/) {
83 } 83 }
84 84
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 const scoped_refptr<media::VideoFrame>& video_frame) {
87 if (message_loop != MessageLoop::current()) { 88 if (message_loop != MessageLoop::current()) {
88 message_loop->PostTask(FROM_HERE, base::Bind( 89 message_loop->PostTask(FROM_HERE, base::Bind(
89 &Paint, message_loop, paint_cb)); 90 &Paint, message_loop, paint_cb, video_frame));
90 return; 91 return;
91 } 92 }
92 93
93 scoped_refptr<media::VideoFrame> video_frame; 94 paint_cb.Run(video_frame);
94 g_video_renderer->GetCurrentFrame(&video_frame);
acolwell GONE FROM CHROMIUM 2013/02/01 00:24:34 I think g_video_renderer can go away now. Perhap
scherkus (not reviewing) 2013/02/01 22:45:25 Done.
95 if (video_frame)
96 paint_cb.Run(video_frame);
97 g_video_renderer->PutCurrentFrame(video_frame);
98 } 95 }
99 96
100 static void OnBufferingState(media::Pipeline::BufferingState buffering_state) {} 97 static void OnBufferingState(media::Pipeline::BufferingState buffering_state) {}
101 98
102 // TODO(vrk): Re-enabled audio. (crbug.com/112159) 99 // TODO(vrk): Re-enabled audio. (crbug.com/112159)
103 bool InitPipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, 100 bool InitPipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop,
104 const scoped_refptr<media::DataSource>& data_source, 101 const scoped_refptr<media::DataSource>& data_source,
105 const PaintCB& paint_cb, 102 const PaintCB& paint_cb,
106 bool /* enable_audio */, 103 bool /* enable_audio */,
107 scoped_refptr<media::Pipeline>* pipeline, 104 scoped_refptr<media::Pipeline>* pipeline,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // Release callback which releases video renderer. Do this before cleaning up 291 // Release callback which releases video renderer. Do this before cleaning up
295 // X below since the video renderer has some X cleanup duties as well. 292 // X below since the video renderer has some X cleanup duties as well.
296 paint_cb.Reset(); 293 paint_cb.Reset();
297 294
298 XDestroyWindow(g_display, g_window); 295 XDestroyWindow(g_display, g_window);
299 XCloseDisplay(g_display); 296 XCloseDisplay(g_display);
300 g_audio_manager = NULL; 297 g_audio_manager = NULL;
301 298
302 return 0; 299 return 0;
303 } 300 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698