2003-11-06 21:51:14 +00:00
|
|
|
/* GStreamer
|
2005-11-27 18:12:23 +00:00
|
|
|
* Copyright (C) <2005> Julien Moutte <julien@moutte.net>
|
2003-11-06 21:51:14 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2003-11-06 21:51:14 +00:00
|
|
|
*/
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-11-26 14:44:08 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-ximagesink
|
2017-01-23 19:36:11 +00:00
|
|
|
* @title: ximagesink
|
2005-11-26 14:44:08 +00:00
|
|
|
*
|
|
|
|
* XImageSink renders video frames to a drawable (XWindow) on a local or remote
|
|
|
|
* display. This element can receive a Window ID from the application through
|
2011-08-08 09:44:17 +00:00
|
|
|
* the #GstVideoOverlay interface and will then render video frames in this
|
|
|
|
* drawable. If no Window ID was provided by the application, the element will
|
|
|
|
* create its own internal window and render into it.
|
2008-07-11 06:10:24 +00:00
|
|
|
*
|
2017-01-23 19:36:11 +00:00
|
|
|
* ## Scaling
|
|
|
|
*
|
2005-11-26 14:44:08 +00:00
|
|
|
* As standard XImage rendering to a drawable is not scaled, XImageSink will use
|
|
|
|
* reverse caps negotiation to try to get scaled video frames for the drawable.
|
|
|
|
* This is accomplished by asking the peer pad if it accepts some different caps
|
|
|
|
* which in most cases implies that there is a scaling element in the pipeline,
|
2017-01-23 19:36:11 +00:00
|
|
|
* or that an element generating the video frames can generate them with a
|
2005-11-26 14:44:08 +00:00
|
|
|
* different geometry. This mechanism is handled during buffer allocations, for
|
|
|
|
* each allocation request the video sink will check the drawable geometry, look
|
2008-07-11 06:10:24 +00:00
|
|
|
* at the #GstXImageSink:force-aspect-ratio property, calculate the geometry of
|
|
|
|
* desired video frames and then check that the peer pad accept those new caps.
|
|
|
|
* If it does it will then allocate a buffer in video memory with this new
|
|
|
|
* geometry and return it with the new caps.
|
2017-01-23 19:36:11 +00:00
|
|
|
*
|
|
|
|
* ## Events
|
|
|
|
*
|
2005-11-26 14:44:08 +00:00
|
|
|
* XImageSink creates a thread to handle events coming from the drawable. There
|
2017-01-23 19:36:11 +00:00
|
|
|
* are several kind of events that can be grouped in 2 big categories: input
|
2005-11-26 14:44:08 +00:00
|
|
|
* events and window state related events. Input events will be translated to
|
|
|
|
* navigation events and pushed upstream for other elements to react on them.
|
|
|
|
* This includes events such as pointer moves, key press/release, clicks etc...
|
|
|
|
* Other events are used to handle the drawable appearance even when the data
|
|
|
|
* is not flowing (GST_STATE_PAUSED). That means that even when the element is
|
|
|
|
* paused, it will receive expose events from the drawable and draw the latest
|
|
|
|
* frame with correct borders/aspect-ratio.
|
2017-01-23 19:36:11 +00:00
|
|
|
*
|
|
|
|
* ## Pixel aspect ratio
|
|
|
|
*
|
2005-11-26 14:44:08 +00:00
|
|
|
* When changing state to GST_STATE_READY, XImageSink will open a connection to
|
2008-07-11 06:10:24 +00:00
|
|
|
* the display specified in the #GstXImageSink:display property or the default
|
2017-01-23 19:36:11 +00:00
|
|
|
* display if nothing specified. Once this connection is open it will inspect
|
|
|
|
* the display configuration including the physical display geometry and
|
2005-11-26 14:44:08 +00:00
|
|
|
* then calculate the pixel aspect ratio. When caps negotiation will occur, the
|
2017-01-23 19:36:11 +00:00
|
|
|
* video sink will set the calculated pixel aspect ratio on the caps to make
|
2005-11-26 14:44:08 +00:00
|
|
|
* sure that incoming video frames will have the correct pixel aspect ratio for
|
|
|
|
* this display. Sometimes the calculated pixel aspect ratio can be wrong, it is
|
|
|
|
* then possible to enforce a specific pixel aspect ratio using the
|
2008-07-11 06:10:24 +00:00
|
|
|
* #GstXImageSink:pixel-aspect-ratio property.
|
2017-01-23 19:36:11 +00:00
|
|
|
*
|
|
|
|
* ## Examples
|
2008-07-11 06:10:24 +00:00
|
|
|
* |[
|
2015-05-09 21:33:26 +00:00
|
|
|
* gst-launch-1.0 -v videotestsrc ! queue ! ximagesink
|
2017-01-23 19:36:11 +00:00
|
|
|
* ]|
|
|
|
|
* A pipeline to test reverse negotiation. When the test video signal appears
|
2008-07-11 06:10:24 +00:00
|
|
|
* you can resize the window and see that scaled buffers of the desired size are
|
|
|
|
* going to arrive with a short delay. This illustrates how buffers of desired
|
|
|
|
* size are allocated along the way. If you take away the queue, scaling will
|
|
|
|
* happen almost immediately.
|
|
|
|
* |[
|
2015-05-09 21:33:26 +00:00
|
|
|
* gst-launch-1.0 -v videotestsrc ! navigationtest ! videoconvert ! ximagesink
|
2017-01-23 19:36:11 +00:00
|
|
|
* ]|
|
|
|
|
* A pipeline to test navigation events.
|
2005-11-26 14:44:08 +00:00
|
|
|
* While moving the mouse pointer over the test signal you will see a black box
|
2017-01-23 19:36:11 +00:00
|
|
|
* following the mouse pointer. If you press the mouse button somewhere on the
|
2005-11-26 14:44:08 +00:00
|
|
|
* video and release it somewhere else a green box will appear where you pressed
|
|
|
|
* the button and a red one where you released it. (The navigationtest element
|
|
|
|
* is part of gst-plugins-good.)
|
2008-07-11 06:10:24 +00:00
|
|
|
* |[
|
2015-05-09 21:33:26 +00:00
|
|
|
* gst-launch-1.0 -v videotestsrc ! video/x-raw, pixel-aspect-ratio=(fraction)4/3 ! videoscale ! ximagesink
|
2017-01-23 19:36:11 +00:00
|
|
|
* ]|
|
|
|
|
* This is faking a 4/3 pixel aspect ratio caps on video frames produced by
|
2005-11-26 14:44:08 +00:00
|
|
|
* videotestsrc, in most cases the pixel aspect ratio of the display will be
|
2017-01-23 19:36:11 +00:00
|
|
|
* 1/1. This means that videoscale will have to do the scaling to convert
|
2005-11-26 14:44:08 +00:00
|
|
|
* incoming frames to a size that will match the display pixel aspect ratio
|
2017-01-23 19:36:11 +00:00
|
|
|
* (from 320x240 to 320x180 in this case). Note that you might have to escape
|
2005-11-26 14:44:08 +00:00
|
|
|
* some characters for your shell like '\(fraction\)'.
|
2017-01-23 19:36:11 +00:00
|
|
|
*
|
2005-11-26 14:44:08 +00:00
|
|
|
*/
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Our interfaces */
|
2012-04-13 09:01:03 +00:00
|
|
|
#include <gst/video/navigation.h>
|
2011-11-29 18:10:01 +00:00
|
|
|
#include <gst/video/videooverlay.h>
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2011-10-31 01:23:21 +00:00
|
|
|
#include <gst/video/gstvideometa.h>
|
2011-05-19 13:56:57 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
/* Object header */
|
|
|
|
#include "ximagesink.h"
|
|
|
|
|
2004-04-20 15:45:07 +00:00
|
|
|
/* Debugging category */
|
|
|
|
#include <gst/gstinfo.h>
|
2005-07-21 18:07:38 +00:00
|
|
|
|
2012-03-05 10:07:39 +00:00
|
|
|
/* for XkbKeycodeToKeysym */
|
|
|
|
#include <X11/XKBlib.h>
|
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (gst_debug_x_image_sink);
|
2016-02-20 11:31:43 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (CAT_PERFORMANCE);
|
2015-07-03 19:48:52 +00:00
|
|
|
#define GST_CAT_DEFAULT gst_debug_x_image_sink
|
2004-04-20 15:45:07 +00:00
|
|
|
|
2004-06-27 18:53:04 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
unsigned long functions;
|
|
|
|
unsigned long decorations;
|
|
|
|
long input_mode;
|
|
|
|
unsigned long status;
|
|
|
|
}
|
|
|
|
MotifWmHints, MwmHints;
|
|
|
|
|
|
|
|
#define MWM_HINTS_DECORATIONS (1L << 1)
|
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
static void gst_x_image_sink_reset (GstXImageSink * ximagesink);
|
|
|
|
static void gst_x_image_sink_xwindow_update_geometry (GstXImageSink *
|
|
|
|
ximagesink);
|
|
|
|
static void gst_x_image_sink_expose (GstVideoOverlay * overlay);
|
2004-01-15 22:03:45 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
static GstStaticPadTemplate gst_x_image_sink_sink_template_factory =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-06-16 10:48:33 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-raw, "
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
"framerate = (fraction) [ 0, MAX ], "
|
2004-05-05 11:29:49 +00:00
|
|
|
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
|
2004-03-14 22:34:34 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2005-04-25 07:06:09 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_DISPLAY,
|
|
|
|
PROP_SYNCHRONOUS,
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
PROP_PIXEL_ASPECT_RATIO,
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
PROP_FORCE_ASPECT_RATIO,
|
2007-07-14 18:20:41 +00:00
|
|
|
PROP_HANDLE_EVENTS,
|
2010-10-25 13:08:43 +00:00
|
|
|
PROP_HANDLE_EXPOSE,
|
|
|
|
PROP_WINDOW_WIDTH,
|
|
|
|
PROP_WINDOW_HEIGHT
|
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
|
|
|
};
|
|
|
|
|
2011-04-19 09:44:14 +00:00
|
|
|
/* ============================================================= */
|
|
|
|
/* */
|
|
|
|
/* Public Methods */
|
|
|
|
/* */
|
|
|
|
/* ============================================================= */
|
|
|
|
|
|
|
|
/* =========================================== */
|
|
|
|
/* */
|
|
|
|
/* Object typing & Creation */
|
|
|
|
/* */
|
|
|
|
/* =========================================== */
|
2015-07-03 19:48:52 +00:00
|
|
|
static void gst_x_image_sink_navigation_init (GstNavigationInterface * iface);
|
|
|
|
static void gst_x_image_sink_video_overlay_init (GstVideoOverlayInterface *
|
2011-10-21 12:37:31 +00:00
|
|
|
iface);
|
2015-07-03 19:48:52 +00:00
|
|
|
#define gst_x_image_sink_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstXImageSink, gst_x_image_sink, GST_TYPE_VIDEO_SINK,
|
|
|
|
G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION,
|
|
|
|
gst_x_image_sink_navigation_init);
|
2011-08-08 09:44:17 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_video_overlay_init));
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
/* ============================================================= */
|
|
|
|
/* */
|
|
|
|
/* Private Methods */
|
|
|
|
/* */
|
|
|
|
/* ============================================================= */
|
|
|
|
|
|
|
|
/* X11 stuff */
|
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
/* We are called with the x_lock taken */
|
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_draw_borders (GstXImageSink * ximagesink,
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
GstXWindow * xwindow, GstVideoRectangle rect)
|
|
|
|
{
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_if_fail (GST_IS_X_IMAGE_SINK (ximagesink));
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
g_return_if_fail (xwindow != NULL);
|
|
|
|
|
|
|
|
XSetForeground (ximagesink->xcontext->disp, xwindow->gc,
|
|
|
|
ximagesink->xcontext->black);
|
|
|
|
|
|
|
|
/* Left border */
|
|
|
|
if (rect.x > 0) {
|
|
|
|
XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
|
|
|
|
0, 0, rect.x, xwindow->height);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Right border */
|
|
|
|
if ((rect.x + rect.w) < xwindow->width) {
|
|
|
|
XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
|
|
|
|
rect.x + rect.w, 0, xwindow->width, xwindow->height);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Top border */
|
|
|
|
if (rect.y > 0) {
|
|
|
|
XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
|
|
|
|
0, 0, xwindow->width, rect.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Bottom border */
|
|
|
|
if ((rect.y + rect.h) < xwindow->height) {
|
|
|
|
XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
|
|
|
|
0, rect.y + rect.h, xwindow->width, xwindow->height);
|
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
Port from GstData to GstMiniObject.
Original commit message from CVS:
Port from GstData to GstMiniObject.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_collected):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_comment_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_set_header_on_caps), (theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_comment_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_set_header_on_caps):
* ext/vorbis/vorbisparse.c: (vorbis_parse_set_header_on_caps):
* gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_chain):
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_get_buffer):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (check_queue), (probe_triggered),
(mute_stream), (silence_stream):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/volume/gstvolume.c: (volume_transform):
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximage_buffer_init), (gst_ximage_buffer_class_init),
(gst_ximage_buffer_get_type), (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_imagepool_clear),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
2005-05-16 15:35:52 +00:00
|
|
|
/* This function puts a GstXImageBuffer on a GstXImageSink's window */
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
static gboolean
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_ximage_put (GstXImageSink * ximagesink, GstBuffer * ximage)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
2013-02-26 15:02:41 +00:00
|
|
|
GstXImageMemory *mem;
|
2011-10-31 01:23:21 +00:00
|
|
|
GstVideoCropMeta *crop;
|
2014-12-16 11:57:55 +00:00
|
|
|
GstVideoRectangle src = { 0, };
|
|
|
|
GstVideoRectangle dst = { 0, };
|
|
|
|
GstVideoRectangle result;
|
2006-10-20 13:56:55 +00:00
|
|
|
gboolean draw_border = FALSE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2006-01-15 10:06:40 +00:00
|
|
|
/* We take the flow_lock. If expose is in there we don't want to run
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
concurrently from the data flow thread */
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
if (G_UNLIKELY (ximagesink->xwindow == NULL)) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
return FALSE;
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
}
|
|
|
|
|
2006-10-20 13:56:55 +00:00
|
|
|
/* Draw borders when displaying the first frame. After this
|
2008-06-24 01:14:40 +00:00
|
|
|
draw borders only on expose event or caps change (ximagesink->draw_border = TRUE). */
|
|
|
|
if (!ximagesink->cur_image || ximagesink->draw_border) {
|
2006-10-20 13:56:55 +00:00
|
|
|
draw_border = TRUE;
|
|
|
|
}
|
|
|
|
|
2006-01-15 10:06:40 +00:00
|
|
|
/* Store a reference to the last image we put, lose the previous one */
|
2005-11-27 18:12:23 +00:00
|
|
|
if (ximage && ximagesink->cur_image != ximage) {
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
if (ximagesink->cur_image) {
|
2006-01-15 10:06:40 +00:00
|
|
|
GST_LOG_OBJECT (ximagesink, "unreffing %p", ximagesink->cur_image);
|
2011-04-06 10:26:47 +00:00
|
|
|
gst_buffer_unref (ximagesink->cur_image);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
}
|
2006-01-15 10:06:40 +00:00
|
|
|
GST_LOG_OBJECT (ximagesink, "reffing %p as our current image", ximage);
|
2011-02-24 10:57:53 +00:00
|
|
|
ximagesink->cur_image = gst_buffer_ref (ximage);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
}
|
|
|
|
|
2005-11-27 18:12:23 +00:00
|
|
|
/* Expose sends a NULL image, we take the latest frame */
|
|
|
|
if (!ximage) {
|
2006-10-20 13:56:55 +00:00
|
|
|
draw_border = TRUE;
|
2005-11-27 18:12:23 +00:00
|
|
|
if (ximagesink->cur_image) {
|
|
|
|
ximage = ximagesink->cur_image;
|
|
|
|
} else {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
return TRUE;
|
2005-11-27 18:12:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-26 15:02:41 +00:00
|
|
|
mem = (GstXImageMemory *) gst_buffer_peek_memory (ximage, 0);
|
2011-10-31 01:23:21 +00:00
|
|
|
crop = gst_buffer_get_video_crop_meta (ximage);
|
2011-06-23 10:55:13 +00:00
|
|
|
|
|
|
|
if (crop) {
|
2013-02-26 15:02:41 +00:00
|
|
|
src.x = crop->x + mem->x;
|
|
|
|
src.y = crop->y + mem->y;
|
2011-06-23 10:55:13 +00:00
|
|
|
src.w = crop->width;
|
|
|
|
src.h = crop->height;
|
2012-02-28 15:49:10 +00:00
|
|
|
GST_LOG_OBJECT (ximagesink,
|
|
|
|
"crop %dx%d-%dx%d", crop->x, crop->y, crop->width, crop->height);
|
2011-06-23 10:55:13 +00:00
|
|
|
} else {
|
2013-02-26 15:02:41 +00:00
|
|
|
src.x = mem->x;
|
|
|
|
src.y = mem->y;
|
|
|
|
src.w = mem->width;
|
|
|
|
src.h = mem->height;
|
2011-06-23 10:55:13 +00:00
|
|
|
}
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
dst.w = ximagesink->xwindow->width;
|
|
|
|
dst.h = ximagesink->xwindow->height;
|
2003-11-06 21:51:14 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
gst_video_sink_center_rect (src, dst, &result, FALSE);
|
2004-07-26 13:00:27 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
|
2006-10-20 13:56:55 +00:00
|
|
|
if (draw_border) {
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_draw_borders (ximagesink, ximagesink->xwindow,
|
2006-10-20 13:56:55 +00:00
|
|
|
result);
|
2008-06-24 01:14:40 +00:00
|
|
|
ximagesink->draw_border = FALSE;
|
2006-10-20 13:56:55 +00:00
|
|
|
}
|
2003-11-12 03:06:07 +00:00
|
|
|
#ifdef HAVE_XSHM
|
2004-03-14 22:34:34 +00:00
|
|
|
if (ximagesink->xcontext->use_xshm) {
|
2004-07-26 13:00:27 +00:00
|
|
|
GST_LOG_OBJECT (ximagesink,
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
"XShmPutImage on %p, src: %d, %d - dest: %d, %d, dim: %dx%d, win %dx%d",
|
|
|
|
ximage, 0, 0, result.x, result.y, result.w, result.h,
|
|
|
|
ximagesink->xwindow->width, ximagesink->xwindow->height);
|
2004-03-14 22:34:34 +00:00
|
|
|
XShmPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
|
2013-02-26 15:02:41 +00:00
|
|
|
ximagesink->xwindow->gc, mem->ximage, src.x, src.y, result.x, result.y,
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
result.w, result.h, FALSE);
|
2004-03-14 22:34:34 +00:00
|
|
|
} else
|
2003-11-26 10:12:05 +00:00
|
|
|
#endif /* HAVE_XSHM */
|
2004-03-14 22:34:34 +00:00
|
|
|
{
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
GST_LOG_OBJECT (ximagesink,
|
|
|
|
"XPutImage on %p, src: %d, %d - dest: %d, %d, dim: %dx%d, win %dx%d",
|
|
|
|
ximage, 0, 0, result.x, result.y, result.w, result.h,
|
|
|
|
ximagesink->xwindow->width, ximagesink->xwindow->height);
|
2004-03-14 22:34:34 +00:00
|
|
|
XPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
|
2013-02-26 15:02:41 +00:00
|
|
|
ximagesink->xwindow->gc, mem->ximage, src.x, src.y, result.x, result.y,
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
result.w, result.h);
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
|
|
|
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
2004-06-27 18:53:04 +00:00
|
|
|
static gboolean
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_decorate (GstXImageSink * ximagesink,
|
2004-06-27 18:53:04 +00:00
|
|
|
GstXWindow * window)
|
|
|
|
{
|
|
|
|
Atom hints_atom = None;
|
|
|
|
MotifWmHints *hints;
|
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_val_if_fail (GST_IS_X_IMAGE_SINK (ximagesink), FALSE);
|
2004-06-27 18:53:04 +00:00
|
|
|
g_return_val_if_fail (window != NULL, FALSE);
|
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-06-27 19:02:29 +00:00
|
|
|
|
2011-04-06 10:26:47 +00:00
|
|
|
hints_atom = XInternAtom (ximagesink->xcontext->disp, "_MOTIF_WM_HINTS",
|
|
|
|
True);
|
2004-07-20 19:15:41 +00:00
|
|
|
if (hints_atom == None) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2004-06-27 18:53:04 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-07-20 19:15:41 +00:00
|
|
|
hints = g_malloc0 (sizeof (MotifWmHints));
|
|
|
|
|
2004-06-27 18:53:04 +00:00
|
|
|
hints->flags |= MWM_HINTS_DECORATIONS;
|
|
|
|
hints->decorations = 1 << 0;
|
|
|
|
|
|
|
|
XChangeProperty (ximagesink->xcontext->disp, window->win,
|
|
|
|
hints_atom, hints_atom, 32, PropModeReplace,
|
|
|
|
(guchar *) hints, sizeof (MotifWmHints) / sizeof (long));
|
|
|
|
|
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2004-06-27 19:02:29 +00:00
|
|
|
|
2004-06-27 18:53:04 +00:00
|
|
|
g_free (hints);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-06-22 08:40:33 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_set_title (GstXImageSink * ximagesink,
|
2009-06-22 13:17:10 +00:00
|
|
|
GstXWindow * xwindow, const gchar * media_title)
|
2009-06-22 08:40:33 +00:00
|
|
|
{
|
|
|
|
if (media_title) {
|
|
|
|
g_free (ximagesink->media_title);
|
|
|
|
ximagesink->media_title = g_strdup (media_title);
|
|
|
|
}
|
2009-06-22 13:17:10 +00:00
|
|
|
if (xwindow) {
|
2009-06-22 08:40:33 +00:00
|
|
|
/* we have a window */
|
2009-06-22 13:17:10 +00:00
|
|
|
if (xwindow->internal) {
|
2009-06-22 08:40:33 +00:00
|
|
|
XTextProperty xproperty;
|
2015-06-05 15:01:05 +00:00
|
|
|
XClassHint *hint = XAllocClassHint ();
|
2009-06-22 08:40:33 +00:00
|
|
|
const gchar *app_name;
|
|
|
|
const gchar *title = NULL;
|
|
|
|
gchar *title_mem = NULL;
|
|
|
|
|
|
|
|
/* set application name as a title */
|
|
|
|
app_name = g_get_application_name ();
|
|
|
|
|
|
|
|
if (app_name && ximagesink->media_title) {
|
|
|
|
title = title_mem = g_strconcat (ximagesink->media_title, " : ",
|
|
|
|
app_name, NULL);
|
|
|
|
} else if (app_name) {
|
|
|
|
title = app_name;
|
|
|
|
} else if (ximagesink->media_title) {
|
|
|
|
title = ximagesink->media_title;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (title) {
|
|
|
|
if ((XStringListToTextProperty (((char **) &title), 1,
|
2009-09-06 12:21:43 +00:00
|
|
|
&xproperty)) != 0) {
|
2009-06-22 13:17:10 +00:00
|
|
|
XSetWMName (ximagesink->xcontext->disp, xwindow->win, &xproperty);
|
2009-09-06 12:21:43 +00:00
|
|
|
XFree (xproperty.value);
|
|
|
|
}
|
2009-06-22 08:40:33 +00:00
|
|
|
|
|
|
|
g_free (title_mem);
|
|
|
|
}
|
2015-06-05 15:01:05 +00:00
|
|
|
|
|
|
|
if (hint) {
|
2015-06-08 19:17:07 +00:00
|
|
|
hint->res_name = (char *) app_name;
|
|
|
|
hint->res_class = (char *) "GStreamer";
|
2015-06-05 15:01:05 +00:00
|
|
|
XSetClassHint (ximagesink->xcontext->disp, xwindow->win, hint);
|
|
|
|
}
|
|
|
|
XFree (hint);
|
2009-06-22 08:40:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-09 19:11:26 +00:00
|
|
|
/* This function handles a GstXWindow creation */
|
2003-11-06 21:51:14 +00:00
|
|
|
static GstXWindow *
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_new (GstXImageSink * ximagesink, gint width,
|
|
|
|
gint height)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GstXWindow *xwindow = NULL;
|
sys/ximage/ximagesink.c: Protect interface methods from chain and negotiation and vice versa (Fixes #166142).
Original commit message from CVS:
2005-02-12 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_sink_link), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_property),
(gst_ximagesink_finalize), (gst_ximagesink_init): Protect interface
methods from chain and negotiation and vice versa (Fixes #166142).
* sys/ximage/ximagesink.h: Add stream_lock.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_sink_link),
(gst_xvimagesink_chain), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose): Check for xcontext before trying to link.
2005-02-12 18:41:49 +00:00
|
|
|
XGCValues values;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_val_if_fail (GST_IS_X_IMAGE_SINK (ximagesink), NULL);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
xwindow = g_new0 (GstXWindow, 1);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
xwindow->width = width;
|
|
|
|
xwindow->height = height;
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
xwindow->internal = TRUE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
xwindow->win = XCreateSimpleWindow (ximagesink->xcontext->disp,
|
2004-03-14 22:34:34 +00:00
|
|
|
ximagesink->xcontext->root,
|
2011-02-24 10:57:53 +00:00
|
|
|
0, 0, width, height, 0, 0, ximagesink->xcontext->black);
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
/* We have to do that to prevent X from redrawing the background on
|
|
|
|
ConfigureNotify. This takes away flickering of video when resizing. */
|
|
|
|
XSetWindowBackgroundPixmap (ximagesink->xcontext->disp, xwindow->win, None);
|
|
|
|
|
2009-06-22 08:40:33 +00:00
|
|
|
/* set application name as a title */
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_set_title (ximagesink, xwindow, NULL);
|
2009-06-22 08:40:33 +00:00
|
|
|
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
if (ximagesink->handle_events) {
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
Atom wm_delete;
|
|
|
|
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask |
|
|
|
|
StructureNotifyMask | PointerMotionMask | KeyPressMask |
|
|
|
|
KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
|
|
|
|
/* Tell the window manager we'd like delete client messages instead of
|
|
|
|
* being killed */
|
|
|
|
wm_delete = XInternAtom (ximagesink->xcontext->disp,
|
|
|
|
"WM_DELETE_WINDOW", False);
|
|
|
|
(void) XSetWMProtocols (ximagesink->xcontext->disp, xwindow->win,
|
|
|
|
&wm_delete, 1);
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/ximage/ximagesink.c: Protect interface methods from chain and negotiation and vice versa (Fixes #166142).
Original commit message from CVS:
2005-02-12 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_sink_link), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_property),
(gst_ximagesink_finalize), (gst_ximagesink_init): Protect interface
methods from chain and negotiation and vice versa (Fixes #166142).
* sys/ximage/ximagesink.h: Add stream_lock.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_sink_link),
(gst_xvimagesink_chain), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose): Check for xcontext before trying to link.
2005-02-12 18:41:49 +00:00
|
|
|
xwindow->gc = XCreateGC (ximagesink->xcontext->disp, xwindow->win,
|
|
|
|
0, &values);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XMapRaised (ximagesink->xcontext->disp, xwindow->win);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_decorate (ximagesink, xwindow);
|
2004-06-27 19:02:29 +00:00
|
|
|
|
2011-08-08 09:44:17 +00:00
|
|
|
gst_video_overlay_got_window_handle (GST_VIDEO_OVERLAY (ximagesink),
|
|
|
|
xwindow->win);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
return xwindow;
|
|
|
|
}
|
|
|
|
|
2003-11-09 19:11:26 +00:00
|
|
|
/* This function destroys a GstXWindow */
|
2003-11-06 21:51:14 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_destroy (GstXImageSink * ximagesink,
|
2004-03-14 22:34:34 +00:00
|
|
|
GstXWindow * xwindow)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (xwindow != NULL);
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_if_fail (GST_IS_X_IMAGE_SINK (ximagesink));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-11-17 16:32:29 +00:00
|
|
|
/* If we did not create that window we just free the GC and let it live */
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
if (xwindow->internal)
|
2003-11-17 16:32:29 +00:00
|
|
|
XDestroyWindow (ximagesink->xcontext->disp, xwindow->win);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
else
|
2004-01-04 18:53:53 +00:00
|
|
|
XSelectInput (ximagesink->xcontext->disp, xwindow->win, 0);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
XFreeGC (ximagesink->xcontext->disp, xwindow->gc);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
g_free (xwindow);
|
|
|
|
}
|
|
|
|
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_update_geometry (GstXImageSink * ximagesink)
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
{
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
XWindowAttributes attr;
|
2011-05-03 10:57:28 +00:00
|
|
|
gboolean reconfigure;
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_if_fail (GST_IS_X_IMAGE_SINK (ximagesink));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
/* Update the window geometry */
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2010-04-15 09:59:53 +00:00
|
|
|
if (G_UNLIKELY (ximagesink->xwindow == NULL)) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2010-04-15 09:59:53 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
XGetWindowAttributes (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->xwindow->win, &attr);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2011-05-03 10:57:28 +00:00
|
|
|
/* Check if we would suggest a different width/height now */
|
|
|
|
reconfigure = (ximagesink->xwindow->width != attr.width)
|
|
|
|
|| (ximagesink->xwindow->height != attr.height);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
ximagesink->xwindow->width = attr.width;
|
|
|
|
ximagesink->xwindow->height = attr.height;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2011-05-03 10:57:28 +00:00
|
|
|
|
|
|
|
if (reconfigure)
|
|
|
|
gst_pad_push_event (GST_BASE_SINK (ximagesink)->sinkpad,
|
|
|
|
gst_event_new_reconfigure ());
|
ext/alsa/gstalsa.c: Alsa should trigger an error if it failed opening the audio device.
Original commit message from CVS:
2004-02-16 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsa.c: (gst_alsa_open_audio),
(gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it
failed opening the audio device.
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy),
(gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_chain),
(gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED.
Removing some useless g_return_if_fail like wingo suggested.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear),
(gst_xvimagesink_update_colorbalance),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_get_fourcc_from_caps),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_colorbalance_list_channels),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO
PAUSED. Removing some useless g_return_if_fail like wingo suggested.
2004-02-16 16:24:51 +00:00
|
|
|
}
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
|
ext/alsa/gstalsa.c: Alsa should trigger an error if it failed opening the audio device.
Original commit message from CVS:
2004-02-16 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsa.c: (gst_alsa_open_audio),
(gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it
failed opening the audio device.
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy),
(gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_chain),
(gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED.
Removing some useless g_return_if_fail like wingo suggested.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear),
(gst_xvimagesink_update_colorbalance),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_get_fourcc_from_caps),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_colorbalance_list_channels),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO
PAUSED. Removing some useless g_return_if_fail like wingo suggested.
2004-02-16 16:24:51 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_clear (GstXImageSink * ximagesink,
|
|
|
|
GstXWindow * xwindow)
|
ext/alsa/gstalsa.c: Alsa should trigger an error if it failed opening the audio device.
Original commit message from CVS:
2004-02-16 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsa.c: (gst_alsa_open_audio),
(gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it
failed opening the audio device.
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy),
(gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_chain),
(gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED.
Removing some useless g_return_if_fail like wingo suggested.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear),
(gst_xvimagesink_update_colorbalance),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_get_fourcc_from_caps),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_colorbalance_list_channels),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO
PAUSED. Removing some useless g_return_if_fail like wingo suggested.
2004-02-16 16:24:51 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (xwindow != NULL);
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_if_fail (GST_IS_X_IMAGE_SINK (ximagesink));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
ext/alsa/gstalsa.c: Alsa should trigger an error if it failed opening the audio device.
Original commit message from CVS:
2004-02-16 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsa.c: (gst_alsa_open_audio),
(gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it
failed opening the audio device.
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy),
(gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_chain),
(gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED.
Removing some useless g_return_if_fail like wingo suggested.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear),
(gst_xvimagesink_update_colorbalance),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_get_fourcc_from_caps),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_colorbalance_list_channels),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO
PAUSED. Removing some useless g_return_if_fail like wingo suggested.
2004-02-16 16:24:51 +00:00
|
|
|
XSetForeground (ximagesink->xcontext->disp, xwindow->gc,
|
2004-03-14 22:34:34 +00:00
|
|
|
ximagesink->xcontext->black);
|
|
|
|
|
ext/alsa/gstalsa.c: Alsa should trigger an error if it failed opening the audio device.
Original commit message from CVS:
2004-02-16 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsa.c: (gst_alsa_open_audio),
(gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it
failed opening the audio device.
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy),
(gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_chain),
(gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED.
Removing some useless g_return_if_fail like wingo suggested.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear),
(gst_xvimagesink_update_colorbalance),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_get_fourcc_from_caps),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_colorbalance_list_channels),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO
PAUSED. Removing some useless g_return_if_fail like wingo suggested.
2004-02-16 16:24:51 +00:00
|
|
|
XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
|
2004-03-14 22:34:34 +00:00
|
|
|
0, 0, xwindow->width, xwindow->height);
|
|
|
|
|
ext/alsa/gstalsa.c: Alsa should trigger an error if it failed opening the audio device.
Original commit message from CVS:
2004-02-16 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsa.c: (gst_alsa_open_audio),
(gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it
failed opening the audio device.
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy),
(gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_chain),
(gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED.
Removing some useless g_return_if_fail like wingo suggested.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear),
(gst_xvimagesink_update_colorbalance),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_get_fourcc_from_caps),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_colorbalance_list_channels),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO
PAUSED. Removing some useless g_return_if_fail like wingo suggested.
2004-02-16 16:24:51 +00:00
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
}
|
|
|
|
|
2003-11-09 19:11:26 +00:00
|
|
|
/* This function handles XEvents that might be in the queue. It generates
|
|
|
|
GstEvent that will be sent upstream in the pipeline to handle interactivity
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
and navigation.*/
|
2003-11-08 14:58:35 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
2003-11-08 14:58:35 +00:00
|
|
|
{
|
|
|
|
XEvent e;
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
guint pointer_x = 0, pointer_y = 0;
|
|
|
|
gboolean pointer_moved = FALSE;
|
|
|
|
gboolean exposed = FALSE, configured = FALSE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_if_fail (GST_IS_X_IMAGE_SINK (ximagesink));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
/* Then we get all pointer motion events, only the last position is
|
|
|
|
interesting. */
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
while (XCheckWindowEvent (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->xwindow->win, PointerMotionMask, &e)) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
switch (e.type) {
|
|
|
|
case MotionNotify:
|
|
|
|
pointer_x = e.xmotion.x;
|
|
|
|
pointer_y = e.xmotion.y;
|
|
|
|
pointer_moved = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
if (pointer_moved) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2004-02-02 21:59:35 +00:00
|
|
|
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
GST_DEBUG ("ximagesink pointer moved over window at %d,%d",
|
|
|
|
pointer_x, pointer_y);
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
|
|
|
|
"mouse-move", 0, pointer_x, pointer_y);
|
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
|
|
|
|
2004-02-02 21:59:35 +00:00
|
|
|
/* We get all remaining events on our window to throw them upstream */
|
|
|
|
while (XCheckWindowEvent (ximagesink->xcontext->disp,
|
2004-03-15 19:32:28 +00:00
|
|
|
ximagesink->xwindow->win,
|
|
|
|
KeyPressMask | KeyReleaseMask |
|
|
|
|
ButtonPressMask | ButtonReleaseMask, &e)) {
|
2004-03-14 22:34:34 +00:00
|
|
|
KeySym keysym;
|
2012-03-05 10:07:39 +00:00
|
|
|
const char *key_str = NULL;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
/* We lock only for the X function call */
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
switch (e.type) {
|
|
|
|
case ButtonPress:
|
2004-03-15 19:32:28 +00:00
|
|
|
/* Mouse button pressed/released over our window. We send upstream
|
|
|
|
events for interactivity/navigation */
|
|
|
|
GST_DEBUG ("ximagesink button %d pressed over window at %d,%d",
|
|
|
|
e.xbutton.button, e.xbutton.x, e.xbutton.x);
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
|
|
|
|
"mouse-button-press", e.xbutton.button, e.xbutton.x, e.xbutton.y);
|
|
|
|
break;
|
2004-03-14 22:34:34 +00:00
|
|
|
case ButtonRelease:
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_DEBUG ("ximagesink button %d release over window at %d,%d",
|
|
|
|
e.xbutton.button, e.xbutton.x, e.xbutton.x);
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
|
|
|
|
"mouse-button-release", e.xbutton.button, e.xbutton.x, e.xbutton.y);
|
|
|
|
break;
|
2004-03-14 22:34:34 +00:00
|
|
|
case KeyPress:
|
|
|
|
case KeyRelease:
|
2004-03-15 19:32:28 +00:00
|
|
|
/* Key pressed/released over our window. We send upstream
|
|
|
|
events for interactivity/navigation */
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2012-03-05 10:07:39 +00:00
|
|
|
keysym = XkbKeycodeToKeysym (ximagesink->xcontext->disp,
|
|
|
|
e.xkey.keycode, 0, 0);
|
2004-03-15 19:32:28 +00:00
|
|
|
if (keysym != NoSymbol) {
|
2007-01-23 13:19:19 +00:00
|
|
|
key_str = XKeysymToString (keysym);
|
2004-03-15 19:32:28 +00:00
|
|
|
} else {
|
2012-03-05 10:07:39 +00:00
|
|
|
key_str = "unknown";
|
2004-03-15 19:32:28 +00:00
|
|
|
}
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2012-03-05 10:07:39 +00:00
|
|
|
GST_DEBUG_OBJECT (ximagesink,
|
|
|
|
"key %d pressed over window at %d,%d (%s)",
|
|
|
|
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
|
|
|
|
gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
|
|
|
|
e.type == KeyPress ? "key-press" : "key-release", key_str);
|
2004-03-15 19:32:28 +00:00
|
|
|
break;
|
2004-03-14 22:34:34 +00:00
|
|
|
default:
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
GST_DEBUG_OBJECT (ximagesink, "ximagesink unhandled X event (%d)",
|
|
|
|
e.type);
|
2003-11-08 14:58:35 +00:00
|
|
|
}
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
|
2011-04-06 10:26:47 +00:00
|
|
|
/* Handle Expose */
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
while (XCheckWindowEvent (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->xwindow->win, ExposureMask | StructureNotifyMask, &e)) {
|
|
|
|
switch (e.type) {
|
|
|
|
case Expose:
|
|
|
|
exposed = TRUE;
|
|
|
|
break;
|
|
|
|
case ConfigureNotify:
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_update_geometry (ximagesink);
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
configured = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
}
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
}
|
|
|
|
|
2007-07-14 18:20:41 +00:00
|
|
|
if (ximagesink->handle_expose && (exposed || configured)) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_expose (GST_VIDEO_OVERLAY (ximagesink));
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle Display events */
|
|
|
|
while (XPending (ximagesink->xcontext->disp)) {
|
|
|
|
XNextEvent (ximagesink->xcontext->disp, &e);
|
|
|
|
|
|
|
|
switch (e.type) {
|
|
|
|
case ClientMessage:{
|
|
|
|
Atom wm_delete;
|
|
|
|
|
|
|
|
wm_delete = XInternAtom (ximagesink->xcontext->disp,
|
|
|
|
"WM_DELETE_WINDOW", False);
|
|
|
|
if (wm_delete == (Atom) e.xclient.data.l[0]) {
|
|
|
|
/* Handle window deletion by posting an error on the bus */
|
|
|
|
GST_ELEMENT_ERROR (ximagesink, RESOURCE, NOT_FOUND,
|
|
|
|
("Output window was closed"), (NULL));
|
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_destroy (ximagesink, ximagesink->xwindow);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
ximagesink->xwindow = NULL;
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
}
|
|
|
|
}
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_event_thread (GstXImageSink * ximagesink)
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
{
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_val_if_fail (GST_IS_X_IMAGE_SINK (ximagesink), NULL);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
GST_OBJECT_LOCK (ximagesink);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
while (ximagesink->running) {
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
GST_OBJECT_UNLOCK (ximagesink);
|
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
if (ximagesink->xwindow) {
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_handle_xevents (ximagesink);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
}
|
2009-10-07 14:45:33 +00:00
|
|
|
/* FIXME: do we want to align this with the framerate or anything else? */
|
|
|
|
g_usleep (G_USEC_PER_SEC / 20);
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (ximagesink);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
}
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
GST_OBJECT_UNLOCK (ximagesink);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
|
|
|
|
return NULL;
|
2003-11-08 14:58:35 +00:00
|
|
|
}
|
2003-11-09 19:11:26 +00:00
|
|
|
|
2009-10-07 14:45:33 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_manage_event_thread (GstXImageSink * ximagesink)
|
2009-10-07 14:45:33 +00:00
|
|
|
{
|
|
|
|
GThread *thread = NULL;
|
|
|
|
|
|
|
|
/* don't start the thread too early */
|
|
|
|
if (ximagesink->xcontext == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (ximagesink);
|
|
|
|
if (ximagesink->handle_expose || ximagesink->handle_events) {
|
|
|
|
if (!ximagesink->event_thread) {
|
|
|
|
/* Setup our event listening thread */
|
|
|
|
GST_DEBUG_OBJECT (ximagesink, "run xevent thread, expose %d, events %d",
|
|
|
|
ximagesink->handle_expose, ximagesink->handle_events);
|
|
|
|
ximagesink->running = TRUE;
|
2011-12-04 16:43:38 +00:00
|
|
|
ximagesink->event_thread = g_thread_try_new ("ximagesink-events",
|
2015-07-03 19:48:52 +00:00
|
|
|
(GThreadFunc) gst_x_image_sink_event_thread, ximagesink, NULL);
|
2009-10-07 14:45:33 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (ximagesink->event_thread) {
|
|
|
|
GST_DEBUG_OBJECT (ximagesink, "stop xevent thread, expose %d, events %d",
|
|
|
|
ximagesink->handle_expose, ximagesink->handle_events);
|
|
|
|
ximagesink->running = FALSE;
|
|
|
|
/* grab thread and mark it as NULL */
|
|
|
|
thread = ximagesink->event_thread;
|
|
|
|
ximagesink->event_thread = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (ximagesink);
|
|
|
|
|
|
|
|
/* Wait for our event thread to finish */
|
|
|
|
if (thread)
|
|
|
|
g_thread_join (thread);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-27 16:43:24 +00:00
|
|
|
/* This function calculates the pixel aspect ratio based on the properties
|
|
|
|
* in the xcontext structure and stores it there. */
|
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_calculate_pixel_aspect_ratio (GstXContext * xcontext)
|
2004-07-27 16:43:24 +00:00
|
|
|
{
|
2007-02-15 12:07:57 +00:00
|
|
|
static const gint par[][2] = {
|
2004-07-27 16:43:24 +00:00
|
|
|
{1, 1}, /* regular screen */
|
|
|
|
{16, 15}, /* PAL TV */
|
|
|
|
{11, 10}, /* 525 line Rec.601 video */
|
2006-01-26 19:17:38 +00:00
|
|
|
{54, 59}, /* 625 line Rec.601 video */
|
|
|
|
{64, 45}, /* 1280x1024 on 16:9 display */
|
|
|
|
{5, 3}, /* 1280x1024 on 4:3 display */
|
|
|
|
{4, 3} /* 800x600 on 16:9 display */
|
2004-07-27 16:43:24 +00:00
|
|
|
};
|
|
|
|
gint i;
|
|
|
|
gint index;
|
|
|
|
gdouble ratio;
|
|
|
|
gdouble delta;
|
|
|
|
|
|
|
|
#define DELTA(idx) (ABS (ratio - ((gdouble) par[idx][0] / par[idx][1])))
|
|
|
|
|
|
|
|
/* first calculate the "real" ratio based on the X values;
|
|
|
|
* which is the "physical" w/h divided by the w/h in pixels of the display */
|
2004-08-03 14:09:26 +00:00
|
|
|
ratio = (gdouble) (xcontext->widthmm * xcontext->height)
|
2004-07-27 16:43:24 +00:00
|
|
|
/ (xcontext->heightmm * xcontext->width);
|
2004-07-28 21:28:34 +00:00
|
|
|
|
|
|
|
/* DirectFB's X in 720x576 reports the physical dimensions wrong, so
|
|
|
|
* override here */
|
|
|
|
if (xcontext->width == 720 && xcontext->height == 576) {
|
|
|
|
ratio = 4.0 * 576 / (3.0 * 720);
|
|
|
|
}
|
2004-07-27 16:43:24 +00:00
|
|
|
GST_DEBUG ("calculated pixel aspect ratio: %f", ratio);
|
|
|
|
|
|
|
|
/* now find the one from par[][2] with the lowest delta to the real one */
|
|
|
|
delta = DELTA (0);
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
for (i = 1; i < sizeof (par) / (sizeof (gint) * 2); ++i) {
|
|
|
|
gdouble this_delta = DELTA (i);
|
|
|
|
|
|
|
|
if (this_delta < delta) {
|
|
|
|
index = i;
|
|
|
|
delta = this_delta;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("Decided on index %d (%d/%d)", index,
|
|
|
|
par[index][0], par[index][1]);
|
|
|
|
|
2004-07-28 21:28:34 +00:00
|
|
|
g_free (xcontext->par);
|
|
|
|
xcontext->par = g_new0 (GValue, 1);
|
|
|
|
g_value_init (xcontext->par, GST_TYPE_FRACTION);
|
|
|
|
gst_value_set_fraction (xcontext->par, par[index][0], par[index][1]);
|
|
|
|
GST_DEBUG ("set xcontext PAR to %d/%d",
|
|
|
|
gst_value_get_fraction_numerator (xcontext->par),
|
|
|
|
gst_value_get_fraction_denominator (xcontext->par));
|
2004-07-27 16:43:24 +00:00
|
|
|
}
|
|
|
|
|
2004-07-19 11:21:10 +00:00
|
|
|
/* This function gets the X Display and global info about it. Everything is
|
2003-11-06 21:51:14 +00:00
|
|
|
stored in our object and will be cleaned when the object is disposed. Note
|
2004-07-19 11:21:10 +00:00
|
|
|
here that caps for supported format are generated without any window or
|
2003-11-11 11:32:27 +00:00
|
|
|
image creation */
|
2003-11-06 21:51:14 +00:00
|
|
|
static GstXContext *
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xcontext_get (GstXImageSink * ximagesink)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GstXContext *xcontext = NULL;
|
|
|
|
XPixmapFormatValues *px_formats = NULL;
|
|
|
|
gint nb_formats = 0, i;
|
2011-06-16 10:48:33 +00:00
|
|
|
gint endianness;
|
|
|
|
GstVideoFormat vformat;
|
2013-05-16 08:52:29 +00:00
|
|
|
guint32 alpha_mask;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_val_if_fail (GST_IS_X_IMAGE_SINK (ximagesink), NULL);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
xcontext = g_new0 (GstXContext, 1);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +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
|
|
|
xcontext->disp = XOpenDisplay (ximagesink->display_name);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
if (!xcontext->disp) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
g_free (xcontext);
|
2006-05-26 11:17:57 +00:00
|
|
|
GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
|
|
|
|
("Could not initialise X output"), ("Could not open display"));
|
2004-03-14 22:34:34 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
xcontext->screen = DefaultScreenOfDisplay (xcontext->disp);
|
|
|
|
xcontext->screen_num = DefaultScreen (xcontext->disp);
|
2004-03-14 22:34:34 +00:00
|
|
|
xcontext->visual = DefaultVisual (xcontext->disp, xcontext->screen_num);
|
2003-11-06 21:51:14 +00:00
|
|
|
xcontext->root = DefaultRootWindow (xcontext->disp);
|
|
|
|
xcontext->white = XWhitePixel (xcontext->disp, xcontext->screen_num);
|
|
|
|
xcontext->black = XBlackPixel (xcontext->disp, xcontext->screen_num);
|
|
|
|
xcontext->depth = DefaultDepthOfScreen (xcontext->screen);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-07-27 16:43:24 +00:00
|
|
|
xcontext->width = DisplayWidth (xcontext->disp, xcontext->screen_num);
|
|
|
|
xcontext->height = DisplayHeight (xcontext->disp, xcontext->screen_num);
|
|
|
|
xcontext->widthmm = DisplayWidthMM (xcontext->disp, xcontext->screen_num);
|
|
|
|
xcontext->heightmm = DisplayHeightMM (xcontext->disp, xcontext->screen_num);
|
|
|
|
|
2004-08-03 08:48:29 +00:00
|
|
|
GST_DEBUG_OBJECT (ximagesink, "X reports %dx%d pixels and %d mm x %d mm",
|
|
|
|
xcontext->width, xcontext->height, xcontext->widthmm, xcontext->heightmm);
|
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_calculate_pixel_aspect_ratio (xcontext);
|
2004-07-27 16:43:24 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
/* We get supported pixmap formats at supported depth */
|
|
|
|
px_formats = XListPixmapFormats (xcontext->disp, &nb_formats);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
if (!px_formats) {
|
|
|
|
XCloseDisplay (xcontext->disp);
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2007-11-16 11:16:58 +00:00
|
|
|
g_free (xcontext->par);
|
2004-03-14 22:34:34 +00:00
|
|
|
g_free (xcontext);
|
2011-04-06 10:26:47 +00:00
|
|
|
GST_ELEMENT_ERROR (ximagesink, RESOURCE, SETTINGS,
|
2010-05-10 10:28:29 +00:00
|
|
|
("Could not get supported pixmap formats"), (NULL));
|
2004-03-14 22:34:34 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
/* We get bpp value corresponding to our running depth */
|
2004-03-14 22:34:34 +00:00
|
|
|
for (i = 0; i < nb_formats; i++) {
|
|
|
|
if (px_formats[i].depth == xcontext->depth)
|
|
|
|
xcontext->bpp = px_formats[i].bits_per_pixel;
|
|
|
|
}
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
XFree (px_formats);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2011-06-16 10:48:33 +00:00
|
|
|
endianness = (ImageByteOrder (xcontext->disp) ==
|
2004-03-14 22:34:34 +00:00
|
|
|
LSBFirst) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
/* Search for XShm extension support */
|
2005-09-08 16:38:30 +00:00
|
|
|
#ifdef HAVE_XSHM
|
2004-01-28 00:29:42 +00:00
|
|
|
if (XShmQueryExtension (xcontext->disp) &&
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_check_xshm_calls (ximagesink, xcontext)) {
|
2004-03-14 22:34:34 +00:00
|
|
|
xcontext->use_xshm = TRUE;
|
|
|
|
GST_DEBUG ("ximagesink is using XShm extension");
|
2005-09-08 16:38:30 +00:00
|
|
|
} else
|
2011-04-06 10:26:47 +00:00
|
|
|
#endif /* HAVE_XSHM */
|
2005-09-08 16:38:30 +00:00
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
xcontext->use_xshm = FALSE;
|
|
|
|
GST_DEBUG ("ximagesink is not using XShm extension");
|
|
|
|
}
|
2003-12-17 22:37:26 +00:00
|
|
|
|
2013-05-16 08:52:29 +00:00
|
|
|
/* extrapolate alpha mask */
|
2014-03-27 20:43:10 +00:00
|
|
|
if (xcontext->depth == 32) {
|
|
|
|
alpha_mask = ~(xcontext->visual->red_mask
|
|
|
|
| xcontext->visual->green_mask | xcontext->visual->blue_mask);
|
|
|
|
} else {
|
|
|
|
alpha_mask = 0;
|
|
|
|
}
|
2013-05-16 08:52:29 +00:00
|
|
|
|
|
|
|
vformat =
|
|
|
|
gst_video_format_from_masks (xcontext->depth, xcontext->bpp, endianness,
|
|
|
|
xcontext->visual->red_mask, xcontext->visual->green_mask,
|
|
|
|
xcontext->visual->blue_mask, alpha_mask);
|
2011-06-16 10:48:33 +00:00
|
|
|
|
|
|
|
if (vformat == GST_VIDEO_FORMAT_UNKNOWN)
|
|
|
|
goto unknown_format;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
ext/alsa/gstalsamixer.c: Update mixer (to sync with other sessions) if we try to obtain a new value. This makes alsam...
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
Update mixer (to sync with other sessions) if we try to obtain
a new value. This makes alsamixer work accross applications.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_get_time):
Only call sync functions if we're running, else alsalib asserts.
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_src_query):
Sometimes fails to compile. Possibly a gcc bug.
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
Add a reference to an application-provided object, because we lose
this same reference if we add it to the bin. If we don't do this,
we can only use this object once and thus crash if we go from
ready to playing, back to ready and back to playing again.
Also add an audioscale element because several cheap soundcards -
like mine - don't support all samplerates.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_xcontext_clear), (gst_ximagesink_change_state):
Fix wrong order or PAR calls. Makes automatically obtained PAR
from the X server atually being used.
2004-09-13 09:24:00 +00:00
|
|
|
/* update object's par with calculated one if not set yet */
|
|
|
|
if (!ximagesink->par) {
|
|
|
|
ximagesink->par = g_new0 (GValue, 1);
|
|
|
|
gst_value_init_and_copy (ximagesink->par, xcontext->par);
|
|
|
|
GST_DEBUG_OBJECT (ximagesink, "set calculated PAR on object's PAR");
|
|
|
|
}
|
2011-06-16 10:48:33 +00:00
|
|
|
xcontext->caps = gst_caps_new_simple ("video/x-raw",
|
|
|
|
"format", G_TYPE_STRING, gst_video_format_to_string (vformat),
|
2004-05-05 11:29:49 +00:00
|
|
|
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
|
|
|
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
|
2004-07-28 21:28:34 +00:00
|
|
|
if (ximagesink->par) {
|
|
|
|
int nom, den;
|
|
|
|
|
|
|
|
nom = gst_value_get_fraction_numerator (ximagesink->par);
|
|
|
|
den = gst_value_get_fraction_denominator (ximagesink->par);
|
|
|
|
gst_caps_set_simple (xcontext->caps, "pixel-aspect-ratio",
|
|
|
|
GST_TYPE_FRACTION, nom, den, NULL);
|
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
return xcontext;
|
2011-06-16 10:48:33 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
unknown_format:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (ximagesink, "unknown format");
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This function cleans the X context. Closing the Display and unrefing the
|
|
|
|
caps for supported formats. */
|
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xcontext_clear (GstXImageSink * ximagesink)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
2006-07-13 14:38:15 +00:00
|
|
|
GstXContext *xcontext;
|
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_if_fail (GST_IS_X_IMAGE_SINK (ximagesink));
|
2006-07-13 14:38:15 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (ximagesink);
|
|
|
|
if (ximagesink->xcontext == NULL) {
|
|
|
|
GST_OBJECT_UNLOCK (ximagesink);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Take the xcontext reference and NULL it while we
|
|
|
|
* clean it up, so that any buffer-alloced buffers
|
|
|
|
* arriving after this will be freed correctly */
|
|
|
|
xcontext = ximagesink->xcontext;
|
|
|
|
ximagesink->xcontext = NULL;
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (ximagesink);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2006-07-13 14:38:15 +00:00
|
|
|
gst_caps_unref (xcontext->caps);
|
|
|
|
g_free (xcontext->par);
|
ext/alsa/gstalsamixer.c: Update mixer (to sync with other sessions) if we try to obtain a new value. This makes alsam...
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_update),
(gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
(gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
(gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
Update mixer (to sync with other sessions) if we try to obtain
a new value. This makes alsamixer work accross applications.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_get_time):
Only call sync functions if we're running, else alsalib asserts.
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_src_query):
Sometimes fails to compile. Possibly a gcc bug.
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
Add a reference to an application-provided object, because we lose
this same reference if we add it to the bin. If we don't do this,
we can only use this object once and thus crash if we go from
ready to playing, back to ready and back to playing again.
Also add an audioscale element because several cheap soundcards -
like mine - don't support all samplerates.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_xcontext_clear), (gst_ximagesink_change_state):
Fix wrong order or PAR calls. Makes automatically obtained PAR
from the X server atually being used.
2004-09-13 09:24:00 +00:00
|
|
|
g_free (ximagesink->par);
|
|
|
|
ximagesink->par = NULL;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-06-14 10:27:02 +00:00
|
|
|
if (xcontext->last_caps)
|
|
|
|
gst_caps_replace (&xcontext->last_caps, NULL);
|
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2006-07-13 14:38:15 +00:00
|
|
|
XCloseDisplay (xcontext->disp);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2007-03-08 15:22:53 +00:00
|
|
|
g_free (xcontext);
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
/* Element stuff */
|
|
|
|
|
|
|
|
static GstCaps *
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_getcaps (GstBaseSink * bsink, GstCaps * filter)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
2004-07-27 16:43:24 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
int i;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
ximagesink = GST_X_IMAGE_SINK (bsink);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2011-04-28 08:55:21 +00:00
|
|
|
if (ximagesink->xcontext) {
|
2011-05-11 15:39:52 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
caps = gst_caps_ref (ximagesink->xcontext->caps);
|
|
|
|
|
|
|
|
if (filter) {
|
|
|
|
GstCaps *intersection;
|
|
|
|
|
|
|
|
intersection =
|
|
|
|
gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
caps = intersection;
|
|
|
|
}
|
|
|
|
|
2013-03-21 12:29:06 +00:00
|
|
|
if (gst_caps_is_empty (caps)) {
|
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2011-04-28 08:55:21 +00:00
|
|
|
if (ximagesink->xwindow && ximagesink->xwindow->width) {
|
|
|
|
GstStructure *s0, *s1;
|
|
|
|
|
2011-05-11 15:39:52 +00:00
|
|
|
caps = gst_caps_make_writable (caps);
|
2011-04-28 08:55:21 +00:00
|
|
|
|
2011-05-11 15:39:52 +00:00
|
|
|
/* There can only be a single structure because the xcontext
|
|
|
|
* caps only have a single structure */
|
2011-04-28 08:55:21 +00:00
|
|
|
s0 = gst_caps_get_structure (caps, 0);
|
2011-05-11 15:39:52 +00:00
|
|
|
s1 = gst_structure_copy (gst_caps_get_structure (caps, 0));
|
|
|
|
|
2011-04-28 08:55:21 +00:00
|
|
|
gst_structure_set (s0, "width", G_TYPE_INT, ximagesink->xwindow->width,
|
|
|
|
"height", G_TYPE_INT, ximagesink->xwindow->height, NULL);
|
|
|
|
gst_caps_append_structure (caps, s1);
|
2011-05-11 15:39:52 +00:00
|
|
|
|
|
|
|
/* This will not change the order but will remove the
|
|
|
|
* fixed width/height caps again if not possible
|
|
|
|
* upstream */
|
|
|
|
if (filter) {
|
|
|
|
GstCaps *intersection;
|
|
|
|
|
|
|
|
intersection =
|
|
|
|
gst_caps_intersect_full (caps, filter, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
caps = intersection;
|
|
|
|
}
|
2011-04-28 08:55:21 +00:00
|
|
|
}
|
2011-05-11 15:39:52 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2011-05-11 15:39:52 +00:00
|
|
|
return caps;
|
2011-04-28 08:55:21 +00:00
|
|
|
}
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2003-11-06 22:48:03 +00:00
|
|
|
|
2004-07-27 16:43:24 +00:00
|
|
|
/* get a template copy and add the pixel aspect ratio */
|
2011-05-17 10:54:41 +00:00
|
|
|
caps = gst_pad_get_pad_template_caps (GST_BASE_SINK (ximagesink)->sinkpad);
|
|
|
|
if (ximagesink->par) {
|
|
|
|
caps = gst_caps_make_writable (caps);
|
|
|
|
for (i = 0; i < gst_caps_get_size (caps); ++i) {
|
|
|
|
GstStructure *structure = gst_caps_get_structure (caps, i);
|
2004-07-28 21:28:34 +00:00
|
|
|
int nom, den;
|
|
|
|
|
|
|
|
nom = gst_value_get_fraction_numerator (ximagesink->par);
|
|
|
|
den = gst_value_get_fraction_denominator (ximagesink->par);
|
|
|
|
gst_structure_set (structure, "pixel-aspect-ratio",
|
|
|
|
GST_TYPE_FRACTION, nom, den, NULL);
|
|
|
|
}
|
2004-07-27 16:43:24 +00:00
|
|
|
}
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
|
2011-05-11 15:39:52 +00:00
|
|
|
if (filter) {
|
|
|
|
GstCaps *intersection;
|
|
|
|
|
|
|
|
intersection =
|
|
|
|
gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
caps = intersection;
|
|
|
|
}
|
|
|
|
|
2004-07-27 16:43:24 +00:00
|
|
|
return caps;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
2015-06-05 18:28:41 +00:00
|
|
|
static GstBufferPool *
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_create_pool (GstXImageSink * ximagesink, GstCaps * caps,
|
2015-06-05 18:28:41 +00:00
|
|
|
gsize size, gint min)
|
|
|
|
{
|
|
|
|
static GstAllocationParams params = { 0, 15, 0, 0, };
|
|
|
|
GstBufferPool *pool;
|
|
|
|
GstStructure *config;
|
|
|
|
|
|
|
|
/* create a new pool for the new configuration */
|
|
|
|
pool = gst_ximage_buffer_pool_new (ximagesink);
|
|
|
|
|
|
|
|
config = gst_buffer_pool_get_config (pool);
|
|
|
|
gst_buffer_pool_config_set_params (config, caps, size, min, 0);
|
|
|
|
gst_buffer_pool_config_set_allocator (config, NULL, ¶ms);
|
|
|
|
|
|
|
|
if (!gst_buffer_pool_set_config (pool, config))
|
|
|
|
goto config_failed;
|
|
|
|
|
|
|
|
return pool;
|
|
|
|
|
|
|
|
config_failed:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (ximagesink, "failed setting config");
|
|
|
|
gst_object_unref (pool);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-25 07:06:09 +00:00
|
|
|
static gboolean
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
2003-12-22 01:47:09 +00:00
|
|
|
GstStructure *structure;
|
2011-06-17 13:31:59 +00:00
|
|
|
GstVideoInfo info;
|
2011-03-03 15:48:23 +00:00
|
|
|
GstBufferPool *newpool, *oldpool;
|
2004-07-27 16:43:24 +00:00
|
|
|
const GValue *par;
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
ximagesink = GST_X_IMAGE_SINK (bsink);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-11-22 04:06:50 +00:00
|
|
|
if (!ximagesink->xcontext)
|
2005-04-25 07:06:09 +00:00
|
|
|
return FALSE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-05-04 14:51:40 +00:00
|
|
|
GST_DEBUG_OBJECT (ximagesink,
|
2004-05-04 14:17:25 +00:00
|
|
|
"sinkconnect possible caps %" GST_PTR_FORMAT " with given caps %"
|
2004-05-04 14:51:40 +00:00
|
|
|
GST_PTR_FORMAT, ximagesink->xcontext->caps, caps);
|
2003-11-26 10:12:05 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
/* We intersect those caps with our template to make sure they are correct */
|
2010-05-06 05:15:16 +00:00
|
|
|
if (!gst_caps_can_intersect (ximagesink->xcontext->caps, caps))
|
|
|
|
goto incompatible_caps;
|
2005-10-24 17:04:01 +00:00
|
|
|
|
2011-06-17 13:31:59 +00:00
|
|
|
if (!gst_video_info_from_caps (&info, caps))
|
|
|
|
goto invalid_format;
|
2011-04-06 10:26:47 +00:00
|
|
|
|
2011-06-17 13:31:59 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
2004-07-27 16:43:24 +00:00
|
|
|
/* if the caps contain pixel-aspect-ratio, they have to match ours,
|
|
|
|
* otherwise linking should fail */
|
|
|
|
par = gst_structure_get_value (structure, "pixel-aspect-ratio");
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
if (par) {
|
|
|
|
if (ximagesink->par) {
|
|
|
|
if (gst_value_compare (par, ximagesink->par) != GST_VALUE_EQUAL) {
|
|
|
|
goto wrong_aspect;
|
|
|
|
}
|
|
|
|
} else if (ximagesink->xcontext->par) {
|
|
|
|
if (gst_value_compare (par, ximagesink->xcontext->par) != GST_VALUE_EQUAL) {
|
|
|
|
goto wrong_aspect;
|
|
|
|
}
|
|
|
|
}
|
check/: Add extra tests for basetransform based components.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite):
Add extra tests for basetransform based components.
Comment out the test_element_negotiation test until we decide
if it's testing correct behaviour.
* ext/libvisual/visual.c: (gst_visual_init), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Slightly more correct but still bogus timestamping.
Fix state change function.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init):
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_class_init):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_prepare_size), (gst_videoscale_set_caps),
(gst_videoscale_prepare_image):
* gst/volume/gstvolume.c: (gst_volume_class_init),
(volume_transform_ip):
Basetransform updates. Enable passthrough modes.
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
Negotiation fix that allows the window to return to the original
size and renegotiate passthrough upstream. Extra debug output.
2005-09-09 17:53:47 +00:00
|
|
|
}
|
|
|
|
|
2011-06-17 13:31:59 +00:00
|
|
|
GST_VIDEO_SINK_WIDTH (ximagesink) = info.width;
|
|
|
|
GST_VIDEO_SINK_HEIGHT (ximagesink) = info.height;
|
|
|
|
ximagesink->fps_n = info.fps_n;
|
|
|
|
ximagesink->fps_d = info.fps_d;
|
check/: Add extra tests for basetransform based components.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite):
Add extra tests for basetransform based components.
Comment out the test_element_negotiation test until we decide
if it's testing correct behaviour.
* ext/libvisual/visual.c: (gst_visual_init), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Slightly more correct but still bogus timestamping.
Fix state change function.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init):
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_class_init):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_prepare_size), (gst_videoscale_set_caps),
(gst_videoscale_prepare_image):
* gst/volume/gstvolume.c: (gst_volume_class_init),
(volume_transform_ip):
Basetransform updates. Enable passthrough modes.
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
Negotiation fix that allows the window to return to the original
size and renegotiate passthrough upstream. Extra debug output.
2005-09-09 17:53:47 +00:00
|
|
|
|
2005-11-22 11:13:49 +00:00
|
|
|
/* Notify application to set xwindow id now */
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
2005-11-22 11:13:49 +00:00
|
|
|
if (!ximagesink->xwindow) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2011-08-08 09:44:17 +00:00
|
|
|
gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (ximagesink));
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
} else {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2005-11-22 11:13:49 +00:00
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
/* Creating our window and our image */
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
if (GST_VIDEO_SINK_WIDTH (ximagesink) <= 0 ||
|
2011-03-03 15:48:23 +00:00
|
|
|
GST_VIDEO_SINK_HEIGHT (ximagesink) <= 0)
|
|
|
|
goto invalid_size;
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
sys/: Getting the 2 video sinks synchronized again. Using internal data pointer of the x(v)image to store image's dat...
Original commit message from CVS:
2004-07-16 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_handle_xerror),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_sink_link),
(gst_ximagesink_chain), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_chain), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc):
* sys/xvimage/xvimagesink.h: Getting the 2 video sinks synchronized
again. Using internal data pointer of the x(v)image to store image's
data to be coherent with the buffer alloc mechanism. Investigated the
image destruction code to be sure that everything gets freed correctly.
2004-07-16 10:48:52 +00:00
|
|
|
if (!ximagesink->xwindow) {
|
2015-07-03 19:48:52 +00:00
|
|
|
ximagesink->xwindow = gst_x_image_sink_xwindow_new (ximagesink,
|
2005-07-10 12:03:58 +00:00
|
|
|
GST_VIDEO_SINK_WIDTH (ximagesink), GST_VIDEO_SINK_HEIGHT (ximagesink));
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
2011-06-22 13:38:24 +00:00
|
|
|
|
|
|
|
ximagesink->info = info;
|
|
|
|
|
2008-06-24 01:14:40 +00:00
|
|
|
/* Remember to draw borders for next frame */
|
|
|
|
ximagesink->draw_border = TRUE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-06-05 18:28:41 +00:00
|
|
|
/* create a new internal pool for the new configuration */
|
2015-07-03 19:48:52 +00:00
|
|
|
newpool = gst_x_image_sink_create_pool (ximagesink, caps, info.size, 2);
|
2011-03-03 15:48:23 +00:00
|
|
|
|
2015-06-05 18:28:41 +00:00
|
|
|
/* we don't activate the internal pool yet as it may not be needed */
|
2011-03-03 15:48:23 +00:00
|
|
|
oldpool = ximagesink->pool;
|
|
|
|
ximagesink->pool = newpool;
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2011-03-03 15:48:23 +00:00
|
|
|
|
2015-06-05 18:28:41 +00:00
|
|
|
/* deactivate and unref the old internal pool */
|
2011-03-03 15:48:23 +00:00
|
|
|
if (oldpool) {
|
2015-06-05 18:28:41 +00:00
|
|
|
gst_buffer_pool_set_active (oldpool, FALSE);
|
2011-03-03 15:48:23 +00:00
|
|
|
gst_object_unref (oldpool);
|
|
|
|
}
|
2011-04-06 10:26:47 +00:00
|
|
|
|
2005-04-25 07:06:09 +00:00
|
|
|
return TRUE;
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
2010-05-06 05:15:16 +00:00
|
|
|
incompatible_caps:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (ximagesink, "caps incompatible");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-06-17 13:31:59 +00:00
|
|
|
invalid_format:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (ximagesink, "caps invalid");
|
|
|
|
return FALSE;
|
|
|
|
}
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
wrong_aspect:
|
|
|
|
{
|
|
|
|
GST_INFO_OBJECT (ximagesink, "pixel aspect ratio does not match");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-03-03 15:48:23 +00:00
|
|
|
invalid_size:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (ximagesink, CORE, NEGOTIATION, (NULL),
|
|
|
|
("Invalid image size."));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_change_state (GstElement * element, GstStateChange transition)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2011-04-06 10:26:47 +00:00
|
|
|
GstXImageSink *ximagesink;
|
2006-07-13 16:34:04 +00:00
|
|
|
GstXContext *xcontext = NULL;
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
ximagesink = GST_X_IMAGE_SINK (element);
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2003-11-11 11:32:27 +00:00
|
|
|
/* Initializing the XContext */
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
if (ximagesink->xcontext == NULL) {
|
2015-07-03 19:48:52 +00:00
|
|
|
xcontext = gst_x_image_sink_xcontext_get (ximagesink);
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
if (xcontext == NULL) {
|
|
|
|
ret = GST_STATE_CHANGE_FAILURE;
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
GST_OBJECT_LOCK (ximagesink);
|
|
|
|
if (xcontext)
|
|
|
|
ximagesink->xcontext = xcontext;
|
|
|
|
GST_OBJECT_UNLOCK (ximagesink);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
}
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
|
2004-07-19 11:33:32 +00:00
|
|
|
/* call XSynchronize with the current value of synchronous */
|
|
|
|
GST_DEBUG_OBJECT (ximagesink, "XSynchronize called with %s",
|
|
|
|
ximagesink->synchronous ? "TRUE" : "FALSE");
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-07-19 11:33:32 +00:00
|
|
|
XSynchronize (ximagesink->xcontext->disp, ximagesink->synchronous);
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_manage_event_thread (ximagesink);
|
2003-11-11 11:32:27 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
if (ximagesink->xwindow)
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_clear (ximagesink, ximagesink->xwindow);
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2003-11-11 11:32:27 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2003-11-11 11:32:27 +00:00
|
|
|
break;
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2003-11-11 11:32:27 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
ximagesink->fps_n = 0;
|
|
|
|
ximagesink->fps_d = 1;
|
2005-07-10 12:03:58 +00:00
|
|
|
GST_VIDEO_SINK_WIDTH (ximagesink) = 0;
|
|
|
|
GST_VIDEO_SINK_HEIGHT (ximagesink) = 0;
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
2011-04-06 14:26:12 +00:00
|
|
|
if (ximagesink->pool)
|
|
|
|
gst_buffer_pool_set_active (ximagesink->pool, FALSE);
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2003-11-11 11:32:27 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_reset (ximagesink);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
break;
|
|
|
|
default:
|
2003-11-11 11:32:27 +00:00
|
|
|
break;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
beach:
|
|
|
|
return ret;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
|
2005-04-25 07:06:09 +00:00
|
|
|
GstClockTime * start, GstClockTime * end)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
ximagesink = GST_X_IMAGE_SINK (bsink);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2005-04-25 07:06:09 +00:00
|
|
|
if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
|
|
|
|
*start = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (buf)) {
|
|
|
|
*end = *start + GST_BUFFER_DURATION (buf);
|
|
|
|
} else {
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
if (ximagesink->fps_n > 0) {
|
2006-09-18 15:48:01 +00:00
|
|
|
*end = *start +
|
|
|
|
gst_util_uint64_scale_int (GST_SECOND, ximagesink->fps_d,
|
|
|
|
ximagesink->fps_n);
|
2005-04-25 07:06:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
2005-04-25 07:06:09 +00:00
|
|
|
{
|
2011-03-03 15:48:23 +00:00
|
|
|
GstFlowReturn res;
|
2005-04-25 07:06:09 +00:00
|
|
|
GstXImageSink *ximagesink;
|
2013-02-26 15:02:41 +00:00
|
|
|
GstXImageMemory *mem;
|
2011-06-20 15:36:24 +00:00
|
|
|
GstBuffer *to_put = NULL;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
ximagesink = GST_X_IMAGE_SINK (vsink);
|
2005-04-25 07:06:09 +00:00
|
|
|
|
2013-02-26 15:02:41 +00:00
|
|
|
if (gst_buffer_n_memory (buf) == 1
|
|
|
|
&& (mem = (GstXImageMemory *) gst_buffer_peek_memory (buf, 0))
|
|
|
|
&& g_strcmp0 (mem->parent.allocator->mem_type, "ximage") == 0
|
|
|
|
&& mem->sink == ximagesink) {
|
2011-02-25 15:01:47 +00:00
|
|
|
/* If this buffer has been allocated using our buffer management we simply
|
|
|
|
put the ximage which is in the PRIVATE pointer */
|
2004-07-27 16:43:24 +00:00
|
|
|
GST_LOG_OBJECT (ximagesink, "buffer from our pool, writing directly");
|
2011-06-20 15:36:24 +00:00
|
|
|
to_put = buf;
|
2011-03-03 15:48:23 +00:00
|
|
|
res = GST_FLOW_OK;
|
2011-02-25 15:01:47 +00:00
|
|
|
} else {
|
2011-06-22 13:38:24 +00:00
|
|
|
GstVideoFrame src, dest;
|
2012-08-10 09:45:38 +00:00
|
|
|
GstBufferPoolAcquireParams params = { 0, };
|
2011-03-03 15:48:23 +00:00
|
|
|
|
sys/: Getting the 2 video sinks synchronized again. Using internal data pointer of the x(v)image to store image's dat...
Original commit message from CVS:
2004-07-16 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_handle_xerror),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_sink_link),
(gst_ximagesink_chain), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_chain), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc):
* sys/xvimage/xvimagesink.h: Getting the 2 video sinks synchronized
again. Using internal data pointer of the x(v)image to store image's
data to be coherent with the buffer alloc mechanism. Investigated the
image destruction code to be sure that everything gets freed correctly.
2004-07-16 10:48:52 +00:00
|
|
|
/* Else we have to copy the data into our private image, */
|
2004-03-14 22:34:34 +00:00
|
|
|
/* if we have one... */
|
2011-03-03 15:48:23 +00:00
|
|
|
GST_LOG_OBJECT (ximagesink, "buffer not from our pool, copying");
|
|
|
|
|
2015-06-05 18:28:41 +00:00
|
|
|
/* an internal pool should have been created in setcaps */
|
|
|
|
if (G_UNLIKELY (ximagesink->pool == NULL))
|
2011-03-03 15:48:23 +00:00
|
|
|
goto no_pool;
|
|
|
|
|
2011-06-20 15:36:24 +00:00
|
|
|
if (!gst_buffer_pool_set_active (ximagesink->pool, TRUE))
|
|
|
|
goto activate_failed;
|
|
|
|
|
2012-08-10 09:45:38 +00:00
|
|
|
/* take a buffer from our pool, if there is no buffer in the pool something
|
|
|
|
* is seriously wrong, waiting for the pool here might deadlock when we try
|
|
|
|
* to go to PAUSED because we never flush the pool. */
|
|
|
|
params.flags = GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT;
|
|
|
|
res = gst_buffer_pool_acquire_buffer (ximagesink->pool, &to_put, ¶ms);
|
2011-03-03 15:48:23 +00:00
|
|
|
if (res != GST_FLOW_OK)
|
|
|
|
goto no_buffer;
|
|
|
|
|
2016-02-20 11:31:43 +00:00
|
|
|
GST_CAT_LOG_OBJECT (CAT_PERFORMANCE, ximagesink,
|
2011-06-22 13:38:24 +00:00
|
|
|
"slow copy into bufferpool buffer %p", to_put);
|
|
|
|
|
|
|
|
if (!gst_video_frame_map (&src, &ximagesink->info, buf, GST_MAP_READ))
|
|
|
|
goto invalid_buffer;
|
|
|
|
|
|
|
|
if (!gst_video_frame_map (&dest, &ximagesink->info, to_put, GST_MAP_WRITE)) {
|
|
|
|
gst_video_frame_unmap (&src);
|
|
|
|
goto invalid_buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_video_frame_copy (&dest, &src);
|
|
|
|
|
|
|
|
gst_video_frame_unmap (&dest);
|
|
|
|
gst_video_frame_unmap (&src);
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
if (!gst_x_image_sink_ximage_put (ximagesink, to_put))
|
2011-03-03 15:48:23 +00:00
|
|
|
goto no_window;
|
|
|
|
|
2011-04-06 14:26:12 +00:00
|
|
|
done:
|
2011-06-20 15:36:24 +00:00
|
|
|
if (to_put != buf)
|
|
|
|
gst_buffer_unref (to_put);
|
2011-04-06 14:26:12 +00:00
|
|
|
|
2011-03-03 15:48:23 +00:00
|
|
|
return res;
|
gst/tcp/: 0.8 backporting.
Original commit message from CVS:
* gst/tcp/gstfdset.c: (gst_fdset_free):
* gst/tcp/gstmultifdsink.c: (gst_multifdsink_init),
(gst_multifdsink_add), (gst_multifdsink_remove),
(gst_multifdsink_clear), (gst_multifdsink_get_stats),
(gst_multifdsink_remove_client_link),
(gst_multifdsink_client_queue_data),
(gst_multifdsink_client_queue_caps),
(gst_multifdsink_client_queue_buffer),
(gst_multifdsink_queue_buffer), (gst_multifdsink_handle_clients),
(gst_multifdsink_stop):
* gst/tcp/gstmultifdsink.h:
0.8 backporting.
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame):
Also draw image when not from a pool.
2005-07-14 18:22:13 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
2011-03-03 15:48:23 +00:00
|
|
|
no_pool:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
|
|
|
|
("Internal error: can't allocate images"),
|
|
|
|
("We don't have a bufferpool negotiated"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
no_buffer:
|
gst/tcp/: 0.8 backporting.
Original commit message from CVS:
* gst/tcp/gstfdset.c: (gst_fdset_free):
* gst/tcp/gstmultifdsink.c: (gst_multifdsink_init),
(gst_multifdsink_add), (gst_multifdsink_remove),
(gst_multifdsink_clear), (gst_multifdsink_get_stats),
(gst_multifdsink_remove_client_link),
(gst_multifdsink_client_queue_data),
(gst_multifdsink_client_queue_caps),
(gst_multifdsink_client_queue_buffer),
(gst_multifdsink_queue_buffer), (gst_multifdsink_handle_clients),
(gst_multifdsink_stop):
* gst/tcp/gstmultifdsink.h:
0.8 backporting.
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame):
Also draw image when not from a pool.
2005-07-14 18:22:13 +00:00
|
|
|
{
|
|
|
|
/* No image available. That's very bad ! */
|
2009-09-08 16:43:26 +00:00
|
|
|
GST_WARNING_OBJECT (ximagesink, "could not create image");
|
2012-08-10 09:45:38 +00:00
|
|
|
return GST_FLOW_OK;
|
2011-03-03 15:48:23 +00:00
|
|
|
}
|
2011-06-22 13:38:24 +00:00
|
|
|
invalid_buffer:
|
|
|
|
{
|
|
|
|
/* No Window available to put our image into */
|
2012-08-10 09:45:38 +00:00
|
|
|
GST_WARNING_OBJECT (ximagesink, "could not map image");
|
2011-06-22 13:38:24 +00:00
|
|
|
res = GST_FLOW_OK;
|
|
|
|
goto done;
|
|
|
|
}
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
no_window:
|
|
|
|
{
|
|
|
|
/* No Window available to put our image into */
|
|
|
|
GST_WARNING_OBJECT (ximagesink, "could not output image - no window");
|
2011-04-06 14:26:12 +00:00
|
|
|
res = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
sys/: When we create our own window, indicate that we handle the
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_handle_xevents),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_show_frame):
When we create our own window, indicate that we handle the
WM_DELETE client message from the window manager, so that it won't
kill our window (and our app) along with it. Handle ClientMessage,
post an error on the bus, and close the window. Further buffers
arriving will result in a FlowError because the window has been
destroyed.
Fixes: #393975
Clean up the X event handling loop and make them the same for
both xvimagesink and ximagesink while I'm at it.
2007-05-17 17:35:46 +00:00
|
|
|
}
|
2011-06-20 15:36:24 +00:00
|
|
|
activate_failed:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (ximagesink, "failed to activate bufferpool.");
|
|
|
|
res = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
2009-06-22 08:40:33 +00:00
|
|
|
static gboolean
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_event (GstBaseSink * sink, GstEvent * event)
|
2009-06-22 08:40:33 +00:00
|
|
|
{
|
2015-07-03 19:48:52 +00:00
|
|
|
GstXImageSink *ximagesink = GST_X_IMAGE_SINK (sink);
|
2009-06-22 08:40:33 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_TAG:{
|
|
|
|
GstTagList *l;
|
|
|
|
gchar *title = NULL;
|
|
|
|
|
|
|
|
gst_event_parse_tag (event, &l);
|
|
|
|
gst_tag_list_get_string (l, GST_TAG_TITLE, &title);
|
|
|
|
|
|
|
|
if (title) {
|
|
|
|
GST_DEBUG_OBJECT (ximagesink, "got tags, title='%s'", title);
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_set_title (ximagesink, ximagesink->xwindow,
|
2009-06-22 13:17:10 +00:00
|
|
|
title);
|
2009-06-22 08:40:33 +00:00
|
|
|
|
|
|
|
g_free (title);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2011-12-02 21:24:43 +00:00
|
|
|
return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
|
2009-06-22 08:40:33 +00:00
|
|
|
}
|
|
|
|
|
2011-05-19 13:56:57 +00:00
|
|
|
static gboolean
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
2011-05-19 13:56:57 +00:00
|
|
|
{
|
2015-07-03 19:48:52 +00:00
|
|
|
GstXImageSink *ximagesink = GST_X_IMAGE_SINK (bsink);
|
2015-06-05 18:28:41 +00:00
|
|
|
GstBufferPool *pool = NULL;
|
2011-07-26 11:17:20 +00:00
|
|
|
GstCaps *caps;
|
2017-09-06 17:55:13 +00:00
|
|
|
GstVideoInfo info;
|
2011-07-26 11:17:20 +00:00
|
|
|
guint size;
|
|
|
|
gboolean need_pool;
|
2011-05-19 13:56:57 +00:00
|
|
|
|
2011-07-26 11:17:20 +00:00
|
|
|
gst_query_parse_allocation (query, &caps, &need_pool);
|
2011-05-19 13:56:57 +00:00
|
|
|
|
2011-07-26 11:17:20 +00:00
|
|
|
if (caps == NULL)
|
|
|
|
goto no_caps;
|
2011-05-19 13:56:57 +00:00
|
|
|
|
2017-09-06 17:55:13 +00:00
|
|
|
if (!gst_video_info_from_caps (&info, caps))
|
|
|
|
goto invalid_caps;
|
2011-05-19 13:56:57 +00:00
|
|
|
|
2017-09-06 17:55:13 +00:00
|
|
|
/* the normal size of a frame */
|
|
|
|
size = info.size;
|
2011-05-19 13:56:57 +00:00
|
|
|
|
2017-09-06 17:55:13 +00:00
|
|
|
if (need_pool) {
|
2015-07-03 19:48:52 +00:00
|
|
|
pool = gst_x_image_sink_create_pool (ximagesink, caps, info.size, 0);
|
2012-06-18 10:17:12 +00:00
|
|
|
|
2015-06-05 18:28:41 +00:00
|
|
|
if (pool == NULL)
|
|
|
|
goto no_pool;
|
2011-05-19 13:56:57 +00:00
|
|
|
}
|
2015-06-05 18:28:41 +00:00
|
|
|
|
2017-09-06 17:55:13 +00:00
|
|
|
/* we need at least 2 buffer because we hold on to the last one */
|
|
|
|
gst_query_add_allocation_pool (query, pool, size, 2, 0);
|
|
|
|
if (pool)
|
2012-06-15 14:43:47 +00:00
|
|
|
gst_object_unref (pool);
|
2011-07-26 11:17:20 +00:00
|
|
|
|
|
|
|
/* we also support various metadata */
|
2012-07-06 09:50:44 +00:00
|
|
|
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
|
|
|
|
gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE, NULL);
|
2011-07-26 11:17:20 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2011-05-19 13:56:57 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_caps:
|
|
|
|
{
|
2011-07-26 11:17:20 +00:00
|
|
|
GST_DEBUG_OBJECT (bsink, "no caps specified");
|
2011-05-19 13:56:57 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
invalid_caps:
|
|
|
|
{
|
2011-07-26 11:17:20 +00:00
|
|
|
GST_DEBUG_OBJECT (bsink, "invalid caps specified");
|
2011-05-19 13:56:57 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2015-06-05 18:28:41 +00:00
|
|
|
no_pool:
|
2011-05-19 13:56:57 +00:00
|
|
|
{
|
2015-06-05 18:28:41 +00:00
|
|
|
/* Already warned in create_pool */
|
2011-05-19 13:56:57 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-17 16:32:29 +00:00
|
|
|
/* Interfaces stuff */
|
2005-02-15 14:12:11 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_navigation_send_event (GstNavigation * navigation,
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
GstStructure * structure)
|
2005-02-15 14:12:11 +00:00
|
|
|
{
|
2015-07-03 19:48:52 +00:00
|
|
|
GstXImageSink *ximagesink = GST_X_IMAGE_SINK (navigation);
|
2015-07-07 10:35:40 +00:00
|
|
|
GstEvent *event = NULL;
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
gint x_offset, y_offset;
|
|
|
|
gdouble x, y;
|
2015-07-07 10:45:43 +00:00
|
|
|
gboolean handled = FALSE;
|
2005-02-15 14:12:11 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
/* We are not converting the pointer coordinates as there's no hardware
|
|
|
|
scaling done here. The only possible scaling is done by videoscale and
|
|
|
|
videoscale will have to catch those events and tranform the coordinates
|
|
|
|
to match the applied scaling. So here we just add the offset if the image
|
|
|
|
is centered in the window. */
|
2005-02-15 14:12:11 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
/* We take the flow_lock while we look at the window */
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
2005-02-15 14:12:11 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
if (!ximagesink->xwindow) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2015-11-17 00:06:34 +00:00
|
|
|
gst_structure_free (structure);
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
return;
|
2005-02-15 14:12:11 +00:00
|
|
|
}
|
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
x_offset = ximagesink->xwindow->width - GST_VIDEO_SINK_WIDTH (ximagesink);
|
|
|
|
y_offset = ximagesink->xwindow->height - GST_VIDEO_SINK_HEIGHT (ximagesink);
|
2005-02-15 14:12:11 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2005-01-09 00:07:30 +00:00
|
|
|
|
2009-04-14 11:10:30 +00:00
|
|
|
if (x_offset > 0 && gst_structure_get_double (structure, "pointer_x", &x)) {
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
x -= x_offset / 2;
|
|
|
|
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
|
|
|
|
}
|
2009-04-14 11:10:30 +00:00
|
|
|
if (y_offset > 0 && gst_structure_get_double (structure, "pointer_y", &y)) {
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
y -= y_offset / 2;
|
|
|
|
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
|
|
|
|
}
|
|
|
|
|
2015-07-07 10:35:40 +00:00
|
|
|
event = gst_event_new_navigation (structure);
|
2015-07-07 10:45:43 +00:00
|
|
|
if (event) {
|
|
|
|
gst_event_ref (event);
|
|
|
|
handled = gst_pad_push_event (GST_VIDEO_SINK_PAD (ximagesink), event);
|
|
|
|
|
|
|
|
if (!handled)
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (ximagesink),
|
|
|
|
gst_navigation_message_new_event (GST_OBJECT_CAST (ximagesink),
|
|
|
|
event));
|
|
|
|
|
|
|
|
gst_event_unref (event);
|
|
|
|
}
|
2003-11-17 16:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_navigation_init (GstNavigationInterface * iface)
|
2003-11-17 16:32:29 +00:00
|
|
|
{
|
2015-07-03 19:48:52 +00:00
|
|
|
iface->send_event = gst_x_image_sink_navigation_send_event;
|
2003-11-17 16:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_set_window_handle (GstVideoOverlay * overlay, guintptr id)
|
2003-11-17 16:32:29 +00:00
|
|
|
{
|
2010-09-05 22:17:47 +00:00
|
|
|
XID xwindow_id = id;
|
2015-07-03 19:48:52 +00:00
|
|
|
GstXImageSink *ximagesink = GST_X_IMAGE_SINK (overlay);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
GstXWindow *xwindow = NULL;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
/* We acquire the stream lock while setting this window in the element.
|
|
|
|
We are basically cleaning tons of stuff replacing the old window, putting
|
|
|
|
images while we do that would surely crash */
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* If we already use that window return */
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
if (ximagesink->xwindow && (xwindow_id == ximagesink->xwindow->win)) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
return;
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* If the element has not initialized the X11 context try to do so */
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
if (!ximagesink->xcontext &&
|
2015-07-03 19:48:52 +00:00
|
|
|
!(ximagesink->xcontext = gst_x_image_sink_xcontext_get (ximagesink))) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
/* we have thrown a GST_ELEMENT_ERROR now */
|
2004-03-14 22:34:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* If a window is there already we destroy it */
|
2004-03-14 22:34:34 +00:00
|
|
|
if (ximagesink->xwindow) {
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_destroy (ximagesink, ximagesink->xwindow);
|
2004-03-14 22:34:34 +00:00
|
|
|
ximagesink->xwindow = NULL;
|
|
|
|
}
|
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* If the xid is 0 we go back to an internal window */
|
2004-03-14 22:34:34 +00:00
|
|
|
if (xwindow_id == 0) {
|
|
|
|
/* If no width/height caps nego did not happen window will be created
|
|
|
|
during caps nego then */
|
2005-07-10 12:03:58 +00:00
|
|
|
if (GST_VIDEO_SINK_WIDTH (ximagesink) && GST_VIDEO_SINK_HEIGHT (ximagesink)) {
|
2015-07-03 19:48:52 +00:00
|
|
|
xwindow = gst_x_image_sink_xwindow_new (ximagesink,
|
2005-07-10 12:03:58 +00:00
|
|
|
GST_VIDEO_SINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEO_SINK_HEIGHT (ximagesink));
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
|
|
|
xwindow = g_new0 (GstXWindow, 1);
|
|
|
|
|
|
|
|
xwindow->win = xwindow_id;
|
|
|
|
|
2016-04-21 06:45:40 +00:00
|
|
|
/* We set the events we want to receive and create a GC. */
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
xwindow->internal = FALSE;
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
if (ximagesink->handle_events) {
|
|
|
|
XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask |
|
|
|
|
StructureNotifyMask | PointerMotionMask | KeyPressMask |
|
|
|
|
KeyReleaseMask);
|
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
xwindow->gc = XCreateGC (ximagesink->xcontext->disp, xwindow->win, 0, NULL);
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
|
|
|
|
2016-04-21 06:45:40 +00:00
|
|
|
if (xwindow) {
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
ximagesink->xwindow = xwindow;
|
2016-04-21 06:45:40 +00:00
|
|
|
/* Update the window geometry, possibly generating a reconfigure event. */
|
2017-01-09 19:02:57 +00:00
|
|
|
gst_x_image_sink_xwindow_update_geometry (ximagesink);
|
2016-04-21 06:45:40 +00:00
|
|
|
}
|
sys/ximage/ximagesink.c: Protect interface methods from chain and negotiation and vice versa (Fixes #166142).
Original commit message from CVS:
2005-02-12 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_sink_link), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_property),
(gst_ximagesink_finalize), (gst_ximagesink_init): Protect interface
methods from chain and negotiation and vice versa (Fixes #166142).
* sys/ximage/ximagesink.h: Add stream_lock.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_sink_link),
(gst_xvimagesink_chain), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose): Check for xcontext before trying to link.
2005-02-12 18:41:49 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2004-01-04 18:53:53 +00:00
|
|
|
}
|
|
|
|
|
2004-02-03 23:05:46 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_expose (GstVideoOverlay * overlay)
|
2004-02-03 23:05:46 +00:00
|
|
|
{
|
2015-07-03 19:48:52 +00:00
|
|
|
GstXImageSink *ximagesink = GST_X_IMAGE_SINK (overlay);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_update_geometry (ximagesink);
|
|
|
|
gst_x_image_sink_ximage_put (ximagesink, NULL);
|
2004-02-03 23:05:46 +00:00
|
|
|
}
|
|
|
|
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_set_event_handling (GstVideoOverlay * overlay,
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
gboolean handle_events)
|
|
|
|
{
|
2015-07-03 19:48:52 +00:00
|
|
|
GstXImageSink *ximagesink = GST_X_IMAGE_SINK (overlay);
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
|
|
|
|
ximagesink->handle_events = handle_events;
|
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (!ximagesink->xwindow)) {
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
return;
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
}
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
|
|
|
|
if (handle_events) {
|
|
|
|
if (ximagesink->xwindow->internal) {
|
|
|
|
XSelectInput (ximagesink->xcontext->disp, ximagesink->xwindow->win,
|
|
|
|
ExposureMask | StructureNotifyMask | PointerMotionMask |
|
|
|
|
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
|
|
|
|
} else {
|
|
|
|
XSelectInput (ximagesink->xcontext->disp, ximagesink->xwindow->win,
|
|
|
|
ExposureMask | StructureNotifyMask | PointerMotionMask |
|
|
|
|
KeyPressMask | KeyReleaseMask);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
XSelectInput (ximagesink->xcontext->disp, ximagesink->xwindow->win, 0);
|
|
|
|
}
|
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
2007-01-07 18:50:13 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
}
|
|
|
|
|
2003-11-17 16:32:29 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_video_overlay_init (GstVideoOverlayInterface * iface)
|
2003-11-17 16:32:29 +00:00
|
|
|
{
|
2015-07-03 19:48:52 +00:00
|
|
|
iface->set_window_handle = gst_x_image_sink_set_window_handle;
|
|
|
|
iface->expose = gst_x_image_sink_expose;
|
|
|
|
iface->handle_events = gst_x_image_sink_set_event_handling;
|
2003-11-17 16:32:29 +00:00
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
/* =========================================== */
|
|
|
|
/* */
|
|
|
|
/* Init & Class init */
|
|
|
|
/* */
|
|
|
|
/* =========================================== */
|
|
|
|
|
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
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_set_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
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
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_if_fail (GST_IS_X_IMAGE_SINK (object));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
ximagesink = GST_X_IMAGE_SINK (object);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-04-25 07:06:09 +00:00
|
|
|
case PROP_DISPLAY:
|
2004-03-14 22:34:34 +00:00
|
|
|
ximagesink->display_name = g_strdup (g_value_get_string (value));
|
|
|
|
break;
|
2005-04-25 07:06:09 +00:00
|
|
|
case PROP_SYNCHRONOUS:
|
2004-03-14 22:34:34 +00:00
|
|
|
ximagesink->synchronous = g_value_get_boolean (value);
|
|
|
|
if (ximagesink->xcontext) {
|
2004-07-19 11:33:32 +00:00
|
|
|
GST_DEBUG_OBJECT (ximagesink, "XSynchronize called with %s",
|
|
|
|
ximagesink->synchronous ? "TRUE" : "FALSE");
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->x_lock);
|
2004-03-15 19:32:28 +00:00
|
|
|
XSynchronize (ximagesink->xcontext->disp, ximagesink->synchronous);
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->x_lock);
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
|
|
|
break;
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
case PROP_FORCE_ASPECT_RATIO:
|
|
|
|
ximagesink->keep_aspect = g_value_get_boolean (value);
|
|
|
|
break;
|
2005-04-25 07:06:09 +00:00
|
|
|
case PROP_PIXEL_ASPECT_RATIO:
|
2005-11-20 17:11:06 +00:00
|
|
|
{
|
|
|
|
GValue *tmp;
|
|
|
|
|
|
|
|
tmp = g_new0 (GValue, 1);
|
|
|
|
g_value_init (tmp, GST_TYPE_FRACTION);
|
|
|
|
|
|
|
|
if (!g_value_transform (value, tmp)) {
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
GST_WARNING_OBJECT (ximagesink,
|
|
|
|
"Could not transform string to aspect ratio");
|
2005-11-20 17:11:06 +00:00
|
|
|
g_free (tmp);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ximagesink, "set PAR to %d/%d",
|
|
|
|
gst_value_get_fraction_numerator (tmp),
|
|
|
|
gst_value_get_fraction_denominator (tmp));
|
|
|
|
g_free (ximagesink->par);
|
|
|
|
ximagesink->par = tmp;
|
2004-07-28 21:28:34 +00:00
|
|
|
}
|
2005-11-20 17:11:06 +00:00
|
|
|
}
|
2004-07-27 16:43:24 +00:00
|
|
|
break;
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
case PROP_HANDLE_EVENTS:
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_set_event_handling (GST_VIDEO_OVERLAY (ximagesink),
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
g_value_get_boolean (value));
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_manage_event_thread (ximagesink);
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
break;
|
2007-07-14 18:20:41 +00:00
|
|
|
case PROP_HANDLE_EXPOSE:
|
|
|
|
ximagesink->handle_expose = g_value_get_boolean (value);
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_manage_event_thread (ximagesink);
|
2007-07-14 18:20:41 +00:00
|
|
|
break;
|
2004-03-14 22:34:34 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_get_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
GValue * value, GParamSpec * pspec)
|
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
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
g_return_if_fail (GST_IS_X_IMAGE_SINK (object));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
ximagesink = GST_X_IMAGE_SINK (object);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-04-25 07:06:09 +00:00
|
|
|
case PROP_DISPLAY:
|
2006-08-15 19:20:16 +00:00
|
|
|
g_value_set_string (value, ximagesink->display_name);
|
2004-03-14 22:34:34 +00:00
|
|
|
break;
|
2005-04-25 07:06:09 +00:00
|
|
|
case PROP_SYNCHRONOUS:
|
2004-03-14 22:34:34 +00:00
|
|
|
g_value_set_boolean (value, ximagesink->synchronous);
|
|
|
|
break;
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
case PROP_FORCE_ASPECT_RATIO:
|
|
|
|
g_value_set_boolean (value, ximagesink->keep_aspect);
|
|
|
|
break;
|
2005-04-25 07:06:09 +00:00
|
|
|
case PROP_PIXEL_ASPECT_RATIO:
|
2004-07-28 21:28:34 +00:00
|
|
|
if (ximagesink->par)
|
|
|
|
g_value_transform (ximagesink->par, value);
|
2004-07-27 16:43:24 +00:00
|
|
|
break;
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
case PROP_HANDLE_EVENTS:
|
|
|
|
g_value_set_boolean (value, ximagesink->handle_events);
|
|
|
|
break;
|
2007-07-14 18:20:41 +00:00
|
|
|
case PROP_HANDLE_EXPOSE:
|
|
|
|
g_value_set_boolean (value, ximagesink->handle_expose);
|
|
|
|
break;
|
2010-10-25 13:08:43 +00:00
|
|
|
case PROP_WINDOW_WIDTH:
|
|
|
|
if (ximagesink->xwindow)
|
|
|
|
g_value_set_uint64 (value, ximagesink->xwindow->width);
|
|
|
|
else
|
|
|
|
g_value_set_uint64 (value, 0);
|
|
|
|
break;
|
|
|
|
case PROP_WINDOW_HEIGHT:
|
|
|
|
if (ximagesink->xwindow)
|
|
|
|
g_value_set_uint64 (value, ximagesink->xwindow->height);
|
|
|
|
else
|
|
|
|
g_value_set_uint64 (value, 0);
|
|
|
|
break;
|
2004-03-14 22:34:34 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2007-03-08 15:22:53 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_reset (GstXImageSink * ximagesink)
|
2007-03-08 15:22:53 +00:00
|
|
|
{
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
GThread *thread;
|
|
|
|
|
2007-03-08 15:22:53 +00:00
|
|
|
GST_OBJECT_LOCK (ximagesink);
|
|
|
|
ximagesink->running = FALSE;
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
/* grab thread and mark it as NULL */
|
|
|
|
thread = ximagesink->event_thread;
|
|
|
|
ximagesink->event_thread = NULL;
|
2007-03-08 15:22:53 +00:00
|
|
|
GST_OBJECT_UNLOCK (ximagesink);
|
|
|
|
|
sys/: Make sure that before we clean up the X resources, we shutdown and join the event thread.
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_reset):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_event_thread),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_change_state), (gst_xvimagesink_reset):
Make sure that before we clean up the X resources, we shutdown and join
the event thread.
Also make sure the event thread does not shut down immediatly after
startup because the running variable is not yet correctly set.
Fixes #378770.
2007-10-22 10:21:46 +00:00
|
|
|
/* Wait for our event thread to finish before we clean up our stuff. */
|
|
|
|
if (thread)
|
|
|
|
g_thread_join (thread);
|
|
|
|
|
2007-03-08 15:22:53 +00:00
|
|
|
if (ximagesink->cur_image) {
|
2011-04-06 10:26:47 +00:00
|
|
|
gst_buffer_unref (ximagesink->cur_image);
|
2007-03-08 15:22:53 +00:00
|
|
|
ximagesink->cur_image = NULL;
|
|
|
|
}
|
2011-03-04 09:21:52 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_lock (&ximagesink->flow_lock);
|
2011-04-06 10:26:47 +00:00
|
|
|
|
2011-03-04 09:21:52 +00:00
|
|
|
if (ximagesink->pool) {
|
|
|
|
gst_object_unref (ximagesink->pool);
|
|
|
|
ximagesink->pool = NULL;
|
|
|
|
}
|
2007-03-08 15:22:53 +00:00
|
|
|
|
|
|
|
if (ximagesink->xwindow) {
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xwindow_clear (ximagesink, ximagesink->xwindow);
|
|
|
|
gst_x_image_sink_xwindow_destroy (ximagesink, ximagesink->xwindow);
|
2007-03-08 15:22:53 +00:00
|
|
|
ximagesink->xwindow = NULL;
|
|
|
|
}
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_unlock (&ximagesink->flow_lock);
|
2007-03-08 15:22:53 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_xcontext_clear (ximagesink);
|
2007-03-08 15:22:53 +00:00
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_finalize (GObject * object)
|
2003-11-11 11:32:27 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
ximagesink = GST_X_IMAGE_SINK (object);
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_reset (ximagesink);
|
2007-03-08 15:22:53 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (ximagesink->display_name) {
|
|
|
|
g_free (ximagesink->display_name);
|
|
|
|
ximagesink->display_name = NULL;
|
|
|
|
}
|
2004-11-08 14:31:55 +00:00
|
|
|
if (ximagesink->par) {
|
|
|
|
g_free (ximagesink->par);
|
|
|
|
ximagesink->par = NULL;
|
|
|
|
}
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_clear (&ximagesink->x_lock);
|
|
|
|
g_mutex_clear (&ximagesink->flow_lock);
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2009-06-22 08:40:33 +00:00
|
|
|
g_free (ximagesink->media_title);
|
|
|
|
|
2004-06-17 14:15:23 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2003-11-11 11:32:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_init (GstXImageSink * ximagesink)
|
2003-11-11 11:32:27 +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
|
|
|
ximagesink->display_name = NULL;
|
2003-11-11 11:32:27 +00:00
|
|
|
ximagesink->xcontext = NULL;
|
|
|
|
ximagesink->xwindow = NULL;
|
2004-02-03 23:05:46 +00:00
|
|
|
ximagesink->cur_image = NULL;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
ximagesink->event_thread = NULL;
|
|
|
|
ximagesink->running = FALSE;
|
|
|
|
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
ximagesink->fps_n = 0;
|
|
|
|
ximagesink->fps_d = 1;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-09-10 00:03:52 +00:00
|
|
|
g_mutex_init (&ximagesink->x_lock);
|
|
|
|
g_mutex_init (&ximagesink->flow_lock);
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2004-07-28 21:28:34 +00:00
|
|
|
ximagesink->par = NULL;
|
2005-02-15 14:12:11 +00:00
|
|
|
|
2011-03-03 15:48:23 +00:00
|
|
|
ximagesink->pool = NULL;
|
2004-07-27 16:43:24 +00:00
|
|
|
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
ximagesink->synchronous = FALSE;
|
2012-07-24 09:23:30 +00:00
|
|
|
ximagesink->keep_aspect = TRUE;
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
ximagesink->handle_events = TRUE;
|
2007-07-14 18:20:41 +00:00
|
|
|
ximagesink->handle_expose = TRUE;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-07-03 19:48:52 +00:00
|
|
|
gst_x_image_sink_class_init (GstXImageSinkClass * klass)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
2005-04-25 07:06:09 +00:00
|
|
|
GstBaseSinkClass *gstbasesink_class;
|
2009-09-08 16:43:26 +00:00
|
|
|
GstVideoSinkClass *videosink_class;
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2005-04-25 07:06:09 +00:00
|
|
|
gstbasesink_class = (GstBaseSinkClass *) klass;
|
2009-09-08 16:43:26 +00:00
|
|
|
videosink_class = (GstVideoSinkClass *) klass;
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
gobject_class->finalize = gst_x_image_sink_finalize;
|
|
|
|
gobject_class->set_property = gst_x_image_sink_set_property;
|
|
|
|
gobject_class->get_property = gst_x_image_sink_get_property;
|
2005-04-25 07:06:09 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DISPLAY,
|
2004-03-14 22:34:34 +00:00
|
|
|
g_param_spec_string ("display", "Display", "X Display name",
|
2008-03-22 15:00:53 +00:00
|
|
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-04-25 07:06:09 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SYNCHRONOUS,
|
2011-10-19 08:41:31 +00:00
|
|
|
g_param_spec_boolean ("synchronous", "Synchronous",
|
|
|
|
"When enabled, runs the X display in synchronous mode. "
|
|
|
|
"(unrelated to A/V sync, used only for debugging)", FALSE,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
sys/ximage/ximagesink.*: Refactoring of ximagesink.
Original commit message from CVS:
2005-11-18 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy),
(gst_ximagesink_xwindow_draw_borders),
(gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_update_geometry),
(gst_ximagesink_handle_xevents), (gst_ximagesink_event_thread),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_bufferpool_clear), (gst_ximagesink_getcaps),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_navigation_send_event),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_expose),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_finalize), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h: Refactoring of ximagesink.
This new version brings correct software scaling, non flickering
window while resizing, pixel aspect ratio handling, usage of
hardware buffer pools, out of data flow event thread for
navigation and handling of expose events even when being PAUSED,
a new property to keep video aspect ratio when resizing, etc...
2005-11-18 17:58:12 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
|
|
|
|
g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio",
|
|
|
|
"When enabled, reverse caps negotiation (scaling) will respect "
|
2012-06-29 10:43:46 +00:00
|
|
|
"original aspect ratio", TRUE,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-04-25 07:06:09 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_PIXEL_ASPECT_RATIO,
|
2004-07-27 16:43:24 +00:00
|
|
|
g_param_spec_string ("pixel-aspect-ratio", "Pixel Aspect Ratio",
|
2008-03-22 15:00:53 +00:00
|
|
|
"The pixel aspect ratio of the device", "1/1",
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
Add a method to the XOverlay interface to allow disabling of event handling in x[v]imagesink elements. This will let ...
Original commit message from CVS:
2007-01-04 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/interfaces/xoverlay.c:
(gst_x_overlay_handle_events):
* gst-libs/gst/interfaces/xoverlay.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_event_handling),
(gst_ximagesink_xoverlay_init), (gst_ximagesink_set_property),
(gst_ximagesink_get_property), (gst_ximagesink_init),
(gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_set_event_handling),
(gst_xvimagesink_xoverlay_init), (gst_xvimagesink_set_property),
(gst_xvimagesink_get_property), (gst_xvimagesink_init),
(gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
* tests/icles/stress-xoverlay.c: (toggle_events),
(create_window):
Add a method to the XOverlay interface to allow disabling of
event handling in x[v]imagesink elements. This will let X events
propagate to parent windows which can be usefull in some cases.
Be carefull that the application is then responsible of pushing
navigation events and expose events to the video sink.
Fixes: #387138.
2007-01-04 11:30:53 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_HANDLE_EVENTS,
|
|
|
|
g_param_spec_boolean ("handle-events", "Handle XEvents",
|
|
|
|
"When enabled, XEvents will be selected and handled", TRUE,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2007-07-14 18:20:41 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_HANDLE_EXPOSE,
|
2008-03-22 15:00:53 +00:00
|
|
|
g_param_spec_boolean ("handle-expose", "Handle expose",
|
|
|
|
"When enabled, "
|
2007-07-14 18:20:41 +00:00
|
|
|
"the current frame will always be drawn in response to X Expose "
|
2008-03-22 15:00:53 +00:00
|
|
|
"events", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-10-25 13:13:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstXImageSink:window-width
|
|
|
|
*
|
|
|
|
* Actual width of the video window.
|
|
|
|
*/
|
2010-10-25 13:08:43 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_WINDOW_WIDTH,
|
|
|
|
g_param_spec_uint64 ("window-width", "window-width",
|
2010-10-25 13:13:16 +00:00
|
|
|
"Width of the window", 0, G_MAXUINT64, 0,
|
2010-10-25 13:08:43 +00:00
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2010-10-25 13:13:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstXImageSink:window-height
|
|
|
|
*
|
|
|
|
* Actual height of the video window.
|
|
|
|
*/
|
2010-10-25 13:08:43 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_WINDOW_HEIGHT,
|
|
|
|
g_param_spec_uint64 ("window-height", "window-height",
|
2010-10-25 13:13:16 +00:00
|
|
|
"Height of the window", 0, G_MAXUINT64, 0,
|
2010-10-25 13:08:43 +00:00
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-04-09 23:45:16 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class,
|
2011-04-19 09:44:14 +00:00
|
|
|
"Video sink", "Sink/Video",
|
|
|
|
"A standard X based videosink", "Julien Moutte <julien@moutte.net>");
|
|
|
|
|
2016-03-03 07:46:24 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&gst_x_image_sink_sink_template_factory);
|
2011-04-19 09:44:14 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
gstelement_class->change_state = gst_x_image_sink_change_state;
|
2005-04-25 07:06:09 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_x_image_sink_getcaps);
|
|
|
|
gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_x_image_sink_setcaps);
|
|
|
|
gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_x_image_sink_get_times);
|
2011-08-26 12:20:30 +00:00
|
|
|
gstbasesink_class->propose_allocation =
|
2015-07-03 19:48:52 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_x_image_sink_propose_allocation);
|
|
|
|
gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_x_image_sink_event);
|
2009-09-08 16:43:26 +00:00
|
|
|
|
2015-07-03 19:48:52 +00:00
|
|
|
videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_x_image_sink_show_frame);
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|