OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_ | 5 #ifndef MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_ |
6 #define MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_ | 6 #define MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_ |
7 | 7 |
8 #include <GL/glew.h> | 8 #include <GL/glew.h> |
9 #include <GL/glxew.h> | 9 #include <GL/glxew.h> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // This method is called to paint the current video frame to the assigned | 26 // This method is called to paint the current video frame to the assigned |
27 // window. | 27 // window. |
28 void Paint(); | 28 void Paint(); |
29 | 29 |
30 // media::FilterFactoryImpl2 Implementation. | 30 // media::FilterFactoryImpl2 Implementation. |
31 static bool IsMediaFormatSupported(const media::MediaFormat& media_format); | 31 static bool IsMediaFormatSupported(const media::MediaFormat& media_format); |
32 | 32 |
33 static GlVideoRenderer* instance() { return instance_; } | 33 static GlVideoRenderer* instance() { return instance_; } |
34 | 34 |
| 35 void set_glx_thread_message_loop(MessageLoop* message_loop) { |
| 36 glx_thread_message_loop_ = message_loop; |
| 37 } |
| 38 |
| 39 MessageLoop* glx_thread_message_loop() { |
| 40 return glx_thread_message_loop_; |
| 41 } |
| 42 |
35 protected: | 43 protected: |
36 // VideoRendererBase implementation. | 44 // VideoRendererBase implementation. |
37 virtual bool OnInitialize(media::VideoDecoder* decoder); | 45 virtual bool OnInitialize(media::VideoDecoder* decoder); |
38 virtual void OnStop(); | 46 virtual void OnStop(); |
39 virtual void OnFrameAvailable(); | 47 virtual void OnFrameAvailable(); |
40 | 48 |
41 private: | 49 private: |
42 // Only allow to be deleted by reference counting. | 50 // Only allow to be deleted by reference counting. |
43 friend class scoped_refptr<GlVideoRenderer>; | 51 friend class scoped_refptr<GlVideoRenderer>; |
44 virtual ~GlVideoRenderer(); | 52 virtual ~GlVideoRenderer(); |
45 | 53 |
46 int width_; | 54 int width_; |
47 int height_; | 55 int height_; |
48 bool uses_egl_image_; | 56 bool uses_egl_image_; |
49 | 57 |
50 Display* display_; | 58 Display* display_; |
51 Window window_; | 59 Window window_; |
52 | 60 |
53 // Protects |new_frame_|. | |
54 Lock lock_; | |
55 bool new_frame_; | |
56 | |
57 // GL context. | 61 // GL context. |
58 GLXContext gl_context_; | 62 GLXContext gl_context_; |
59 | 63 |
60 // 3 textures, one for each plane. | 64 // 3 textures, one for each plane. |
61 GLuint textures_[3]; | 65 GLuint textures_[3]; |
62 | 66 |
| 67 MessageLoop* glx_thread_message_loop_; |
63 static GlVideoRenderer* instance_; | 68 static GlVideoRenderer* instance_; |
64 | 69 |
65 DISALLOW_COPY_AND_ASSIGN(GlVideoRenderer); | 70 DISALLOW_COPY_AND_ASSIGN(GlVideoRenderer); |
66 }; | 71 }; |
67 | 72 |
68 #endif // MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_ | 73 #endif // MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_ |
OLD | NEW |