mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
Trying to fix the caps renegotiation.
Original commit message from CVS: Trying to fix the caps renegotiation.
This commit is contained in:
parent
cf680721df
commit
93ad6a64d5
1 changed files with 39 additions and 27 deletions
|
@ -187,25 +187,25 @@ gst_ximagesink_ximage_destroy (GstXImageSink *ximagesink, GstXImage *ximage)
|
||||||
if (ximagesink->xcontext->use_xshm)
|
if (ximagesink->xcontext->use_xshm)
|
||||||
{
|
{
|
||||||
if (ximage->SHMInfo.shmaddr)
|
if (ximage->SHMInfo.shmaddr)
|
||||||
XShmDetach(ximagesink->xcontext->disp, &ximage->SHMInfo);
|
XShmDetach (ximagesink->xcontext->disp, &ximage->SHMInfo);
|
||||||
|
|
||||||
if (ximage->ximage)
|
if (ximage->ximage)
|
||||||
XDestroyImage(ximage->ximage);
|
XDestroyImage (ximage->ximage);
|
||||||
|
|
||||||
if (ximage->SHMInfo.shmaddr)
|
if (ximage->SHMInfo.shmaddr)
|
||||||
shmdt(ximage->SHMInfo.shmaddr);
|
shmdt (ximage->SHMInfo.shmaddr);
|
||||||
|
|
||||||
if (ximage->SHMInfo.shmid > 0)
|
if (ximage->SHMInfo.shmid > 0)
|
||||||
shmctl(ximage->SHMInfo.shmid, IPC_RMID, 0);
|
shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ximage->ximage)
|
if (ximage->ximage)
|
||||||
XDestroyImage(ximage->ximage);
|
XDestroyImage (ximage->ximage);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (ximage->ximage)
|
if (ximage->ximage)
|
||||||
XDestroyImage(ximage->ximage);
|
XDestroyImage (ximage->ximage);
|
||||||
#endif /* HAVE_XSHM */
|
#endif /* HAVE_XSHM */
|
||||||
|
|
||||||
g_mutex_unlock (ximagesink->x_lock);
|
g_mutex_unlock (ximagesink->x_lock);
|
||||||
|
@ -367,11 +367,16 @@ gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad)
|
||||||
if ( (ximagesink->xwindow->width != e.xconfigure.width) ||
|
if ( (ximagesink->xwindow->width != e.xconfigure.width) ||
|
||||||
(ximagesink->xwindow->height != e.xconfigure.height) )
|
(ximagesink->xwindow->height != e.xconfigure.height) )
|
||||||
gst_pad_try_set_caps (ximagesink->sinkpad,
|
gst_pad_try_set_caps (ximagesink->sinkpad,
|
||||||
GST_CAPS_NEW ("ximagesink_videoscaling",
|
GST_CAPS_NEW ("ximagesink_ximage_caps", "video/x-raw-rgb",
|
||||||
"video/x-raw-rgb",
|
"bpp", GST_PROPS_INT (ximagesink->xcontext->bpp),
|
||||||
"framerate", GST_PROPS_FLOAT (30),
|
"depth", GST_PROPS_INT (ximagesink->xcontext->depth),
|
||||||
"width", GST_PROPS_INT (e.xconfigure.width),
|
"endianness", GST_PROPS_INT (ximagesink->xcontext->endianness),
|
||||||
"height", GST_PROPS_INT (e.xconfigure.height)));
|
"red_mask", GST_PROPS_INT (ximagesink->xcontext->visual->red_mask),
|
||||||
|
"green_mask", GST_PROPS_INT (ximagesink->xcontext->visual->green_mask),
|
||||||
|
"blue_mask", GST_PROPS_INT (ximagesink->xcontext->visual->blue_mask),
|
||||||
|
"width", GST_PROPS_INT (e.xconfigure.width),
|
||||||
|
"height", GST_PROPS_INT (e.xconfigure.height),
|
||||||
|
"framerate", GST_PROPS_FLOAT (30)));
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
/* Mouse pointer moved over our window. We send upstream
|
/* Mouse pointer moved over our window. We send upstream
|
||||||
|
@ -439,17 +444,21 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
|
||||||
XPixmapFormatValues *px_formats = NULL;
|
XPixmapFormatValues *px_formats = NULL;
|
||||||
gint nb_formats = 0, i;
|
gint nb_formats = 0, i;
|
||||||
|
|
||||||
|
g_return_val_if_fail (ximagesink != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
|
||||||
|
|
||||||
xcontext = g_new0 (GstXContext, 1);
|
xcontext = g_new0 (GstXContext, 1);
|
||||||
|
|
||||||
g_mutex_lock (ximagesink->x_lock);
|
g_mutex_lock (ximagesink->x_lock);
|
||||||
|
|
||||||
xcontext->disp = XOpenDisplay (NULL);
|
xcontext->disp = XOpenDisplay (NULL);
|
||||||
|
|
||||||
if (!xcontext->disp) {
|
if (!xcontext->disp)
|
||||||
g_mutex_unlock (ximagesink->x_lock);
|
{
|
||||||
g_free (xcontext);
|
g_mutex_unlock (ximagesink->x_lock);
|
||||||
return NULL;
|
g_free (xcontext);
|
||||||
}
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
xcontext->screen = DefaultScreenOfDisplay (xcontext->disp);
|
xcontext->screen = DefaultScreenOfDisplay (xcontext->disp);
|
||||||
xcontext->screen_num = DefaultScreen (xcontext->disp);
|
xcontext->screen_num = DefaultScreen (xcontext->disp);
|
||||||
|
@ -495,12 +504,15 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_XSHM */
|
#endif /* HAVE_XSHM */
|
||||||
|
|
||||||
if (xcontext->endianness == G_LITTLE_ENDIAN && xcontext->depth == 24) {
|
/* What the hell is that ? */
|
||||||
xcontext->endianness = G_BIG_ENDIAN;
|
if (xcontext->endianness == G_LITTLE_ENDIAN && xcontext->depth == 24)
|
||||||
xcontext->visual->red_mask = GUINT32_SWAP_LE_BE (xcontext->visual->red_mask);
|
{
|
||||||
xcontext->visual->green_mask = GUINT32_SWAP_LE_BE (xcontext->visual->green_mask);
|
xcontext->endianness = G_BIG_ENDIAN;
|
||||||
xcontext->visual->blue_mask = GUINT32_SWAP_LE_BE (xcontext->visual->blue_mask);
|
xcontext->visual->red_mask = GUINT32_SWAP_LE_BE (xcontext->visual->red_mask);
|
||||||
}
|
xcontext->visual->green_mask = GUINT32_SWAP_LE_BE (xcontext->visual->green_mask);
|
||||||
|
xcontext->visual->blue_mask = GUINT32_SWAP_LE_BE (xcontext->visual->blue_mask);
|
||||||
|
}
|
||||||
|
|
||||||
xcontext->caps = GST_CAPS_NEW ("ximagesink_ximage_caps", "video/x-raw-rgb",
|
xcontext->caps = GST_CAPS_NEW ("ximagesink_ximage_caps", "video/x-raw-rgb",
|
||||||
"bpp", GST_PROPS_INT (xcontext->bpp),
|
"bpp", GST_PROPS_INT (xcontext->bpp),
|
||||||
"depth", GST_PROPS_INT (xcontext->depth),
|
"depth", GST_PROPS_INT (xcontext->depth),
|
||||||
|
@ -997,10 +1009,9 @@ gst_ximagesink_get_type (void)
|
||||||
NULL,
|
NULL,
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
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);
|
||||||
|
@ -1016,7 +1027,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;
|
||||||
|
|
Loading…
Reference in a new issue