yikes, cvs didn't like my vim swap file.
Original commit message from CVS: yikes, cvs didn't like my vim swap file. here's the proper revert + commit
This commit is contained in:
parent
fa97ee389e
commit
c3c782ff10
@ -36,12 +36,6 @@ static GstElementDetails gst_ximagesink_details = GST_ELEMENT_DETAILS (
|
|||||||
"Julien Moutte <julien@moutte.net>"
|
"Julien Moutte <julien@moutte.net>"
|
||||||
);
|
);
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ARG_0,
|
|
||||||
ARG_DISPLAY_NAME
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Default template - initiated with class struct to allow gst-register to work
|
/* Default template - initiated with class struct to allow gst-register to work
|
||||||
without X running */
|
without X running */
|
||||||
GST_PAD_TEMPLATE_FACTORY (gst_ximagesink_sink_template_factory,
|
GST_PAD_TEMPLATE_FACTORY (gst_ximagesink_sink_template_factory,
|
||||||
@ -80,18 +74,30 @@ gst_ximagesink_interface_init (GstInterfaceClass *klass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_ximagesink_navigation_send_event (GstNavigation *navigation, GstCaps *caps)
|
gst_ximagesink_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
|
||||||
{
|
{
|
||||||
GstXImageSink *ximagesink = GST_XIMAGESINK (navigation);
|
GstXImageSink *ximagesink = GST_XIMAGESINK (navigation);
|
||||||
|
XWindowAttributes attr;
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
|
g_mutex_lock (ximagesink->x_lock);
|
||||||
|
XGetWindowAttributes (ximagesink->xcontext->disp,
|
||||||
|
ximagesink->xwindow->win, &attr);
|
||||||
|
g_mutex_unlock (ximagesink->x_lock);
|
||||||
|
|
||||||
event = gst_event_new (GST_EVENT_NAVIGATION);
|
event = gst_event_new (GST_EVENT_NAVIGATION);
|
||||||
/*GST_EVENT_TIMESTAMP (event) = 0;*/
|
event->event_data.structure.structure = structure;
|
||||||
event->event_data.caps.caps = caps;
|
if(gst_structure_get_double(structure, "pointer_x", &x)){
|
||||||
|
x *= ximagesink->width;
|
||||||
/* FIXME
|
x /= attr.width;
|
||||||
* Obviously, the pointer x,y coordinates need to be adjusted by the
|
gst_structure_set(structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
|
||||||
* window size and relation to the bounding window. */
|
}
|
||||||
|
if(gst_structure_get_double(structure, "pointer_y", &y)){
|
||||||
|
y *= ximagesink->height;
|
||||||
|
y /= attr.height;
|
||||||
|
gst_structure_set(structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gst_pad_send_event (gst_pad_get_peer (ximagesink->sinkpad), event);
|
gst_pad_send_event (gst_pad_get_peer (ximagesink->sinkpad), event);
|
||||||
}
|
}
|
||||||
@ -104,6 +110,7 @@ gst_ximagesink_navigation_init (GstNavigationInterface *iface)
|
|||||||
|
|
||||||
/* X11 stuff */
|
/* X11 stuff */
|
||||||
|
|
||||||
|
/* This function handles GstXImage creation depending on XShm availability */
|
||||||
static GstXImage *
|
static GstXImage *
|
||||||
gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
|
gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
|
||||||
{
|
{
|
||||||
@ -120,19 +127,6 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
|
|||||||
|
|
||||||
g_mutex_lock (ximagesink->x_lock);
|
g_mutex_lock (ximagesink->x_lock);
|
||||||
|
|
||||||
GstXImage *ximage = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (ximagesink != NULL, NULL);
|
|
||||||
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
|
|
||||||
|
|
||||||
ximage = g_new0 (GstXImage, 1);
|
|
||||||
|
|
||||||
ximage->width = width;
|
|
||||||
ximage->height = height;
|
|
||||||
ximage->data = NULL;
|
|
||||||
|
|
||||||
g_mutex_lock (ximagesink->x_lock);
|
|
||||||
|
|
||||||
ximage->size = (ximagesink->xcontext->bpp / 8) * ximage->width * ximage->height;
|
ximage->size = (ximagesink->xcontext->bpp / 8) * ximage->width * ximage->height;
|
||||||
|
|
||||||
#ifdef HAVE_SHM
|
#ifdef HAVE_SHM
|
||||||
@ -176,8 +170,6 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
|
|||||||
ximage->width, ximage->height,
|
ximage->width, ximage->height,
|
||||||
ximagesink->xcontext->bpp,
|
ximagesink->xcontext->bpp,
|
||||||
ximage->width * (ximagesink->xcontext->bpp / 8));
|
ximage->width * (ximagesink->xcontext->bpp / 8));
|
||||||
|
|
||||||
GST_DEBUG ("ximagesink creating an image without XShm");
|
|
||||||
#endif /* HAVE_SHM */
|
#endif /* HAVE_SHM */
|
||||||
|
|
||||||
if (ximage->ximage)
|
if (ximage->ximage)
|
||||||
@ -458,10 +450,10 @@ gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad)
|
|||||||
g_mutex_unlock (ximagesink->x_lock);
|
g_mutex_unlock (ximagesink->x_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function gets the X Display and global infos about it. Everything is
|
/* This function get the X Display and global infos about it. Everything is
|
||||||
stored in our object and will be cleaned when the object is disposed. Note
|
stored in our object and will be cleaned when the object is disposed. Note
|
||||||
here that caps for supported format are generated without any window or
|
here that caps for supported format are generated without any window or
|
||||||
image creation. */
|
image creation */
|
||||||
static GstXContext *
|
static GstXContext *
|
||||||
gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
|
gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
|
||||||
{
|
{
|
||||||
@ -572,133 +564,116 @@ gst_ximagesink_xcontext_clear (GstXImageSink *ximagesink)
|
|||||||
|
|
||||||
XCloseDisplay (ximagesink->xcontext->disp);
|
XCloseDisplay (ximagesink->xcontext->disp);
|
||||||
|
|
||||||
GstClockID id = gst_clock_new_single_shot_id (ximagesink->clock, time);
|
g_mutex_unlock (ximagesink->x_lock);
|
||||||
gst_element_clock_wait (GST_ELEMENT (ximagesink), id, NULL);
|
|
||||||
gst_clock_id_free (id);
|
ximagesink->xcontext = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have a pool and the image is from this pool, simply put it. */
|
/* Element stuff */
|
||||||
if ( (ximagesink->bufferpool) &&
|
|
||||||
(GST_BUFFER_BUFFERPOOL (buf) == ximagesink->bufferpool) )
|
|
||||||
gst_ximagesink_ximage_put (ximagesink, GST_BUFFER_POOL_PRIVATE (buf));
|
|
||||||
else /* Else we have to copy the data into our private image, */
|
|
||||||
{ /* if we have one... */
|
|
||||||
if (ximagesink->ximage)
|
|
||||||
{
|
|
||||||
memcpy (ximagesink->ximage->ximage->data,
|
|
||||||
GST_BUFFER_DATA (buf),
|
|
||||||
MIN (GST_BUFFER_SIZE (buf), ximagesink->ximage->size));
|
|
||||||
gst_ximagesink_ximage_put (ximagesink, ximagesink->ximage);
|
|
||||||
}
|
|
||||||
else /* No image available. Something went wrong during capsnego ! */
|
|
||||||
{
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
gst_element_error (GST_ELEMENT (ximagesink), "no image to draw");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
static GstCaps *
|
||||||
}
|
gst_ximagesink_getcaps (GstPad *pad, GstCaps *caps)
|
||||||
|
|
||||||
static void
|
|
||||||
gst_ximagesink_get_property (GObject *object, guint prop_id,
|
|
||||||
GValue *value, GParamSpec *pspec)
|
|
||||||
{
|
{
|
||||||
GstXImageSink *ximagesink;
|
GstXImageSink *ximagesink;
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_XIMAGESINK (object));
|
ximagesink = GST_XIMAGESINK (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
ximagesink = GST_XIMAGESINK (object);
|
if (ximagesink->xcontext)
|
||||||
|
return gst_caps_copy (ximagesink->xcontext->caps);
|
||||||
|
|
||||||
switch (prop_id)
|
return GST_CAPS_NEW ("ximagesink_rgbsink", "video/x-raw-rgb",
|
||||||
|
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
|
||||||
|
"width", GST_PROPS_INT_RANGE (0, G_MAXINT),
|
||||||
|
"height", GST_PROPS_INT_RANGE (0, G_MAXINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstPadLinkReturn
|
||||||
gst_ximagesink_set_clock (GstElement *element, GstClock *clock)
|
gst_ximagesink_sinkconnect (GstPad *pad, GstCaps *caps)
|
||||||
|
{
|
||||||
|
GstXImageSink *ximagesink;
|
||||||
|
|
||||||
|
ximagesink = GST_XIMAGESINK (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
/* we are not going to act on variable caps */
|
||||||
|
if (!GST_CAPS_IS_FIXED (caps))
|
||||||
|
return GST_PAD_LINK_DELAYED;
|
||||||
|
if (GST_CAPS_IS_CHAINED (caps))
|
||||||
|
return GST_PAD_LINK_DELAYED;
|
||||||
|
|
||||||
|
GST_DEBUG ("sinkconnect %s with %s", gst_caps_to_string(caps),
|
||||||
|
gst_caps_to_string(ximagesink->xcontext->caps));
|
||||||
|
|
||||||
|
if (!gst_caps_get_int (caps, "width", &ximagesink->width))
|
||||||
|
return GST_PAD_LINK_REFUSED;
|
||||||
|
if (!gst_caps_get_int (caps, "height", &ximagesink->height))
|
||||||
|
return GST_PAD_LINK_REFUSED;
|
||||||
|
|
||||||
|
if (gst_caps_has_fixed_property (caps, "pixel_width"))
|
||||||
|
gst_caps_get_int (caps, "pixel_width", &ximagesink->pixel_width);
|
||||||
|
else
|
||||||
|
ximagesink->pixel_width = 1;
|
||||||
|
|
||||||
|
if (gst_caps_has_fixed_property (caps, "pixel_height"))
|
||||||
|
gst_caps_get_int (caps, "pixel_height", &ximagesink->pixel_height);
|
||||||
|
else
|
||||||
|
ximagesink->pixel_height = 1;
|
||||||
|
|
||||||
|
/* Creating our window and our image */
|
||||||
|
if (!ximagesink->xwindow)
|
||||||
|
ximagesink->xwindow = gst_ximagesink_xwindow_new (ximagesink,
|
||||||
|
ximagesink->width,
|
||||||
|
ximagesink->height);
|
||||||
|
else
|
||||||
|
{ /* We resize our window only if size has changed, preventing us from
|
||||||
|
infinite loops with XConfigure events.
|
||||||
|
if ( (ximagesink->width != ximagesink->xwindow->width) ||
|
||||||
|
(ximagesink->height != ximagesink->xwindow->height) )
|
||||||
|
gst_ximagesink_xwindow_resize (ximagesink, ximagesink->xwindow,
|
||||||
|
ximagesink->width, ximagesink->height);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (ximagesink->ximage) &&
|
||||||
|
( (ximagesink->width != ximagesink->ximage->width) ||
|
||||||
|
(ximagesink->height != ximagesink->ximage->height) ) )
|
||||||
|
{ /* We renew our ximage only if size changed */
|
||||||
|
gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
|
||||||
|
|
||||||
|
ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink,
|
||||||
|
ximagesink->width,
|
||||||
|
ximagesink->height);
|
||||||
|
}
|
||||||
|
else if (!ximagesink->ximage) /* If no ximage, creating one */
|
||||||
|
ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink,
|
||||||
|
ximagesink->width,
|
||||||
|
ximagesink->height);
|
||||||
|
|
||||||
|
return GST_PAD_LINK_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstElementStateReturn
|
||||||
|
gst_ximagesink_change_state (GstElement *element)
|
||||||
{
|
{
|
||||||
GstXImageSink *ximagesink;
|
GstXImageSink *ximagesink;
|
||||||
|
|
||||||
ximagesink = GST_XIMAGESINK (element);
|
ximagesink = GST_XIMAGESINK (element);
|
||||||
|
|
||||||
ximagesink->clock = clock;
|
switch (GST_STATE_TRANSITION (element)) {
|
||||||
}
|
case GST_STATE_NULL_TO_READY:
|
||||||
|
/* Initializing the XContext */
|
||||||
static GstBuffer*
|
ximagesink->xcontext = gst_ximagesink_xcontext_get (ximagesink);
|
||||||
gst_ximagesink_buffer_new (GstBufferPool *pool,
|
if (!ximagesink->xcontext)
|
||||||
gint64 location, guint size, gpointer user_data)
|
return GST_STATE_FAILURE;
|
||||||
{
|
break;
|
||||||
GstXImageSink *ximagesink;
|
case GST_STATE_READY_TO_PAUSED:
|
||||||
GstBuffer *buffer;
|
break;
|
||||||
GstXImage *ximage = NULL;
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
gboolean not_found = TRUE;
|
break;
|
||||||
|
case GST_STATE_PLAYING_TO_PAUSED:
|
||||||
ximagesink = GST_XIMAGESINK (user_data);
|
break;
|
||||||
|
case GST_STATE_PAUSED_TO_READY:
|
||||||
g_mutex_lock (ximagesink->pool_lock);
|
break;
|
||||||
|
case GST_STATE_READY_TO_NULL:
|
||||||
/* Walking through the pool cleaning unsuable images and searching for a
|
|
||||||
suitable one */
|
|
||||||
while (not_found && ximagesink->image_pool)
|
|
||||||
{
|
|
||||||
ximage = ximagesink->image_pool->data;
|
|
||||||
|
|
||||||
if (ximage)
|
|
||||||
{
|
|
||||||
/* Removing from the pool */
|
|
||||||
ximagesink->image_pool = g_slist_delete_link (ximagesink->image_pool,
|
|
||||||
ximagesink->image_pool);
|
|
||||||
|
|
||||||
if ( (ximage->width != ximagesink->width) ||
|
|
||||||
(ximage->height != ximagesink->height) )
|
|
||||||
{ /* This image is unusable. Destroying... */
|
|
||||||
gst_ximagesink_ximage_destroy (ximagesink, ximage);
|
|
||||||
ximage = NULL;
|
|
||||||
}
|
|
||||||
else /* We found a suitable image */
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_mutex_unlock (ximagesink->pool_lock);
|
|
||||||
|
|
||||||
if (!ximage) /* We didn't find a suitable image in the pool. Creating... */
|
|
||||||
ximage = gst_ximagesink_ximage_new (ximagesink,
|
|
||||||
ximagesink->width,
|
|
||||||
ximagesink->height);
|
|
||||||
|
|
||||||
if (ximage)
|
|
||||||
{
|
|
||||||
buffer = gst_buffer_new ();
|
|
||||||
GST_BUFFER_POOL_PRIVATE (buffer) = ximage;
|
|
||||||
GST_BUFFER_DATA (buffer) = ximage->ximage->data;
|
|
||||||
GST_BUFFER_SIZE (buffer) = ximage->size;
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_ximagesink_buffer_free (GstBufferPool *pool,
|
|
||||||
GstBuffer *buffer, gpointer user_data)
|
|
||||||
{
|
|
||||||
GstXImageSink *ximagesink;
|
|
||||||
GstXImage *ximage;
|
|
||||||
|
|
||||||
ximagesink = GST_XIMAGESINK (user_data);
|
|
||||||
|
|
||||||
ximage = GST_BUFFER_POOL_PRIVATE (buffer);
|
|
||||||
|
|
||||||
/* If our geometry changed we can't reuse that image. */
|
|
||||||
if ( (ximage->width != ximagesink->width) ||
|
|
||||||
(ximage->height != ximagesink->height) )
|
|
||||||
{
|
|
||||||
gst_ximagesink_ximage_destroy (ximagesink, ximage);
|
|
||||||
}
|
|
||||||
else /* If it didn't we can reuse the image and add it to our image pool. */
|
|
||||||
{
|
|
||||||
g_mutex_lock (ximagesink->pool_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent_class->change_state)
|
if (parent_class->change_state)
|
||||||
@ -819,6 +794,161 @@ gst_ximagesink_buffer_new (GstBufferPool *pool,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_mutex_unlock (ximagesink->pool_lock);
|
||||||
|
|
||||||
|
if (!ximage) /* We found no suitable image in the pool. Creating... */
|
||||||
|
ximage = gst_ximagesink_ximage_new (ximagesink,
|
||||||
|
ximagesink->width,
|
||||||
|
ximagesink->height);
|
||||||
|
|
||||||
|
if (ximage)
|
||||||
|
{
|
||||||
|
buffer = gst_buffer_new ();
|
||||||
|
GST_BUFFER_POOL_PRIVATE (buffer) = ximage;
|
||||||
|
GST_BUFFER_DATA (buffer) = ximage->ximage->data;
|
||||||
|
GST_BUFFER_SIZE (buffer) = ximage->size;
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_ximagesink_buffer_free (GstBufferPool *pool,
|
||||||
|
GstBuffer *buffer, gpointer user_data)
|
||||||
|
{
|
||||||
|
GstXImageSink *ximagesink;
|
||||||
|
GstXImage *ximage;
|
||||||
|
|
||||||
|
ximagesink = GST_XIMAGESINK (user_data);
|
||||||
|
|
||||||
|
ximage = GST_BUFFER_POOL_PRIVATE (buffer);
|
||||||
|
|
||||||
|
/* If our geometry changed we can't reuse that image. */
|
||||||
|
if ( (ximage->width != ximagesink->width) ||
|
||||||
|
(ximage->height != ximagesink->height) )
|
||||||
|
gst_ximagesink_ximage_destroy (ximagesink, ximage);
|
||||||
|
else /* In that case we can reuse the image and add it to our image pool. */
|
||||||
|
{
|
||||||
|
g_mutex_lock (ximagesink->pool_lock);
|
||||||
|
ximagesink->image_pool = g_slist_prepend (ximagesink->image_pool, ximage);
|
||||||
|
g_mutex_unlock (ximagesink->pool_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_BUFFER_DATA (buffer) = NULL;
|
||||||
|
|
||||||
|
gst_buffer_default_free (buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_ximagesink_imagepool_clear (GstXImageSink *ximagesink)
|
||||||
|
{
|
||||||
|
g_mutex_lock(ximagesink->pool_lock);
|
||||||
|
|
||||||
|
while (ximagesink->image_pool)
|
||||||
|
{
|
||||||
|
GstXImage *ximage = ximagesink->image_pool->data;
|
||||||
|
ximagesink->image_pool = g_slist_delete_link (ximagesink->image_pool,
|
||||||
|
ximagesink->image_pool);
|
||||||
|
gst_ximagesink_ximage_destroy (ximagesink, ximage);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_mutex_unlock(ximagesink->pool_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstBufferPool*
|
||||||
|
gst_ximagesink_get_bufferpool (GstPad *pad)
|
||||||
|
{
|
||||||
|
GstXImageSink *ximagesink;
|
||||||
|
|
||||||
|
ximagesink = GST_XIMAGESINK (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
if (!ximagesink->bufferpool) {
|
||||||
|
ximagesink->bufferpool = gst_buffer_pool_new (
|
||||||
|
NULL, /* free */
|
||||||
|
NULL, /* copy */
|
||||||
|
(GstBufferPoolBufferNewFunction) gst_ximagesink_buffer_new,
|
||||||
|
NULL, /* buffer copy, the default is fine */
|
||||||
|
(GstBufferPoolBufferFreeFunction) gst_ximagesink_buffer_free,
|
||||||
|
ximagesink);
|
||||||
|
|
||||||
|
ximagesink->image_pool = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_buffer_pool_ref (ximagesink->bufferpool);
|
||||||
|
|
||||||
|
return ximagesink->bufferpool;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =========================================== */
|
||||||
|
/* */
|
||||||
|
/* Init & Class init */
|
||||||
|
/* */
|
||||||
|
/* =========================================== */
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_ximagesink_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
GstXImageSink *ximagesink;
|
||||||
|
|
||||||
|
ximagesink = GST_XIMAGESINK (object);
|
||||||
|
|
||||||
|
if (ximagesink->ximage)
|
||||||
|
{
|
||||||
|
gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
|
||||||
|
ximagesink->ximage = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ximagesink->image_pool)
|
||||||
|
gst_ximagesink_imagepool_clear (ximagesink);
|
||||||
|
|
||||||
|
if (ximagesink->xwindow)
|
||||||
|
{
|
||||||
|
gst_ximagesink_xwindow_destroy (ximagesink, ximagesink->xwindow);
|
||||||
|
ximagesink->xwindow = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ximagesink->xcontext)
|
||||||
|
gst_ximagesink_xcontext_clear (ximagesink);
|
||||||
|
|
||||||
|
g_mutex_free (ximagesink->x_lock);
|
||||||
|
g_mutex_free (ximagesink->pool_lock);
|
||||||
|
|
||||||
|
if (ximagesink->bufferpool)
|
||||||
|
gst_buffer_pool_free (ximagesink->bufferpool);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_ximagesink_init (GstXImageSink *ximagesink)
|
||||||
|
{
|
||||||
|
ximagesink->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (
|
||||||
|
gst_ximagesink_sink_template_factory),
|
||||||
|
"sink");
|
||||||
|
gst_element_add_pad (GST_ELEMENT (ximagesink), ximagesink->sinkpad);
|
||||||
|
|
||||||
|
gst_pad_set_chain_function (ximagesink->sinkpad, gst_ximagesink_chain);
|
||||||
|
gst_pad_set_link_function (ximagesink->sinkpad, gst_ximagesink_sinkconnect);
|
||||||
|
gst_pad_set_getcaps_function (ximagesink->sinkpad, gst_ximagesink_getcaps);
|
||||||
|
gst_pad_set_bufferpool_function (ximagesink->sinkpad,
|
||||||
|
gst_ximagesink_get_bufferpool);
|
||||||
|
|
||||||
|
ximagesink->xcontext = NULL;
|
||||||
|
ximagesink->xwindow = NULL;
|
||||||
|
ximagesink->ximage = NULL;
|
||||||
|
ximagesink->clock = NULL;
|
||||||
|
|
||||||
|
ximagesink->width = ximagesink->height = 0;
|
||||||
|
|
||||||
|
ximagesink->x_lock = g_mutex_new ();
|
||||||
|
|
||||||
|
ximagesink->pixel_width = ximagesink->pixel_height = 1;
|
||||||
|
|
||||||
|
ximagesink->image_pool = NULL;
|
||||||
|
ximagesink->pool_lock = g_mutex_new ();
|
||||||
|
|
||||||
|
GST_FLAG_SET(ximagesink, GST_ELEMENT_THREAD_SUGGESTED);
|
||||||
GST_FLAG_SET(ximagesink, GST_ELEMENT_EVENT_AWARE);
|
GST_FLAG_SET(ximagesink, GST_ELEMENT_EVENT_AWARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -843,12 +973,8 @@ gst_ximagesink_class_init (GstXImageSinkClass *klass)
|
|||||||
gstelement_class = (GstElementClass *) klass;
|
gstelement_class = (GstElementClass *) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DISPLAY_NAME,
|
|
||||||
g_param_spec_string ("displayname", "displayname", "Name of display to use",
|
|
||||||
NULL, G_PARAM_READABLE));
|
|
||||||
|
|
||||||
gobject_class->set_property = gst_ximagesink_set_property;
|
gobject_class->dispose = gst_ximagesink_dispose;
|
||||||
gobject_class->get_property = gst_ximagesink_get_property;
|
|
||||||
|
|
||||||
gstelement_class->change_state = gst_ximagesink_change_state;
|
gstelement_class->change_state = gst_ximagesink_change_state;
|
||||||
gstelement_class->set_clock = gst_ximagesink_set_clock;
|
gstelement_class->set_clock = gst_ximagesink_set_clock;
|
||||||
@ -902,8 +1028,7 @@ gst_ximagesink_get_type (void)
|
|||||||
|
|
||||||
ximagesink_type = g_type_register_static (GST_TYPE_ELEMENT,
|
ximagesink_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||||
"GstXImageSink",
|
"GstXImageSink",
|
||||||
&ximagesink_info,
|
&ximagesink_info, 0);
|
||||||
0);
|
|
||||||
|
|
||||||
g_type_add_interface_static (ximagesink_type, GST_TYPE_INTERFACE,
|
g_type_add_interface_static (ximagesink_type, GST_TYPE_INTERFACE,
|
||||||
&iface_info);
|
&iface_info);
|
||||||
@ -919,7 +1044,8 @@ gst_ximagesink_get_type (void)
|
|||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin *plugin)
|
plugin_init (GstPlugin *plugin)
|
||||||
{
|
{
|
||||||
if (!gst_element_register (plugin, "ximagesink", GST_RANK_NONE, GST_TYPE_XIMAGESINK))
|
if (!gst_element_register (plugin, "ximagesink",
|
||||||
|
GST_RANK_SECONDARY, GST_TYPE_XIMAGESINK))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
/* FIXME : We should have a configure test for shm support */
|
||||||
|
#define HAVE_SHM
|
||||||
|
|
||||||
#ifdef HAVE_SHM
|
#ifdef HAVE_SHM
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user