mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
xvimage: avoid caps intersection
Store the video format in the XvImage format list so that we can quickly map between the two.
This commit is contained in:
parent
8fe31fa12e
commit
515d4a9a6d
4 changed files with 12 additions and 15 deletions
|
@ -516,8 +516,7 @@ xvimage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
GST_LOG_OBJECT (pool, "%dx%d, caps %" GST_PTR_FORMAT, info.width, info.height,
|
GST_LOG_OBJECT (pool, "%dx%d, caps %" GST_PTR_FORMAT, info.width, info.height,
|
||||||
caps);
|
caps);
|
||||||
|
|
||||||
priv->im_format =
|
priv->im_format = gst_xvimagesink_get_format_from_info (xvpool->sink, &info);
|
||||||
gst_xvimagesink_get_format_from_caps (xvpool->sink, (GstCaps *) caps);
|
|
||||||
if (priv->im_format == -1)
|
if (priv->im_format == -1)
|
||||||
goto unknown_format;
|
goto unknown_format;
|
||||||
|
|
||||||
|
@ -712,8 +711,8 @@ gst_xvimage_buffer_pool_finalize (GObject * object)
|
||||||
/* This function tries to get a format matching with a given caps in the
|
/* This function tries to get a format matching with a given caps in the
|
||||||
supported list of formats we generated in gst_xvimagesink_get_xv_support */
|
supported list of formats we generated in gst_xvimagesink_get_xv_support */
|
||||||
gint
|
gint
|
||||||
gst_xvimagesink_get_format_from_caps (GstXvImageSink * xvimagesink,
|
gst_xvimagesink_get_format_from_info (GstXvImageSink * xvimagesink,
|
||||||
GstCaps * caps)
|
GstVideoInfo * info)
|
||||||
{
|
{
|
||||||
GList *list = NULL;
|
GList *list = NULL;
|
||||||
|
|
||||||
|
@ -724,11 +723,9 @@ gst_xvimagesink_get_format_from_caps (GstXvImageSink * xvimagesink,
|
||||||
while (list) {
|
while (list) {
|
||||||
GstXvImageFormat *format = list->data;
|
GstXvImageFormat *format = list->data;
|
||||||
|
|
||||||
if (format) {
|
if (format && format->vformat == GST_VIDEO_INFO_FORMAT (info))
|
||||||
if (gst_caps_can_intersect (caps, format->caps)) {
|
return format->format;
|
||||||
return format->format;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list = g_list_next (list);
|
list = g_list_next (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,8 @@ GstBufferPool *gst_xvimage_buffer_pool_new (GstXvImageSink * xvimagesink);
|
||||||
gboolean gst_xvimagesink_check_xshm_calls (GstXvImageSink * xvimagesink,
|
gboolean gst_xvimagesink_check_xshm_calls (GstXvImageSink * xvimagesink,
|
||||||
GstXContext * xcontext);
|
GstXContext * xcontext);
|
||||||
|
|
||||||
gint gst_xvimagesink_get_format_from_caps (GstXvImageSink * xvimagesink,
|
gint gst_xvimagesink_get_format_from_info (GstXvImageSink * xvimagesink,
|
||||||
GstCaps * caps);
|
GstVideoInfo * info);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -1043,6 +1043,7 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
|
||||||
for (i = 0; i < nb_formats; i++) {
|
for (i = 0; i < nb_formats; i++) {
|
||||||
GstCaps *format_caps = NULL;
|
GstCaps *format_caps = NULL;
|
||||||
gboolean is_rgb_format = FALSE;
|
gboolean is_rgb_format = FALSE;
|
||||||
|
GstVideoFormat vformat;
|
||||||
|
|
||||||
/* We set the image format of the xcontext to an existing one. This
|
/* We set the image format of the xcontext to an existing one. This
|
||||||
is just some valid image format for making our xshm calls check before
|
is just some valid image format for making our xshm calls check before
|
||||||
|
@ -1054,7 +1055,6 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
|
||||||
{
|
{
|
||||||
XvImageFormatValues *fmt = &(formats[i]);
|
XvImageFormatValues *fmt = &(formats[i]);
|
||||||
gint endianness;
|
gint endianness;
|
||||||
GstVideoFormat vformat;
|
|
||||||
|
|
||||||
endianness =
|
endianness =
|
||||||
(fmt->byte_order == LSBFirst ? G_LITTLE_ENDIAN : G_BIG_ENDIAN);
|
(fmt->byte_order == LSBFirst ? G_LITTLE_ENDIAN : G_BIG_ENDIAN);
|
||||||
|
@ -1075,8 +1075,6 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
|
||||||
}
|
}
|
||||||
case XvYUV:
|
case XvYUV:
|
||||||
{
|
{
|
||||||
GstVideoFormat vformat;
|
|
||||||
|
|
||||||
vformat = gst_video_format_from_fourcc (formats[i].id);
|
vformat = gst_video_format_from_fourcc (formats[i].id);
|
||||||
if (vformat == GST_VIDEO_FORMAT_UNKNOWN)
|
if (vformat == GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
break;
|
break;
|
||||||
|
@ -1099,6 +1097,7 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
|
||||||
format = g_new0 (GstXvImageFormat, 1);
|
format = g_new0 (GstXvImageFormat, 1);
|
||||||
if (format) {
|
if (format) {
|
||||||
format->format = formats[i].id;
|
format->format = formats[i].id;
|
||||||
|
format->vformat = vformat;
|
||||||
format->caps = gst_caps_copy (format_caps);
|
format->caps = gst_caps_copy (format_caps);
|
||||||
xcontext->formats_list = g_list_append (xcontext->formats_list, format);
|
xcontext->formats_list = g_list_append (xcontext->formats_list, format);
|
||||||
}
|
}
|
||||||
|
@ -1565,7 +1564,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
xvimagesink->video_width = info.width;
|
xvimagesink->video_width = info.width;
|
||||||
xvimagesink->video_height = info.height;
|
xvimagesink->video_height = info.height;
|
||||||
|
|
||||||
im_format = gst_xvimagesink_get_format_from_caps (xvimagesink, caps);
|
im_format = gst_xvimagesink_get_format_from_info (xvimagesink, &info);
|
||||||
if (im_format == -1)
|
if (im_format == -1)
|
||||||
goto invalid_format;
|
goto invalid_format;
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,7 @@ struct _GstXWindow
|
||||||
struct _GstXvImageFormat
|
struct _GstXvImageFormat
|
||||||
{
|
{
|
||||||
gint format;
|
gint format;
|
||||||
|
GstVideoFormat vformat;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue