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 <EGL/egl.h> | 8 #include <EGL/egl.h> |
9 #include <EGL/eglext.h> | 9 #include <EGL/eglext.h> |
10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // VideoRendererBase implementation. | 47 // VideoRendererBase implementation. |
48 virtual bool OnInitialize(media::VideoDecoder* decoder); | 48 virtual bool OnInitialize(media::VideoDecoder* decoder); |
49 virtual void OnStop(); | 49 virtual void OnStop(); |
50 virtual void OnFrameAvailable(); | 50 virtual void OnFrameAvailable(); |
51 | 51 |
52 private: | 52 private: |
53 // Only allow to be deleted by reference counting. | 53 // Only allow to be deleted by reference counting. |
54 friend class scoped_refptr<GlesVideoRenderer>; | 54 friend class scoped_refptr<GlesVideoRenderer>; |
55 virtual ~GlesVideoRenderer(); | 55 virtual ~GlesVideoRenderer(); |
56 | 56 |
| 57 GLuint FindTexture(scoped_refptr<media::VideoFrame> video_frame); |
57 bool InitializeGles(); | 58 bool InitializeGles(); |
58 void CreateShader(GLuint program, GLenum type, | 59 void CreateShader(GLuint program, GLenum type, |
59 const char* vs_source, int vs_size); | 60 const char* vs_source, int vs_size); |
60 void LinkProgram(GLuint program); | 61 void LinkProgram(GLuint program); |
61 void CreateTextureAndProgramEgl(); | 62 void CreateTextureAndProgramEgl(); |
62 void CreateTextureAndProgramYuv2Rgb(); | 63 void CreateTextureAndProgramYuv2Rgb(); |
63 | 64 |
64 PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr_; | 65 PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr_; |
65 PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image_khr_; | 66 PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image_khr_; |
66 PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gl_eglimage_target_texture2d_oes_; | |
67 | 67 |
68 int width_; | 68 int width_; |
69 int height_; | 69 int height_; |
70 bool uses_egl_image_; | 70 bool uses_egl_image_; |
71 | 71 |
72 Display* display_; | 72 Display* display_; |
73 Window window_; | 73 Window window_; |
74 | 74 |
75 // EGL context. | 75 // EGL context. |
76 EGLDisplay egl_display_; | 76 EGLDisplay egl_display_; |
77 EGLSurface egl_surface_; | 77 EGLSurface egl_surface_; |
78 EGLContext egl_context_; | 78 EGLContext egl_context_; |
79 | 79 |
80 // textures for EGL image | 80 // textures for EGL image |
81 typedef std::pair<scoped_refptr<media::VideoFrame>, GLuint> EglFrame; | 81 typedef std::pair<scoped_refptr<media::VideoFrame>, GLuint> EglFrame; |
82 std::vector<EglFrame> egl_frames_; | 82 std::vector<EglFrame> egl_frames_; |
83 | 83 |
84 // 3 textures, one for each plane. | 84 // 3 textures, one for each plane. |
85 GLuint textures_[3]; | 85 GLuint textures_[3]; |
86 | 86 |
87 MessageLoop* glx_thread_message_loop_; | 87 MessageLoop* glx_thread_message_loop_; |
88 static GlesVideoRenderer* instance_; | 88 static GlesVideoRenderer* instance_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(GlesVideoRenderer); | 90 DISALLOW_COPY_AND_ASSIGN(GlesVideoRenderer); |
91 }; | 91 }; |
92 | 92 |
93 #endif // MEDIA_TOOLS_PLAYER_X11_GLES_VIDEO_RENDERER_H_ | 93 #endif // MEDIA_TOOLS_PLAYER_X11_GLES_VIDEO_RENDERER_H_ |
OLD | NEW |