/***************************************************************************
                          kvdr_xv.h  -  description
                             -------------------
    begin                : Sat Aug  5 13:32:09 MEST 2000
    copyright            : (C) 2000 by Guido
    email                : gfiala@s.netic.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/
 /* started from the source codes of kino from Arne Schirmbacher */

#ifndef _KVDR_XV_H
#define _KVDR_XV_H
#include <string.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/Xvlib.h>
#define uint unsigned int

class XvDisplayer
{
  private:
		bool gotPort;
		int grabbedPort;
		int img_width,img_height;
  	QWidget *q;
  	Window window;
  	GC gc;
  	XGCValues values;
  	XvImage *xvImage;
  	unsigned int port;
  	XShmSegmentInfo shmInfo;
		Display *disp;
		int lb,rb,tb,bb;
	public: 
		XvDisplayer( QWidget *q, uint _lb, uint _rb, uint _tb, uint _bb, unsigned long freq );
		~XvDisplayer();
		bool usable();
		QSize size();
		void RecreateXImage(int width, int height);
		void put_shm(char *data);
		void put_di_shm(char *data);
    void put_di_field1(char *data);
	private:
		void put_video();
		void xv_setfreq(unsigned long freq);
		void xv_setfilterquality(unsigned long quality);
};

#endif
