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

Side by Side Diff: media/tools/player_x11/gl_video_renderer.h

Issue 596055: Implement GLES video renderer in player_x11 (Closed)
Patch Set: nits fixed Created 10 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
OLDNEW
(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 <GL/glew.h>
9 #include <GL/glxew.h>
10
11 #include "base/lock.h"
12 #include "base/scoped_ptr.h"
13 #include "media/base/factory.h"
14 #include "media/filters/video_renderer_base.h"
15
16 class GlVideoRenderer : public media::VideoRendererBase {
17 public:
18 static media::FilterFactory* CreateFactory(Display* display,
19 Window window) {
20 return new media::FilterFactoryImpl2<
21 GlVideoRenderer, Display*, Window>(display, window);
22 }
23
24 GlVideoRenderer(Display* display, Window window);
25
26 // This method is called to paint the current video frame to the assigned
27 // window.
28 virtual void Paint();
scherkus (not reviewing) 2010/02/12 01:04:20 this doesn't need to be virtual
29
30 // media::FilterFactoryImpl2 Implementation.
31 static bool IsMediaFormatSupported(const media::MediaFormat& media_format);
32
33 static GlVideoRenderer* instance() { return instance_; }
34
35 protected:
36 // VideoRendererBase implementation.
37 virtual bool OnInitialize(media::VideoDecoder* decoder);
38 virtual void OnStop();
39 virtual void OnFrameAvailable();
40
41 private:
42 // Only allow to be deleted by reference counting.
43 friend class scoped_refptr<GlVideoRenderer>;
44 virtual ~GlVideoRenderer();
45
46 int width_;
47 int height_;
48
49 Display* display_;
50 Window window_;
51
52 // Protects |new_frame_|.
53 Lock lock_;
54 bool new_frame_;
55
56 // GL context.
57 GLXContext gl_context_;
58
59 // 3 textures, one for each plane.
60 GLuint textures_[3];
61
62 // Shaders and program for YUV->RGB conversion.
63 GLuint vertex_shader_;
64 GLuint fragment_shader_;
65 GLuint program_;
66
67 static GlVideoRenderer* instance_;
68
69 DISALLOW_COPY_AND_ASSIGN(GlVideoRenderer);
70 };
71
72 #endif // MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698