summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2006-03-30 08:03:29 +0000
committerdeva <deva>2006-03-30 08:03:29 +0000
commit451678d3aadf81b6f39f2f0e7957f4bf704bf9af (patch)
treef0291c0efc2097a43e20de693ea0e763e99e1da8
parenta8deb1c77223f10da41f4dc2188f1ac4597f93fe (diff)
*** empty log message ***
-rw-r--r--client/player.cc48
1 files changed, 47 insertions, 1 deletions
diff --git a/client/player.cc b/client/player.cc
index 9a02152..c891941 100644
--- a/client/player.cc
+++ b/client/player.cc
@@ -29,6 +29,18 @@
#include "info.h"
#include <QX11Info>
+#define DV_FOURCC_YV12 0x32315659 /* 4:2:0 Planar mode: Y + V + U (3 planes) */
+#define DV_FOURCC_YUY2 0x32595559 /* 4:2:2 Packed mode: Y0+U0+Y1+V0 (1 plane) */
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvlib.h>
+#include <X11/extensions/XShm.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
Player::Player(VideoWidget *v)
{
video = v;
@@ -109,6 +121,8 @@ Player::Player(VideoWidget *v)
if(port == 0) {
MIaV::info->error("Unable to find suitable port.");
return;
+ } else {
+ MIaV::info->info("Using port %d.", port);
}
}
@@ -117,9 +131,41 @@ Player::~Player()
//XCloseDisplay(dpy); // Close the Display
}
+extern XvImage *XvShmCreateImage(Display*, XvPortID, int, char*, int, int, XShmSegmentInfo*);
void Player::run()
{
- XvPutStill(display, port, drawable, gc, 0, 0, 320, 200, 0, 0, 320, 200);
+ XShmSegmentInfo yuv_shminfo;
+ yuv_shminfo.shmid = shmget(IPC_PRIVATE,
+ 720*576*4, //yuv_image->data_size,
+ IPC_CREAT | 0777);
+ // yuv_shminfo.shmaddr = shmat(yuv_shminfo.shmid, 0, 0);
+ yuv_shminfo.readOnly = False;
+
+ char pixels[720*576*4][4];
+ XvImage* xv_image = XvShmCreateImage(display, port,
+ DV_FOURCC_YUY2, // DV_FOURCC_YV12
+ pixels[0],
+ 720, 576,// dv_dpy->width, dv_dpy->height,
+ &yuv_shminfo);
+ int swidth = 720;
+ int sheight = 576;
+ int lxoff = 0;
+ int lyoff = 0;
+ int lwidth = swidth;
+ int lheight = sheight;
+
+ XvShmPutImage(display, port,
+ drawable, gc,
+ xv_image,
+ 0, 0,
+ swidth, sheight,
+ lxoff, lyoff,
+ lwidth, lheight,
+ True);
+
+ XFlush(display);
+
+ // XvPutStill(display, port, drawable, gc, 0, 0, 320, 200, 0, 0, 320, 200);
}