I m glad to introduce you xvimagesink which the brother of ximagesink using XV extensions with both XShm or not... It...

Original commit message from CVS:
I m glad to introduce you xvimagesink which the brother of ximagesink using XV extensions with both XShm or not... It grabs the XV port so no possible overlapping of overlays. If multiple ports are available i take the first non grabbed one...

Wheeee !!!
This commit is contained in:
Julien Moutte 2003-11-10 18:22:20 +00:00
parent 9bd75f89b7
commit 81a60893f7
3 changed files with 1296 additions and 0 deletions

12
sys/xvimage/Makefile.am Normal file
View file

@ -0,0 +1,12 @@
plugin_LTLIBRARIES = libgstxvimagesink.la
libgstxvimagesink_la_SOURCES = xvimagesink.c
libgstxvimagesink_la_CFLAGS = $(GST_CFLAGS) $(X_CFLAGS)
libgstxvimagesink_la_LIBADD = $(X_LIBS) $(XVIDEO_LIBS)
libgstxvimagesink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) \
$(top_builddir)/gst-libs/gst/navigation/libgstnavigation.la \
$(top_builddir)/gst-libs/gst/xoverlay/libgstxoverlay.la
noinst_HEADERS = xvimagesink.h

1141
sys/xvimage/xvimagesink.c Normal file

File diff suppressed because it is too large Load diff

143
sys/xvimage/xvimagesink.h Normal file
View file

@ -0,0 +1,143 @@
/* GStreamer
* Copyright (C) <2003> Julien Moutte <julien@moutte.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_XVIMAGESINK_H__
#define __GST_XVIMAGESINK_H__
#include <gst/gst.h>
/* FIXME : We should have a configure test for shm support */
#define HAVE_XSHM
#ifdef HAVE_XSHM
#include <sys/ipc.h>
#include <sys/shm.h>
#endif /* HAVE_XSHM */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef HAVE_XSHM
#include <X11/extensions/XShm.h>
#endif /* HAVE_XSHM */
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvlib.h>
#include <string.h>
#include <math.h>
G_BEGIN_DECLS
#define GST_TYPE_XVIMAGESINK \
(gst_xvimagesink_get_type())
#define GST_XVIMAGESINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_XVIMAGESINK, GstXvImageSink))
#define GST_XVIMAGESINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_XVIMAGESINK, GstXvImageSink))
#define GST_IS_XVIMAGESINK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XVIMAGESINK))
#define GST_IS_XVIMAGESINK_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XVIMAGESINK))
typedef struct _GstXContext GstXContext;
typedef struct _GstXWindow GstXWindow;
typedef struct _GstXvImage GstXvImage;
typedef struct _GstXvImageSink GstXvImageSink;
typedef struct _GstXvImageSinkClass GstXvImageSinkClass;
/* Global X Context stuff */
struct _GstXContext {
Display *disp;
Screen *screen;
gint screen_num;
Visual *visual;
Window root;
gulong white, black;
gint depth;
gint bpp;
gint endianness;
gboolean use_xshm;
XvPortID xv_port_id;
gint im_format;
GstCaps *caps;
};
/* XWindow stuff */
struct _GstXWindow {
Window win;
gint width, height;
GC gc;
};
/* XImage stuff */
struct _GstXvImage {
XvImage *xvimage;
#ifdef HAVE_XSHM
XShmSegmentInfo SHMInfo;
#endif /* HAVE_XSHM */
char *data;
gint width, height, size;
};
struct _GstXvImageSink {
/* Our element stuff */
GstElement element;
GstPad *sinkpad;
GstClock *clock;
GstXContext *xcontext;
GstXWindow *xwindow;
GstXvImage *xvimage;
gint width, height;
GMutex *x_lock;
/* Unused */
gint pixel_width, pixel_height;
GstBufferPool *bufferpool;
GMutex *pool_lock;
GSList *image_pool;
};
struct _GstXvImageSinkClass {
GstElementClass parent_class;
};
GType gst_xvimagesink_get_type(void);
G_END_DECLS
#endif /* __GST_XVIMAGESINK_H__ */