mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
ximage: fix alignment and size
Set the right alignment and size in the bufferpool.
This commit is contained in:
parent
1c8324a0d1
commit
a8971beee0
2 changed files with 15 additions and 6 deletions
|
@ -1068,6 +1068,7 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
const GValue *par;
|
const GValue *par;
|
||||||
gint new_width, new_height;
|
gint new_width, new_height;
|
||||||
const GValue *fps;
|
const GValue *fps;
|
||||||
|
gint size;
|
||||||
|
|
||||||
ximagesink = GST_XIMAGESINK (bsink);
|
ximagesink = GST_XIMAGESINK (bsink);
|
||||||
|
|
||||||
|
@ -1092,6 +1093,9 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (!gst_video_get_size_from_caps (caps, &size))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* if the caps contain pixel-aspect-ratio, they have to match ours,
|
/* if the caps contain pixel-aspect-ratio, they have to match ours,
|
||||||
* otherwise linking should fail */
|
* otherwise linking should fail */
|
||||||
par = gst_structure_get_value (structure, "pixel-aspect-ratio");
|
par = gst_structure_get_value (structure, "pixel-aspect-ratio");
|
||||||
|
@ -1138,7 +1142,7 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
newpool = gst_ximage_buffer_pool_new (ximagesink);
|
newpool = gst_ximage_buffer_pool_new (ximagesink);
|
||||||
|
|
||||||
structure = gst_buffer_pool_get_config (newpool);
|
structure = gst_buffer_pool_get_config (newpool);
|
||||||
gst_buffer_pool_config_set (structure, caps, 0, 0, 0, 0, 16);
|
gst_buffer_pool_config_set (structure, caps, size, 0, 0, 0, 15);
|
||||||
if (!gst_buffer_pool_set_config (newpool, structure))
|
if (!gst_buffer_pool_set_config (newpool, structure))
|
||||||
goto config_failed;
|
goto config_failed;
|
||||||
|
|
||||||
|
@ -1459,11 +1463,11 @@ gst_ximagesink_sink_query (GstPad * sinkpad, GstQuery * query)
|
||||||
size = gst_video_format_get_size (format, width, height);
|
size = gst_video_format_get_size (format, width, height);
|
||||||
|
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 16);
|
gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 15);
|
||||||
if (!gst_buffer_pool_set_config (pool, config))
|
if (!gst_buffer_pool_set_config (pool, config))
|
||||||
goto config_failed;
|
goto config_failed;
|
||||||
}
|
}
|
||||||
gst_query_set_allocation_params (query, size, 0, 0, 0, 16, pool);
|
gst_query_set_allocation_params (query, size, 0, 0, 0, 15, pool);
|
||||||
|
|
||||||
/* we also support various metadata */
|
/* we also support various metadata */
|
||||||
gst_query_add_allocation_meta (query, GST_META_API_VIDEO);
|
gst_query_add_allocation_meta (query, GST_META_API_VIDEO);
|
||||||
|
|
|
@ -1553,6 +1553,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
const GValue *caps_disp_reg;
|
const GValue *caps_disp_reg;
|
||||||
const GValue *fps;
|
const GValue *fps;
|
||||||
guint num, den;
|
guint num, den;
|
||||||
|
gint size;
|
||||||
|
|
||||||
xvimagesink = GST_XVIMAGESINK (bsink);
|
xvimagesink = GST_XVIMAGESINK (bsink);
|
||||||
|
|
||||||
|
@ -1582,6 +1583,9 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
if (im_format == -1)
|
if (im_format == -1)
|
||||||
goto invalid_format;
|
goto invalid_format;
|
||||||
|
|
||||||
|
if (!gst_video_get_size_from_caps (caps, &size))
|
||||||
|
goto invalid_format;
|
||||||
|
|
||||||
/* get aspect ratio from caps if it's present, and
|
/* get aspect ratio from caps if it's present, and
|
||||||
* convert video width and height to a display width and height
|
* convert video width and height to a display width and height
|
||||||
* using wd / hd = wv / hv * PARv / PARd */
|
* using wd / hd = wv / hv * PARv / PARd */
|
||||||
|
@ -1685,7 +1689,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
newpool = gst_xvimage_buffer_pool_new (xvimagesink);
|
newpool = gst_xvimage_buffer_pool_new (xvimagesink);
|
||||||
|
|
||||||
structure = gst_buffer_pool_get_config (newpool);
|
structure = gst_buffer_pool_get_config (newpool);
|
||||||
gst_buffer_pool_config_set (structure, caps, 0, 0, 0, 0, 16);
|
gst_buffer_pool_config_set (structure, caps, size, 0, 0, 0, 15);
|
||||||
if (!gst_buffer_pool_set_config (newpool, structure))
|
if (!gst_buffer_pool_set_config (newpool, structure))
|
||||||
goto config_failed;
|
goto config_failed;
|
||||||
|
|
||||||
|
@ -1994,6 +1998,7 @@ gst_xvimagesink_sink_query (GstPad * sinkpad, GstQuery * query)
|
||||||
const GstCaps *pcaps;
|
const GstCaps *pcaps;
|
||||||
|
|
||||||
/* we had a pool, check caps */
|
/* we had a pool, check caps */
|
||||||
|
GST_DEBUG_OBJECT (xvimagesink, "check existing pool caps");
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL,
|
gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -2019,11 +2024,11 @@ gst_xvimagesink_sink_query (GstPad * sinkpad, GstQuery * query)
|
||||||
size = gst_video_format_get_size (format, width, height);
|
size = gst_video_format_get_size (format, width, height);
|
||||||
|
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 16);
|
gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 15);
|
||||||
if (!gst_buffer_pool_set_config (pool, config))
|
if (!gst_buffer_pool_set_config (pool, config))
|
||||||
goto config_failed;
|
goto config_failed;
|
||||||
}
|
}
|
||||||
gst_query_set_allocation_params (query, size, 0, 0, 0, 16, pool);
|
gst_query_set_allocation_params (query, size, 0, 0, 0, 15, pool);
|
||||||
|
|
||||||
/* we also support various metadata */
|
/* we also support various metadata */
|
||||||
gst_query_add_allocation_meta (query, GST_META_API_VIDEO);
|
gst_query_add_allocation_meta (query, GST_META_API_VIDEO);
|
||||||
|
|
Loading…
Reference in a new issue