2003-11-10 18:22:20 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
#ifndef __GST_XVIMAGESINK_H__
|
|
|
|
#define __GST_XVIMAGESINK_H__
|
|
|
|
|
2004-03-02 02:10:28 +00:00
|
|
|
#include <gst/video/videosink.h>
|
2003-11-10 18:22:20 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_XSHM
|
2004-04-16 23:42:12 +00:00
|
|
|
#include <sys/types.h>
|
2003-11-10 18:22:20 +00:00
|
|
|
#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
|
2004-03-15 16:32:55 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
#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))
|
2004-03-15 16:32:55 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
typedef struct _GstXContext GstXContext;
|
|
|
|
typedef struct _GstXWindow GstXWindow;
|
|
|
|
typedef struct _GstXvImage GstXvImage;
|
2003-11-28 21:47:51 +00:00
|
|
|
typedef struct _GstXvImageFormat GstXvImageFormat;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
typedef struct _GstXvImageSink GstXvImageSink;
|
|
|
|
typedef struct _GstXvImageSinkClass GstXvImageSinkClass;
|
|
|
|
|
|
|
|
/* Global X Context stuff */
|
2004-03-15 16:32:55 +00:00
|
|
|
struct _GstXContext {
|
2003-11-10 18:22:20 +00:00
|
|
|
Display *disp;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
Screen *screen;
|
|
|
|
gint screen_num;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
Visual *visual;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
Window root;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
gulong white, black;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
gint depth;
|
|
|
|
gint bpp;
|
|
|
|
gint endianness;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2004-07-27 16:43:24 +00:00
|
|
|
gint width, height;
|
|
|
|
gint widthmm, heightmm;
|
2004-08-02 10:04:08 +00:00
|
|
|
GValue *par; /* calculated pixel aspect ratio */
|
2004-07-27 16:43:24 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
gboolean use_xshm;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
XvPortID xv_port_id;
|
|
|
|
gint im_format;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-28 21:47:51 +00:00
|
|
|
GList *formats_list;
|
gst-libs/gst/colorbalance/colorbalancechannel.c: Adding safety check in dispose method.
Original commit message from CVS:
2004-01-12 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/colorbalance/colorbalancechannel.c:
(gst_color_balance_channel_dispose): Adding safety check in dispose
method.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_interface_supported),
(gst_xvimagesink_colorbalance_list_channels),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value),
(gst_xvimagesink_colorbalance_init), (gst_xvimagesink_get_type):
Adding colorbalance interface support to set XV parameters such as
HUE, BRIGHTNESS, CONTRAST, SATURATION.
* sys/xvimage/xvimagesink.h: Adding the channels list for colorbalance
interface.
2004-01-12 19:50:29 +00:00
|
|
|
GList *channels_list;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* XWindow stuff */
|
2004-03-15 16:32:55 +00:00
|
|
|
struct _GstXWindow {
|
2003-11-10 18:22:20 +00:00
|
|
|
Window win;
|
|
|
|
gint width, height;
|
2003-11-17 16:32:29 +00:00
|
|
|
gboolean internal;
|
2003-11-10 18:22:20 +00:00
|
|
|
GC gc;
|
|
|
|
};
|
|
|
|
|
2003-11-28 21:47:51 +00:00
|
|
|
/* XvImage format stuff */
|
2004-03-15 16:32:55 +00:00
|
|
|
struct _GstXvImageFormat {
|
2003-11-28 21:47:51 +00:00
|
|
|
gint format;
|
|
|
|
GstCaps *caps;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* XvImage stuff */
|
2004-03-15 16:32:55 +00:00
|
|
|
struct _GstXvImage {
|
2004-01-11 22:52:29 +00:00
|
|
|
/* Reference to the xvimagesink we belong to */
|
|
|
|
GstXvImageSink *xvimagesink;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
XvImage *xvimage;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
#ifdef HAVE_XSHM
|
|
|
|
XShmSegmentInfo SHMInfo;
|
2004-03-15 16:32:55 +00:00
|
|
|
#endif /* HAVE_XSHM */
|
2004-07-19 11:21:10 +00:00
|
|
|
|
sys/ximage/ximagesink.c: Optimize images creation for both elements. We don't create the image on caps nego or renego...
Original commit message from CVS:
2004-07-21 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_sink_link),
(gst_ximagesink_chain), (gst_ximagesink_set_xwindow_id): Optimize
images creation for both elements. We don't create the image on caps
nego or renego, we just destroy the internal one if present if it does
not match the needs. The chain function takes care of creating a new
image when needed.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xwindow_decorate), (gst_xvimagesink_sink_link),
(gst_xvimagesink_chain), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id): Additionally xvimage now contains
the image format information. The buffer pool checks for the context
image format and discard images with different formats.
* sys/xvimage/xvimagesink.h: Adding im_format in the xvimage structure.
2004-07-21 11:02:32 +00:00
|
|
|
gint width, height, size, im_format;
|
2003-11-10 18:22:20 +00:00
|
|
|
};
|
|
|
|
|
2004-03-15 16:32:55 +00:00
|
|
|
struct _GstXvImageSink {
|
2003-11-10 18:22:20 +00:00
|
|
|
/* Our element stuff */
|
2003-11-19 20:43:49 +00:00
|
|
|
GstVideoSink videosink;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
char *display_name;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
GstXContext *xcontext;
|
|
|
|
GstXWindow *xwindow;
|
|
|
|
GstXvImage *xvimage;
|
2004-02-03 23:05:46 +00:00
|
|
|
GstXvImage *cur_image;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
gdouble framerate;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
sys/xvimage/xvimagesink.c: Implementing correct colorbalance properties. They can now be set when the element is stil...
Original commit message from CVS:
2004-01-16 Julien MOUTTE <julien@moutte.net>
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_update_colorbalance),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_init), (gst_xvimagesink_class_init): Implementing
correct colorbalance properties. They can now be set when the element
is still in NULL state. The values will be committed to the Xv Port
when xcontext is initialized.
* sys/xvimage/xvimagesink.h: Added hue, saturation, contrast,
brightness int values in the GstXvImagesink structure.
2004-01-16 15:43:35 +00:00
|
|
|
gint brightness;
|
|
|
|
gint contrast;
|
|
|
|
gint hue;
|
|
|
|
gint saturation;
|
gst-libs/gst/play/gstplay.c: Reworked the pipeline from scratch. Visualization is back and switch went out as i reali...
Original commit message from CVS:
2004-01-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/play/gstplay.c: (gst_play_pipeline_setup),
(gst_play_set_location), (gst_play_seek_to_time),
(gst_play_set_audio_sink), (gst_play_set_visualization),
(gst_play_connect_visualization), (gst_play_get_sink_element): Reworked
the pipeline from scratch. Visualization is back and switch went out as
i realized it was not possible to use the way i wanted.
* sys/ximage/ximagesink.c: (gst_ximagesink_imagepool_clear),
(gst_ximagesink_change_state), (gst_ximagesink_dispose): Move xcontext
clearing in state change from READY to NULL. So that one can clean the
X ressources keeping the element.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_imagepool_clear), (gst_xvimagesink_change_state),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value),
(gst_xvimagesink_set_property), (gst_xvimagesink_dispose),
(gst_xvimagesink_init): Same xcontext cleaning than ximagesink in state
change from READY to NULL and fixed some stupid bugs in colorbalance
get/set values. Also added the following feature : when nobody tries to
set some values to the colorbalance levels before the xcontext is
grabbed, then when creating channels list from Xv attributes we set the
internal values to the Xv defaults. This way we handle buggy Xv drivers
that set default hue values far from the middle of the range (Thanks
to Jon Trowbridge for pointing that issue).
* sys/xvimage/xvimagesink.h: Adding a cb_changed boolean to know if
colorbalance levels have been set before xcontext is grabbed.
2004-01-22 23:54:34 +00:00
|
|
|
gboolean cb_changed;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
GMutex *x_lock;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2004-07-27 16:43:24 +00:00
|
|
|
guint video_width, video_height; /* size of incoming video;
|
|
|
|
* used as the size for XvImage */
|
2004-08-02 10:04:08 +00:00
|
|
|
GValue *par; /* object-set pixel aspect ratio */
|
2003-12-14 05:10:28 +00:00
|
|
|
|
|
|
|
GstClockTime time;
|
2004-07-19 11:21:10 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
GMutex *pool_lock;
|
|
|
|
GSList *image_pool;
|
2004-01-16 23:52:53 +00:00
|
|
|
|
|
|
|
gboolean synchronous;
|
2003-11-10 18:22:20 +00:00
|
|
|
};
|
|
|
|
|
2004-03-15 16:32:55 +00:00
|
|
|
struct _GstXvImageSinkClass {
|
2003-11-19 20:43:49 +00:00
|
|
|
GstVideoSinkClass parent_class;
|
2003-11-10 18:22:20 +00:00
|
|
|
};
|
|
|
|
|
2004-03-15 16:32:55 +00:00
|
|
|
GType gst_xvimagesink_get_type(void);
|
2003-11-10 18:22:20 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
2004-03-15 16:32:55 +00:00
|
|
|
|
2003-11-10 18:22:20 +00:00
|
|
|
#endif /* __GST_XVIMAGESINK_H__ */
|