summaryrefslogtreecommitdiff
path: root/client/xvaccelrenderer.h
blob: a9cd383f1578a236e36e7c1a845341344a205e0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
#ifndef __XVACCELRENDERER_H__
#define  __XVACCELRENDERER_H__

#include <assert.h>

#include <QWidget>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/Xvlib.h>
#include <X11/extensions/XShm.h>
#include <errno.h>

// Use this define for YV12 colorspace, default is YUY2
//#define COLORSPACE_YV12

//typedef unsigned long int QWidget;
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;

#define ADM_assert(x) assert(x)

class XvAccelRender
{
public:
	XvAccelRender(QWidget *window, uint32_t w, uint32_t h);
  ~XvAccelRender();
	uint8_t display(uint32_t w, uint32_t h);

	unsigned int width, height;

  char *getDisplayData();

private:
	unsigned int xv_port;
	uint32_t xv_format;
	Display *xv_display;
  XvImage *xvimage;
  GC xv_gc;
	XGCValues xv_xgc;
	Window xv_win;
	XShmSegmentInfo Shminfo;

	uint8_t GUI_XvList(Display *dis, uint32_t port, uint32_t * fmt);
	uint8_t GUI_XvInit(QWidget *window, uint32_t w, uint32_t h);
	void GUI_XvEnd();
	uint8_t GUI_XvDisplay(uint32_t w, uint32_t h);
};

#endif/*__XVACCELRENDERER_H__*/