summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/Makefile.am6
-rw-r--r--client/mainwindow.cc2
-rw-r--r--client/miav_client.cc2
-rw-r--r--client/player.cc41
-rw-r--r--client/player.h11
-rw-r--r--client/videowidget.cc10
-rw-r--r--client/xvaccelrenderer.cc635
-rw-r--r--client/xvaccelrenderer.h65
8 files changed, 422 insertions, 350 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index b0b3ad8..0767a22 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -23,7 +23,8 @@ miav_client_SOURCES = $(shell ../tools/MocList cc ) \
player.cc \
splashscreen.cc \
videowidget.cc \
- yuv_draw.cc
+ yuv_draw.cc \
+ xvaccelrenderer.cc
EXTRA_DIST = \
aboutwindow.h \
@@ -42,7 +43,8 @@ EXTRA_DIST = \
player.h \
splashscreen.h \
videowidget.h \
- yuv_draw.h
+ yuv_draw.h \
+ xvaccelrenderer.h
miav_client_LDADD := $(shell ../tools/MocList o ) \
../lib/libmiav.la \
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index cab6189..c3b8649 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -62,6 +62,8 @@ MainWindow::MainWindow(): QWidget()
{
MIaV::info->log("Starting MIaV v. %s.", VERSION);
+ resize(800, 600);
+
// Create the overlaying splashscreen
SplashScreen splash(this);
/*
diff --git a/client/miav_client.cc b/client/miav_client.cc
index 4051b16..ff38f09 100644
--- a/client/miav_client.cc
+++ b/client/miav_client.cc
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
NetworkSender sender;
decoder.start();
- player.start();
+ player.start(500); // 25 frames / second
sender.start();
return app.exec();
diff --git a/client/player.cc b/client/player.cc
index f44842c..fad7df4 100644
--- a/client/player.cc
+++ b/client/player.cc
@@ -26,6 +26,45 @@
*/
#include "player.h"
+static unsigned char yuv[720*576*4];
+static int num = 0;
+
+Player::Player(VideoWidget *w)
+{
+ widget = w;
+
+ render.init(widget, 720, 576);//widget->getWidth(), widget->getHeight()
+
+ connect(this, SIGNAL(timeout()), this, SLOT(show_frame()));
+
+ for(int x = 1; x < 720; x++)
+ for(int y = 1; y < 576; y++) {
+ yuv[x + y * 576 * 1] = x % 720 * 255;
+ yuv[x + y * 576 * 2] = y % 576 * 255;
+ yuv[x + y * 576 * 3] = (unsigned char)x % y;
+ }
+}
+
+Player::~Player()
+{
+ render.end();
+}
+
+void Player::show_frame()
+{
+ fprintf(stderr, "Frame!%d\n", num++);
+ render.width = widget->getWidth();
+ render.height = widget->getHeight();
+ render.display(yuv, 720, 576);//widget->width(), widget->height());
+}
+
+
+
+
+
+
+#if 0
+
#define DBG(x) fprintf(stderr, x)
#include "info.h"
@@ -284,7 +323,7 @@ void Player::run()
// From:
// http://cvs.sourceforge.net/viewcvs.py/libmpeg2/MSSG/display_x11.c?rev=1.2
-#if 0
+//#if 0
#ifdef HAVE_XV
xv_port = 0;
if (Success == XvQueryExtension(mydisplay,&ver,&rel,&req,&ev,&err)) {
diff --git a/client/player.h b/client/player.h
index 24920a5..59e1f70 100644
--- a/client/player.h
+++ b/client/player.h
@@ -27,23 +27,28 @@
#ifndef __MIAV_PLAYER_H__
#define __MIAV_PLAYER_H__
-#include <QThread>
+#include <QTimer>
#include "videowidget.h"
#include <X11/Xlib.h>
#include <X11/extensions/Xvlib.h>
-class Player : public QThread
+#include "xvaccelrenderer.h"
+
+class Player : public QTimer
{
+Q_OBJECT
public:
Player(VideoWidget *widget);
~Player();
- void run();
+public slots:
+ void show_frame();
private:
VideoWidget *widget;
+ XvAccelRender render;
Display *display;
Drawable drawable;
diff --git a/client/videowidget.cc b/client/videowidget.cc
index a007df8..edabf71 100644
--- a/client/videowidget.cc
+++ b/client/videowidget.cc
@@ -38,9 +38,9 @@ VideoWidget::VideoWidget() : QWidget()
// setenv("SDL_WINDOWID", ids.setNum(winId()).toStdString().c_str(), 1);
// Make it visible
- QPalette palette;
- palette.setColor(backgroundRole(), Qt::blue);
- setPalette(palette);
+ // QPalette palette;
+ // palette.setColor(backgroundRole(), Qt::blue);
+ // setPalette(palette);
// setLineWidth(10);
// setFrameStyle(QFrame::Raised);
@@ -107,7 +107,7 @@ int VideoWidget::getWidth()
{
int val;
mutex.lock();
- val = mysize.width();
+ val = mysize.width();//>720?720:mysize.width();
mutex.unlock();
return val;
}
@@ -116,7 +116,7 @@ int VideoWidget::getHeight()
{
int val;
mutex.lock();
- val = mysize.height();
+ val = mysize.height();//>576?576:mysize.height();
mutex.unlock();
return val;
}
diff --git a/client/xvaccelrenderer.cc b/client/xvaccelrenderer.cc
index b0e54db..188574e 100644
--- a/client/xvaccelrenderer.cc
+++ b/client/xvaccelrenderer.cc
@@ -1,324 +1,311 @@
-/***************************************************************************
- gui_xv.cpp - description
- -------------------
-
- This part is strongly derivated from xine/mplayer/mpeg2dec
-
- begin : Tue Jan 1 2002
- copyright : (C) 2002 by mean
- email : fixounet@free.fr
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "types.h"
-#include <QX11Info>
-
-#define USE_XV
-#define VERBOSE_XV
-
-#ifdef USE_XV
-#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>
-
-#include "xvaccelrenderer.h"
-
-static uint8_t GUI_XvList(Display *dis, uint32_t port, uint32_t * fmt);
-static uint8_t GUI_XvInit(QWidget *window, uint32_t w, uint32_t h);
-static void GUI_XvEnd();
-static uint8_t GUI_XvDisplay(uint8_t * src, uint32_t w, uint32_t h);
-//static uint8_t GUI_XvSync(void);
-
-
-//________________Wrapper around Xv_______________
-XvAccelRender::XvAccelRender( void )
-{
-}
-
-uint8_t XvAccelRender::init(QWidget *window, uint32_t w, uint32_t h)
-{
- printf("Xv start\n");
- return GUI_XvInit(window, w, h);
-}
-
-uint8_t XvAccelRender::end(void)
-{
- GUI_XvEnd( );
- printf("Xv end\n");
- return 1;
-}
-
-uint8_t XvAccelRender::display(uint8_t *ptr, uint32_t w, uint32_t h)
-{
- return GUI_XvDisplay(ptr, w, h);
-}
-//________________Wrapper around Xv_______________
-
-static unsigned int xv_port;
-static uint32_t xv_format;
-static Display *xv_display;
-static XvImage *xvimage = NULL;
-static GC xv_gc;
-static XGCValues xv_xgc;
-static Window xv_win;
-static XShmSegmentInfo Shminfo;
-
-//static uint8_t GUI_XvExpose( void );
-//
-// Free all ressources allocated by xv
-//
-
-
-void GUI_XvEnd( void )
-{
- ADM_assert(xv_port);
- ADM_assert(xv_display);
-
-
- printf("\n Releasing Xv Port\n");
- XLockDisplay (xv_display);
- if(XvUngrabPort(xv_display,xv_port,0)!=Success)
- printf("\n Trouble releasing port...\n");
- XUnlockDisplay (xv_display);
-
-
- xvimage=NULL;
- xv_display=NULL;
- xv_port=0;
-
-}
-
-//------------------------------------
-uint8_t GUI_XvDisplay(uint8_t * src, uint32_t w, uint32_t h)
-{
-
- if (xvimage)
- {
-
- // put image in shared segment
-
- // for YV12, 4 bits for Y 4 bits for u, 4 bits for v
- // total 1.5*
- memcpy(xvimage->data, src, (w*h*3)>>1);
- XLockDisplay (xv_display);
- // And display it !
-#if 1
- XvShmPutImage(xv_display, xv_port, xv_win, xv_gc, xvimage, 0, 0, w, h, // src
- 0, 0, w, h, // dst
- False);
-#else
- XvPutImage(xv_display, xv_port, xv_win, xv_gc, xvimage, 0, 0, w, h, // src
- 0, 0, w, h // dst
- );
-
-#endif
- //XSetForeground (xv_display, xv_gc, 0);
-
- XSync(xv_display, False);
- XUnlockDisplay (xv_display);
- //GUI_XvExpose();
-
- }
- return 1;
-
-}
-uint8_t GUI_XvSync(void)
-{
- if(xv_display)
- XSync(xv_display, False);
- return 1;
-}
-//------------------------------------
-//
-//------------------------------------
-uint8_t GUI_XvInit(QWidget * window, uint32_t w, uint32_t h)
-{
- unsigned int ver, rel, req, ev, err;
- unsigned int port, adaptors;
- static XvAdaptorInfo *ai;
- static XvAdaptorInfo *curai;
-
-
- // win = gtk_widget_get_parent_window(window);
- xv_display = window->x11Info().display();//GDK_WINDOW_XDISPLAY(win);
- // xv_win= RootWindow(xv_display,0);
- xv_win = window->winId();//GDK_WINDOW_XWINDOW(GTK_WIDGET(window)->window);
-#define WDN xv_display
- xv_port = 0;
-
- if (Success != XvQueryExtension(WDN, &ver, &rel, &req, &ev, &err))
- {
- printf("\n Query Extension failed\n");
- goto failed;
- }
- /* check for Xvideo support */
- if (Success != XvQueryAdaptors(WDN,
- DefaultRootWindow(WDN), &adaptors, &ai))
- {
- printf("\n Query Adaptor failed\n");
- goto failed;
- }
- curai = ai;
- XvFormat *formats;
- // Dump infos
- port = 0;
- for (uint16_t i = 0; (!port) && (i < adaptors); i++)
- {
- /*
- XvPortID base_id;
- unsigned long num_ports;
- char type;
- char *name;
- unsigned long num_formats;
- XvFormat *formats;
- unsigned long num_adaptors;
- */
-#ifdef VERBOSE_XV
- printf("\n_______________________________\n");
- printf("\n Adaptator : %d", i);
- printf("\n Base ID : %ld", curai->base_id);
- printf("\n Nb Port : %lu", curai->num_ports);
- printf("\n Type : %d,",
- curai->type);
-#define CHECK(x) if(curai->type & x) printf("|"#x);
- CHECK(XvInputMask);
- CHECK(XvOutputMask);
- CHECK(XvVideoMask);
- CHECK(XvStillMask);
- CHECK(XvImageMask);
-
- printf("\n Name : %s",
- curai->name);
- printf("\n Num Adap : %lu", curai->num_adaptors);
- printf("\n Num fmt : %lu", curai->num_formats);
-#endif
- formats = curai->formats;
-
- //
- uint16_t k;
-
- for (k = 0; (k < curai->num_ports) && !port; k++)
- {
- if (GUI_XvList(WDN, k + curai->base_id, &xv_format))
- port = k + curai->base_id;
- }
-
-
- curai++;
- }
- //
- if (!port)
- {
- printf("\n no port found");
- goto failed;
- }
-#ifdef COLORSPACE_YV12
- printf("\n Xv YV12 found at port :%d, format : %ld", port, xv_format);
-#else
- printf("\n Xv YUY2 found at port :%d, format : %ld", port, xv_format);
-#endif
-
- if (Success != XvGrabPort(WDN, port, 0))
- goto failed;
- {
-
- xv_port = port;
- /*
- Display *display,
- XvPortID port,
- int id,
- char* data,
- int width,
- int height,
- XShmSegmentInfo *shminfo
-
- */
- xvimage = XvShmCreateImage(WDN, xv_port,
- xv_format, 0, w, h, &Shminfo);
-
- Shminfo.shmid = shmget(IPC_PRIVATE, xvimage->data_size,
- IPC_CREAT | 0777);
- Shminfo.shmaddr = (char *) shmat(Shminfo.shmid, 0, 0);
- Shminfo.readOnly = False;
- xvimage->data = Shminfo.shmaddr;
- XShmAttach(WDN, &Shminfo);
- XSync(WDN, False);
- shmctl(Shminfo.shmid, IPC_RMID, 0);
- memset(xvimage->data, 0, xvimage->data_size);
-
- xv_xgc.graphics_exposures = False;
-
- xv_gc = XCreateGC(xv_display, xv_win, 0L, &xv_xgc);
-
- //ADM_assert(BadWindow!=XSelectInput(xv_display, xv_win, ExposureMask | VisibilityChangeMask));
-
- }
- printf("\n Xv init succeedeed\n");
-
- return 1;
- failed:
- printf("\n Xv init failed..\n");
- return 0;
-}
-
-// _________________________________________________
-//
-// _________________________________________________
-uint8_t GUI_XvList(Display * dis, uint32_t port, uint32_t * fmt)
-{
- XvImageFormatValues *formatValues;
- int imgfmt;
- int k, f = 0;
-
- formatValues = XvListImageFormats(dis, port, &imgfmt);
- if (formatValues)
- for (k = 0; !f || (k < imgfmt); k++)
- {
-#ifdef VERVOSE_XV
- printf("\n %lx %d --> %s", port, formatValues[k].id,
- formatValues[k].guid);
-#endif
-#ifdef COLORSPACE_YV12
- if (!strcmp(formatValues[k].guid, "YV12"))
-#else
- if (!strcmp(formatValues[k].guid, "YUY2"))
-#endif
- {
- f = 1;
- *fmt = formatValues[k].id;
- }
- } else
- f = 0;
- XFree(formatValues);
- return f;
-}
-void GUI_XvBuildAtom(Display * dis, Atom * atom, char *string)
-{
- dis = dis;
- atom = atom;
- string = string;
-}
-
-
-uint8_t GUI_XvRedraw( void )
-{
- printf("Xv need redraw !\n");
- return 0;
-}
-#endif
+/***************************************************************************
+ gui_xv.cpp - description
+ -------------------
+
+ This part is strongly derivated from xine/mplayer/mpeg2dec
+
+ begin : Tue Jan 1 2002
+ copyright : (C) 2002 by mean
+ email : fixounet@free.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "xvaccelrenderer.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <QX11Info>
+
+// Use this define for verbose output
+#define VERBOSE_XV
+
+// Use this define for YV12 colorspace, default is YUY2
+//#define COLORSPACE_YV12
+
+
+
+//static uint8_t GUI_XvSync(void);
+
+
+//________________Wrapper around Xv_______________
+XvAccelRender::XvAccelRender( void )
+{
+ xvimage = NULL;
+}
+
+uint8_t XvAccelRender::init(QWidget *window, uint32_t w, uint32_t h)
+{
+#ifdef VERBOSE_XV
+ printf("Xv start\n");
+#endif
+ width = w;
+ height = h;
+ return GUI_XvInit(window, w, h);
+}
+
+uint8_t XvAccelRender::end(void)
+{
+ GUI_XvEnd( );
+#ifdef VERBOSE_XV
+ printf("Xv end\n");
+#endif
+ return 1;
+}
+
+uint8_t XvAccelRender::display(uint8_t *ptr, uint32_t w, uint32_t h)
+{
+ return GUI_XvDisplay(ptr, w, h);
+}
+//________________Wrapper around Xv_______________
+
+
+//static uint8_t GUI_XvExpose( void );
+//
+// Free all ressources allocated by xv
+//
+
+
+void XvAccelRender::GUI_XvEnd( void )
+{
+ ADM_assert(xv_port);
+ ADM_assert(xv_display);
+
+
+#ifdef VERBOSE_XV
+ printf("\n Releasing Xv Port\n");
+#endif
+ XLockDisplay (xv_display);
+ if(XvUngrabPort(xv_display,xv_port,0)!=Success)
+ printf("\n Trouble releasing port...\n");
+ XUnlockDisplay (xv_display);
+
+
+ xvimage=NULL;
+ xv_display=NULL;
+ xv_port=0;
+
+}
+
+//------------------------------------
+uint8_t XvAccelRender::GUI_XvDisplay(uint8_t * src, uint32_t w, uint32_t h)
+{
+
+ if (xvimage)
+ {
+
+ // put image in shared segment
+
+ // for YV12, 4 bits for Y 4 bits for u, 4 bits for v
+ // total 1.5*
+ memcpy(xvimage->data, src, (w*h*3)>>1);
+ XLockDisplay (xv_display);
+ // And display it !
+#if 1
+ XvShmPutImage(xv_display, xv_port, xv_win, xv_gc, xvimage,
+ 0, 0, w, h, // src
+ // 0, 0, w / 4, h / 4, // dst
+ 0, 0, width, height, // dst
+ False);
+#else
+ XvPutImage(xv_display, xv_port, xv_win, xv_gc, xvimage,
+ 0, 0, w, h, // src
+ 0, 0, w / 3, h / 3 // dst
+ );
+
+#endif
+ //XSetForeground (xv_display, xv_gc, 0);
+
+ XSync(xv_display, False);
+ XUnlockDisplay (xv_display);
+ //GUI_XvExpose();
+
+ }
+ return 1;
+
+}
+/*
+uint8_t XvAccelRender::GUI_XvSync(void)
+{
+ if(xv_display)
+ XSync(xv_display, False);
+ return 1;
+}
+*/
+//------------------------------------
+//
+//------------------------------------
+uint8_t XvAccelRender::GUI_XvInit(QWidget * window, uint32_t w, uint32_t h)
+{
+ unsigned int ver, rel, req, ev, err;
+ unsigned int port, adaptors;
+ static XvAdaptorInfo *ai;
+ static XvAdaptorInfo *curai;
+
+
+ // win = gtk_widget_get_parent_window(window);
+ xv_display = window->x11Info().display();//GDK_WINDOW_XDISPLAY(win);
+ // xv_win= RootWindow(xv_display,0);
+ xv_win = window->winId();//GDK_WINDOW_XWINDOW(GTK_WIDGET(window)->window);
+#define WDN xv_display
+ xv_port = 0;
+
+ if (Success != XvQueryExtension(WDN, &ver, &rel, &req, &ev, &err))
+ {
+ printf("\n Query Extension failed\n");
+ goto failed;
+ }
+ /* check for Xvideo support */
+ if (Success != XvQueryAdaptors(WDN,
+ DefaultRootWindow(WDN), &adaptors, &ai))
+ {
+ printf("\n Query Adaptor failed\n");
+ goto failed;
+ }
+ curai = ai;
+ XvFormat *formats;
+ // Dump infos
+ port = 0;
+ for (uint16_t i = 0; (!port) && (i < adaptors); i++)
+ {
+ /*
+ XvPortID base_id;
+ unsigned long num_ports;
+ char type;
+ char *name;
+ unsigned long num_formats;
+ XvFormat *formats;
+ unsigned long num_adaptors;
+ */
+#ifdef VERBOSE_XV
+ printf("\n_______________________________\n");
+ printf("\n Adaptator : %d", i);
+ printf("\n Base ID : %ld", curai->base_id);
+ printf("\n Nb Port : %lu", curai->num_ports);
+ printf("\n Type : %d,",
+ curai->type);
+#define CHECK(x) if(curai->type & x) printf("|"#x);
+ CHECK(XvInputMask);
+ CHECK(XvOutputMask);
+ CHECK(XvVideoMask);
+ CHECK(XvStillMask);
+ CHECK(XvImageMask);
+
+ printf("\n Name : %s",
+ curai->name);
+ printf("\n Num Adap : %lu", curai->num_adaptors);
+ printf("\n Num fmt : %lu", curai->num_formats);
+#endif
+ formats = curai->formats;
+
+ //
+ uint16_t k;
+
+ for (k = 0; (k < curai->num_ports) && !port; k++)
+ {
+ if (GUI_XvList(WDN, k + curai->base_id, &xv_format))
+ port = k + curai->base_id;
+ }
+
+
+ curai++;
+ }
+ //
+ if (!port)
+ {
+ printf("\n no port found");
+ goto failed;
+ }
+#ifdef COLORSPACE_YV12
+#ifdef VERBOSE_XV
+ printf("\n Xv YV12 found at port :%d, format : %ld", port, xv_format);
+#endif
+#else
+#ifdef VERBOSE_XV
+ printf("\n Xv YUY2 found at port :%d, format : %ld", port, xv_format);
+#endif
+#endif
+
+ if (Success != XvGrabPort(WDN, port, 0))
+ goto failed;
+ {
+
+ xv_port = port;
+ /*
+ Display *display,
+ XvPortID port,
+ int id,
+ char* data,
+ int width,
+ int height,
+ XShmSegmentInfo *shminfo
+
+ */
+ xvimage = XvShmCreateImage(WDN, xv_port,
+ xv_format, 0, w, h, &Shminfo);
+
+ Shminfo.shmid = shmget(IPC_PRIVATE, xvimage->data_size,
+ IPC_CREAT | 0777);
+ Shminfo.shmaddr = (char *) shmat(Shminfo.shmid, 0, 0);
+ Shminfo.readOnly = False;
+ xvimage->data = Shminfo.shmaddr;
+ XShmAttach(WDN, &Shminfo);
+ XSync(WDN, False);
+ shmctl(Shminfo.shmid, IPC_RMID, 0);
+ memset(xvimage->data, 0, xvimage->data_size);
+
+ xv_xgc.graphics_exposures = False;
+
+ xv_gc = XCreateGC(xv_display, xv_win, 0L, &xv_xgc);
+
+ //ADM_assert(BadWindow!=XSelectInput(xv_display, xv_win, ExposureMask | VisibilityChangeMask));
+
+ }
+#ifdef VERBOSE_XV
+ printf("\n Xv init succeedeed\n");
+#endif
+ return 1;
+ failed:
+ printf("\n Xv init failed..\n");
+ return 0;
+}
+
+// _________________________________________________
+//
+// _________________________________________________
+uint8_t XvAccelRender::GUI_XvList(Display * dis, uint32_t port, uint32_t * fmt)
+{
+ XvImageFormatValues *formatValues;
+ int imgfmt;
+ int k, f = 0;
+
+ formatValues = XvListImageFormats(dis, port, &imgfmt);
+ if (formatValues)
+ for (k = 0; !f || (k < imgfmt); k++)
+ {
+#ifdef VERVOSE_XV
+ printf("\n %lx %d --> %s", port, formatValues[k].id,
+ formatValues[k].guid);
+#endif
+#ifdef COLORSPACE_YV12
+ if (!strcmp(formatValues[k].guid, "YV12"))
+#else
+ if (!strcmp(formatValues[k].guid, "YUY2"))
+#endif
+ {
+ f = 1;
+ *fmt = formatValues[k].id;
+ }
+ } else
+ f = 0;
+ XFree(formatValues);
+ return f;
+}
diff --git a/client/xvaccelrenderer.h b/client/xvaccelrenderer.h
index b6a37f3..588516f 100644
--- a/client/xvaccelrenderer.h
+++ b/client/xvaccelrenderer.h
@@ -1,14 +1,51 @@
-/* -*- mode: c++ -*- */
-#include "types.h"
-
-class XvAccelRender//: public AccelRender
-{
-public:
- XvAccelRender();
- uint8_t init(QWidget *window, uint32_t w, uint32_t h);
- uint8_t end(void);
- uint8_t display(uint8_t *ptr, uint32_t w, uint32_t h);
-};
-
-
-
+/* -*- mode: c++ -*- */
+#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>
+
+//typedef unsigned long int QWidget;
+typedef unsigned char uint8_t;
+typedef unsigned short int uint16_t;
+typedef unsigned long int uint32_t;
+
+#define ADM_assert(x) assert(x)
+
+class XvAccelRender
+{
+public:
+ XvAccelRender();
+ uint8_t init(QWidget *window, uint32_t w, uint32_t h);
+ uint8_t end(void);
+ uint8_t display(uint8_t *ptr, uint32_t w, uint32_t h);
+
+ unsigned int width, height;
+
+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(uint8_t * src, uint32_t w, uint32_t h);
+};
+
+#endif/*__XVACCELRENDERER_H__*/