Ticket #2649: videoout_opengl.h

File videoout_opengl.h, 3.1 KB (added by anonymous, 20 years ago)
Line 
1#ifndef VIDEOOUT_OPENGL_H_
2#define VIDEOOUT_OPENGL_H_
3
4#include <DisplayRes.h>
5#include "videooutbase.h"
6#include "NuppelVideoPlayer.h"
7
8#define GL_GLEXT_PROTOTYPES
9#define GLX_GLXEXT_PROTOTYPES
10#define XMD_H 1
11#include <GL/glx.h>
12#include <GL/gl.h>
13#undef GLX_ARB_get_proc_address
14#include <GL/glxext.h>
15#include <GL/glext.h>
16
17#define XMD_H 1
18#include <X11/extensions/xf86vmode.h>
19
20extern "C" {
21#include <X11/extensions/Xinerama.h>
22}
23
24const int kMinOpenglTexSize = 64;
25const int kNumberBuffers = 2;
26
27typedef struct GLframe
28{
29 uint vid_width;
30 uint vid_height;
31 GLint tex_width;
32 GLint tex_height;
33 QRect position;
34 long long uOffset;
35 long long vOffset;
36 GLuint tex;
37};
38
39class VideoOutputOpengl : public VideoOutput
40{
41 public:
42 VideoOutputOpengl();
43 ~VideoOutputOpengl();
44 bool Init(int width, int height, float aspect, WId winid,
45 int winx, int winy, int winw, int winh, WId embedid = 0);
46 void PrepareFrame(VideoFrame *buffer, FrameScanType);
47 void ShowPip(VideoFrame *frame, NuppelVideoPlayer *pipplayer);
48 void Show(FrameScanType );
49 void MoveResize();
50 void InputChanged(int width, int height, float aspect, MythCodecID codec_id);
51 void Zoom(int direction);
52 void AspectChanged(float aspect);
53 void EmbedInWidget(WId wid, int x, int y, int w, int h);
54 void StopEmbedding(void);
55 void ResizeForGui(void);
56 void ResizeForVideo(uint width, uint height);
57 void ResizeForVideo(void);
58 int GetRefreshRate(void);
59 void DrawUnusedRects(bool sync = true);
60 float GetDisplayAspect(void);
61 void UpdatePauseFrame(void);
62 void ProcessFrame(VideoFrame *frame, OSD *osd,
63 FilterChain *filterList,
64 NuppelVideoPlayer *pipPlayer);
65 int SetPictureAttribute(int attributeType, int newValue);
66
67 private:
68 void SetViewPort();
69 void InitOpenGL();
70 void InitDisplayMeasurements(uint width, uint height);
71 bool InitSetupBuffers(void);
72 void CreateBuffers(void);
73 void CreatePauseFrame(void);
74 void DeleteBuffers(bool delete_pause_frame);
75 bool CheckExtensions(void);
76 bool LoadFragmentProgram(void);
77 bool CreateVideoTexture(GLframe *frame, QSize size, QRect pos);
78 bool CreateTexture(GLint width, GLint height, GLuint *tex, unsigned char *data);
79 bool InitGlxContext(WId winid, int width, int height);
80 void UpdateVideoTexture(GLframe vid, VideoFrame *buffer);
81
82 // Misc.
83 DisplayRes *display_res;
84 QMutex global_lock;
85
86 // Basic X11 info
87 Window XJ_win;
88 Window XJ_curwin;
89 Display *XJ_disp;
90 int XJ_screen_num;
91 bool XJ_started;
92
93 // opengl
94 GLXContext my_context;
95 GLint max_texture_size;
96 GLuint frag_prog;
97 GLframe glVideo;
98 GLframe glPip;
99 bool texture_rects;
100 int my_gl_texture;
101
102 // General
103 bool use_colourcontrols;
104 VideoFrame av_pause_frame;
105 unsigned char *scratchspace;
106 bool actually_draw_pip;
107};
108
109#endif