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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: media/tools/player_x11/gl_video_renderer.h
diff --git a/media/tools/player_x11/gl_video_renderer.h b/media/tools/player_x11/gl_video_renderer.h
new file mode 100644
index 0000000000000000000000000000000000000000..083b254ebe74a5e04de0d82275ee4981e0eaaa88
--- /dev/null
+++ b/media/tools/player_x11/gl_video_renderer.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in the
+// LICENSE file.
+
+#ifndef MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_
+#define MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_
+
+#include <GL/glew.h>
+#include <GL/glxew.h>
+
+#include "base/lock.h"
+#include "base/scoped_ptr.h"
+#include "media/base/factory.h"
+#include "media/filters/video_renderer_base.h"
+
+class GlVideoRenderer : public media::VideoRendererBase {
+ public:
+ static media::FilterFactory* CreateFactory(Display* display,
+ Window window) {
+ return new media::FilterFactoryImpl2<
+ GlVideoRenderer, Display*, Window>(display, window);
+ }
+
+ GlVideoRenderer(Display* display, Window window);
+
+ // This method is called to paint the current video frame to the assigned
+ // window.
+ virtual void Paint();
scherkus (not reviewing) 2010/02/12 01:04:20 this doesn't need to be virtual
+
+ // media::FilterFactoryImpl2 Implementation.
+ static bool IsMediaFormatSupported(const media::MediaFormat& media_format);
+
+ static GlVideoRenderer* instance() { return instance_; }
+
+ protected:
+ // VideoRendererBase implementation.
+ virtual bool OnInitialize(media::VideoDecoder* decoder);
+ virtual void OnStop();
+ virtual void OnFrameAvailable();
+
+ private:
+ // Only allow to be deleted by reference counting.
+ friend class scoped_refptr<GlVideoRenderer>;
+ virtual ~GlVideoRenderer();
+
+ int width_;
+ int height_;
+
+ Display* display_;
+ Window window_;
+
+ // Protects |new_frame_|.
+ Lock lock_;
+ bool new_frame_;
+
+ // GL context.
+ GLXContext gl_context_;
+
+ // 3 textures, one for each plane.
+ GLuint textures_[3];
+
+ // Shaders and program for YUV->RGB conversion.
+ GLuint vertex_shader_;
+ GLuint fragment_shader_;
+ GLuint program_;
+
+ static GlVideoRenderer* instance_;
+
+ DISALLOW_COPY_AND_ASSIGN(GlVideoRenderer);
+};
+
+#endif // MEDIA_TOOLS_PLAYER_X11_GL_VIDEO_RENDERER_H_

Powered by Google App Engine
This is Rietveld 408576698