Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this | |
| 2 // source code is governed by a BSD-style license that can be found in the | |
| 3 // LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_ | |
| 6 #define MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_ | |
| 7 | |
| 8 #include <EGL/egl.h> | |
| 9 #include <GLES2/gl2.h> | |
| 10 #include <GLES2/gl2ext.h> | |
| 11 | |
| 12 #include "base/lock.h" | |
| 13 #include "base/scoped_ptr.h" | |
| 14 #include "media/base/factory.h" | |
| 15 #include "media/filters/video_renderer_base.h" | |
| 16 | |
| 17 class GlesVideoRenderer : public media::VideoRendererBase { | |
| 18 public: | |
| 19 static media::FilterFactory* CreateFactory(Display* display, | |
| 20 Window window) { | |
| 21 return new media::FilterFactoryImpl2< | |
| 22 GlesVideoRenderer, Display*, Window>(display, window); | |
| 23 } | |
| 24 | |
| 25 GlesVideoRenderer(Display* display, Window window); | |
| 26 | |
| 27 // This method is called to paint the current video frame to the assigned | |
| 28 // window. | |
| 29 virtual void Paint(); | |
|
scherkus (not reviewing)
2010/02/12 01:04:20
this doesn't need to be virtual
| |
| 30 | |
| 31 // media::FilterFactoryImpl2 Implementation. | |
| 32 static bool IsMediaFormatSupported(const media::MediaFormat& media_format); | |
| 33 | |
| 34 static GlesVideoRenderer* instance() { return instance_; } | |
| 35 | |
| 36 protected: | |
| 37 // VideoRendererBase implementation. | |
| 38 virtual bool OnInitialize(media::VideoDecoder* decoder); | |
| 39 virtual void OnStop(); | |
| 40 virtual void OnFrameAvailable(); | |
| 41 | |
| 42 private: | |
| 43 // Only allow to be deleted by reference counting. | |
| 44 friend class scoped_refptr<GlesVideoRenderer>; | |
| 45 virtual ~GlesVideoRenderer(); | |
| 46 | |
| 47 int width_; | |
| 48 int height_; | |
| 49 | |
| 50 Display* display_; | |
| 51 Window window_; | |
| 52 | |
| 53 // Protects |new_frame_|. | |
| 54 Lock lock_; | |
| 55 bool new_frame_; | |
| 56 | |
| 57 // EGL context. | |
| 58 EGLDisplay egl_display_; | |
| 59 EGLSurface egl_surface_; | |
| 60 EGLContext egl_context_; | |
| 61 | |
| 62 // 3 textures, one for each plane. | |
| 63 GLuint textures_[3]; | |
| 64 | |
| 65 // Shaders and program for YUV->RGB conversion. | |
| 66 GLuint vertex_shader_; | |
| 67 GLuint fragment_shader_; | |
| 68 GLuint program_; | |
| 69 | |
| 70 static GlesVideoRenderer* instance_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(GlesVideoRenderer); | |
| 73 }; | |
| 74 | |
| 75 #endif // MEDIA_TOOLS_PLAYER_X11_GLES_VIDEO_RENDERER_H_ | |
| OLD | NEW |