/* for developers: there are two useful tools : xvinfo and xvattr */
-/* FIXME 0.11: suppress warnings for deprecated API such as GValueArray
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* We take the flow_lock. If expose is in there we don't want to run
concurrently from the data flow thread */
- g_mutex_lock (xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
if (G_UNLIKELY (xvimagesink->xwindow == NULL)) {
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
return FALSE;
}
draw_border = TRUE;
xvimage = xvimagesink->cur_image;
} else {
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
return TRUE;
}
}
memcpy (&result, &xvimagesink->render_rect, sizeof (GstVideoRectangle));
}
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
if (draw_border && xvimagesink->draw_borders) {
gst_xvimagesink_xwindow_draw_borders (xvimagesink, xvimagesink->xwindow,
XSync (xvimagesink->xcontext->disp, FALSE);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
return TRUE;
}
g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), FALSE);
g_return_val_if_fail (window != NULL, FALSE);
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
hints_atom = XInternAtom (xvimagesink->xcontext->disp, "_MOTIF_WM_HINTS",
True);
if (hints_atom == None) {
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
return FALSE;
}
XSync (xvimagesink->xcontext->disp, FALSE);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
g_free (hints);
xwindow->height = height;
xwindow->internal = TRUE;
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
xwindow->win = XCreateSimpleWindow (xvimagesink->xcontext->disp,
xvimagesink->xcontext->root,
XSync (xvimagesink->xcontext->disp, FALSE);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
gst_xvimagesink_xwindow_decorate (xvimagesink, xwindow);
g_return_if_fail (xwindow != NULL);
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
/* If we did not create that window we just free the GC and let it live */
if (xwindow->internal)
XSync (xvimagesink->xcontext->disp, FALSE);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
g_free (xwindow);
}
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
/* Update the window geometry */
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
if (G_UNLIKELY (xvimagesink->xwindow == NULL)) {
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
return;
}
xvimagesink->render_rect.h = attr.height;
}
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
}
static void
g_return_if_fail (xwindow != NULL);
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
XvStopVideo (xvimagesink->xcontext->disp, xvimagesink->xcontext->xv_port_id,
xwindow->win);
XSync (xvimagesink->xcontext->disp, FALSE);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
}
/* This function commits our internal colorbalance settings to our grabbed Xv
}
/* Committing to Xv port */
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
prop_atom =
XInternAtom (xvimagesink->xcontext->disp, channel->label, True);
if (prop_atom != None) {
XvSetPortAttribute (xvimagesink->xcontext->disp,
xvimagesink->xcontext->xv_port_id, prop_atom, xv_value);
}
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
g_object_unref (channel);
}
/* We get all pointer motion events, only the last position is
interesting. */
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
while (XCheckWindowEvent (xvimagesink->xcontext->disp,
xvimagesink->xwindow->win, PointerMotionMask, &e)) {
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
switch (e.type) {
case MotionNotify:
default:
break;
}
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
}
if (pointer_moved) {
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
GST_DEBUG ("xvimagesink pointer moved over window at %d,%d",
pointer_x, pointer_y);
gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink),
"mouse-move", 0, e.xbutton.x, e.xbutton.y);
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
}
/* We get all events on our window to throw them upstream */
const char *key_str = NULL;
/* We lock only for the X function call */
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
switch (e.type) {
case ButtonPress:
case KeyRelease:
/* Key pressed/released over our window. We send upstream
events for interactivity/navigation */
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
keysym = XkbKeycodeToKeysym (xvimagesink->xcontext->disp,
e.xkey.keycode, 0, 0);
if (keysym != NoSymbol) {
} else {
key_str = "unknown";
}
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
GST_DEBUG_OBJECT (xvimagesink,
"key %d pressed over window at %d,%d (%s)",
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
GST_DEBUG_OBJECT (xvimagesink, "xvimagesink unhandled X event (%d)",
e.type);
}
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
}
/* Handle Expose */
exposed = TRUE;
break;
case ConfigureNotify:
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
gst_xvimagesink_xwindow_update_geometry (xvimagesink);
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
configured = TRUE;
break;
default:
}
if (xvimagesink->handle_expose && (exposed || configured)) {
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
gst_xvimagesink_expose (GST_VIDEO_OVERLAY (xvimagesink));
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
}
/* Handle Display events */
GST_ELEMENT_ERROR (xvimagesink, RESOURCE, NOT_FOUND,
("Output window was closed"), (NULL));
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
gst_xvimagesink_xwindow_destroy (xvimagesink, xvimagesink->xwindow);
xvimagesink->xwindow = NULL;
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
}
break;
}
}
}
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
}
static void
xcontext = g_new0 (GstXContext, 1);
xcontext->im_format = 0;
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
xcontext->disp = XOpenDisplay (xvimagesink->display_name);
if (!xcontext->disp) {
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
g_free (xcontext);
GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
("Could not initialise Xv output"), ("Could not open display"));
if (!px_formats) {
XCloseDisplay (xcontext->disp);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
g_free (xcontext->par);
g_free (xcontext);
GST_ELEMENT_ERROR (xvimagesink, RESOURCE, SETTINGS,
if (!xcontext->caps) {
XCloseDisplay (xcontext->disp);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
g_free (xcontext->par);
g_free (xcontext);
/* GST_ELEMENT_ERROR is thrown by gst_xvimagesink_get_xv_support */
if (xv_attr)
XFree (xv_attr);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
return xcontext;
}
g_free (xcontext->par);
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
GST_DEBUG_OBJECT (xvimagesink, "Closing display and freeing X Context");
XCloseDisplay (xcontext->disp);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
g_free (xcontext);
}
GST_VIDEO_SINK_WIDTH (xvimagesink), GST_VIDEO_SINK_HEIGHT (xvimagesink));
/* Notify application to set xwindow id now */
- g_mutex_lock (xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
if (!xvimagesink->xwindow) {
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (xvimagesink));
} else {
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
}
/* Creating our window and our image with the display size in pixels */
GST_VIDEO_SINK_HEIGHT (xvimagesink) <= 0)
goto no_display_size;
- g_mutex_lock (xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
if (!xvimagesink->xwindow) {
xvimagesink->xwindow = gst_xvimagesink_xwindow_new (xvimagesink,
GST_VIDEO_SINK_WIDTH (xvimagesink),
* has configured the pool. If downstream does not want our pool we will
* activate it when we render into it */
xvimagesink->pool = newpool;
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
/* unref the old sink */
if (oldpool) {
config_failed:
{
GST_ERROR_OBJECT (xvimagesink, "failed to set config.");
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
return FALSE;
}
}
xvimagesink->fps_d = 1;
GST_VIDEO_SINK_WIDTH (xvimagesink) = 0;
GST_VIDEO_SINK_HEIGHT (xvimagesink) = 0;
- g_mutex_lock (xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
if (xvimagesink->pool)
gst_buffer_pool_set_active (xvimagesink->pool, FALSE);
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
gst_xvimagesink_reset (xvimagesink);
if (caps == NULL)
goto no_caps;
- g_mutex_lock (xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
if ((pool = xvimagesink->pool))
gst_object_ref (pool);
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
if (pool != NULL) {
GstCaps *pcaps;
event = gst_event_new_navigation (structure);
/* We take the flow_lock while we look at the window */
- g_mutex_lock (xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
if (!xvimagesink->xwindow) {
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
return;
}
memcpy (&result, &xvimagesink->render_rect, sizeof (GstVideoRectangle));
}
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
/* We calculate scaling using the original video frames geometry to include
pixel aspect ratio scaling. */
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
- g_mutex_lock (xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
/* If we already use that window return */
if (xvimagesink->xwindow && (xwindow_id == xvimagesink->xwindow->win)) {
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
return;
}
/* If the element has not initialized the X11 context try to do so */
if (!xvimagesink->xcontext &&
!(xvimagesink->xcontext = gst_xvimagesink_xcontext_get (xvimagesink))) {
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
/* we have thrown a GST_ELEMENT_ERROR now */
return;
}
xwindow->win = xwindow_id;
/* Set the event we want to receive and create a GC */
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
XGetWindowAttributes (xvimagesink->xcontext->disp, xwindow->win, &attr);
xwindow->gc = XCreateGC (xvimagesink->xcontext->disp,
xwindow->win, 0, NULL);
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
}
if (xwindow)
xvimagesink->xwindow = xwindow;
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
}
static void
xvimagesink->handle_events = handle_events;
- g_mutex_lock (xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
if (G_UNLIKELY (!xvimagesink->xwindow)) {
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
return;
}
- g_mutex_lock (xvimagesink->x_lock);
+ g_mutex_lock (&xvimagesink->x_lock);
if (handle_events) {
if (xvimagesink->xwindow->internal) {
XSelectInput (xvimagesink->xcontext->disp, xvimagesink->xwindow->win, 0);
}
- g_mutex_unlock (xvimagesink->x_lock);
+ g_mutex_unlock (&xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
}
static void
xvimagesink->cur_image = NULL;
}
- g_mutex_lock (xvimagesink->flow_lock);
+ g_mutex_lock (&xvimagesink->flow_lock);
if (xvimagesink->pool) {
gst_object_unref (xvimagesink->pool);
gst_xvimagesink_xwindow_destroy (xvimagesink, xvimagesink->xwindow);
xvimagesink->xwindow = NULL;
}
- g_mutex_unlock (xvimagesink->flow_lock);
+ g_mutex_unlock (&xvimagesink->flow_lock);
xvimagesink->render_rect.x = xvimagesink->render_rect.y =
xvimagesink->render_rect.w = xvimagesink->render_rect.h = 0;
g_free (xvimagesink->par);
xvimagesink->par = NULL;
}
- if (xvimagesink->x_lock) {
- g_mutex_free (xvimagesink->x_lock);
- xvimagesink->x_lock = NULL;
- }
- if (xvimagesink->flow_lock) {
- g_mutex_free (xvimagesink->flow_lock);
- xvimagesink->flow_lock = NULL;
- }
-
+ g_mutex_clear (&xvimagesink->x_lock);
+ g_mutex_clear (&xvimagesink->flow_lock);
g_free (xvimagesink->media_title);
G_OBJECT_CLASS (parent_class)->finalize (object);
xvimagesink->video_width = 0;
xvimagesink->video_height = 0;
- xvimagesink->x_lock = g_mutex_new ();
- xvimagesink->flow_lock = g_mutex_new ();
+ g_mutex_init (&xvimagesink->x_lock);
+ g_mutex_init (&xvimagesink->flow_lock);
xvimagesink->pool = NULL;