mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 05:22:30 +00:00
take padding into account
This commit is contained in:
parent
98c681fe5b
commit
751fcf035b
12 changed files with 49 additions and 35 deletions
|
@ -346,7 +346,7 @@ gst_aasink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
size = GST_VIDEO_INFO_SIZE (&info);
|
||||
|
||||
/* we need at least 2 buffer because we hold on to the last one */
|
||||
gst_query_set_allocation_params (query, size, 2, 0, 0, 0, NULL);
|
||||
gst_query_set_allocation_params (query, size, 2, 0, 0, 0, 0, NULL);
|
||||
|
||||
/* we support various metadata */
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
|
||||
|
|
|
@ -253,7 +253,7 @@ gst_dvdec_negotiate_pool (GstDVDec * dec, GstCaps * caps, GstVideoInfo * info)
|
|||
{
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, alignment;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
GstStructure *config;
|
||||
|
||||
/* find a pool for the negotiated caps now */
|
||||
|
@ -263,13 +263,14 @@ gst_dvdec_negotiate_pool (GstDVDec * dec, GstCaps * caps, GstVideoInfo * info)
|
|||
GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints");
|
||||
/* we got configuration from our peer, parse them */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&alignment, &pool);
|
||||
&padding, &alignment, &pool);
|
||||
size = MAX (size, info->size);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
|
||||
size = info->size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
|
@ -283,7 +284,8 @@ gst_dvdec_negotiate_pool (GstDVDec * dec, GstCaps * caps, GstVideoInfo * info)
|
|||
dec->pool = pool;
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, alignment);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding,
|
||||
alignment);
|
||||
/* just set the option, if the pool can support it we will transparently use
|
||||
* it through the video info API. We could also see if the pool support this
|
||||
* option and only activate it then. */
|
||||
|
|
|
@ -225,7 +225,7 @@ gst_gdk_pixbuf_setup_pool (GstGdkPixbuf * filter, GstVideoInfo * info)
|
|||
GstCaps *target;
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, alignment;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
|
||||
target = gst_pad_get_current_caps (filter->srcpad);
|
||||
|
||||
|
@ -236,11 +236,12 @@ gst_gdk_pixbuf_setup_pool (GstGdkPixbuf * filter, GstVideoInfo * info)
|
|||
if (gst_pad_peer_query (filter->srcpad, query)) {
|
||||
/* we got configuration from our peer, parse them */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&alignment, &pool);
|
||||
&padding, &alignment, &pool);
|
||||
} else {
|
||||
size = info->size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
|
@ -252,7 +253,7 @@ gst_gdk_pixbuf_setup_pool (GstGdkPixbuf * filter, GstVideoInfo * info)
|
|||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set (config, target, size, min, max, prefix,
|
||||
alignment);
|
||||
padding, alignment);
|
||||
gst_buffer_pool_set_config (pool, config);
|
||||
}
|
||||
|
||||
|
|
|
@ -1164,7 +1164,7 @@ gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
|
|||
{
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, alignment;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
GstStructure *config;
|
||||
|
||||
GST_DEBUG_OBJECT (dec, "setting up bufferpool");
|
||||
|
@ -1175,13 +1175,14 @@ gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
|
|||
if (gst_pad_peer_query (dec->srcpad, query)) {
|
||||
/* we got configuration from our peer, parse them */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&alignment, &pool);
|
||||
&padding, &alignment, &pool);
|
||||
size = MAX (size, dec->info.size);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (dec, "peer query failed, using defaults");
|
||||
size = dec->info.size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 15;
|
||||
}
|
||||
gst_query_unref (query);
|
||||
|
@ -1193,7 +1194,7 @@ gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
|
|||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, prefix,
|
||||
alignment | 15);
|
||||
padding, alignment | 15);
|
||||
/* and store */
|
||||
gst_buffer_pool_set_config (pool, config);
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ gst_pngdec_negotiate_pool (GstPngDec * dec, GstCaps * caps, GstVideoInfo * info)
|
|||
{
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, alignment;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
GstStructure *config;
|
||||
|
||||
/* find a pool for the negotiated caps now */
|
||||
|
@ -348,13 +348,14 @@ gst_pngdec_negotiate_pool (GstPngDec * dec, GstCaps * caps, GstVideoInfo * info)
|
|||
GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints");
|
||||
/* we got configuration from our peer, parse them */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&alignment, &pool);
|
||||
&padding, &alignment, &pool);
|
||||
size = MAX (size, info->size);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
|
||||
size = info->size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
|
@ -368,7 +369,8 @@ gst_pngdec_negotiate_pool (GstPngDec * dec, GstCaps * caps, GstVideoInfo * info)
|
|||
dec->pool = pool;
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, alignment);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding,
|
||||
alignment);
|
||||
/* just set the option, if the pool can support it we will transparently use
|
||||
* it through the video info API. We could also see if the pool support this
|
||||
* option and only activate it then. */
|
||||
|
|
|
@ -255,7 +255,7 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
GstCaps *templ;
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, alignment;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
|
||||
templ = gst_pad_get_pad_template_caps (goom->srcpad);
|
||||
|
||||
|
@ -291,11 +291,12 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
if (gst_pad_peer_query (goom->srcpad, query)) {
|
||||
/* we got configuration from our peer, parse them */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&alignment, &pool);
|
||||
&padding, &alignment, &pool);
|
||||
} else {
|
||||
size = goom->outsize;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
|
@ -307,7 +308,7 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set (config, target, size, min, max, prefix,
|
||||
alignment);
|
||||
padding, alignment);
|
||||
gst_buffer_pool_set_config (pool, config);
|
||||
}
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
GstCaps *templ;
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, alignment;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
|
||||
templ = gst_pad_get_pad_template_caps (goom->srcpad);
|
||||
|
||||
|
@ -288,11 +288,12 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
if (gst_pad_peer_query (goom->srcpad, query)) {
|
||||
/* we got configuration from our peer, parse them */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&alignment, &pool);
|
||||
&padding, &alignment, &pool);
|
||||
} else {
|
||||
size = goom->outsize;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
|
@ -304,7 +305,7 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set (config, target, size, min, max, prefix,
|
||||
alignment);
|
||||
padding, alignment);
|
||||
gst_buffer_pool_set_config (pool, config);
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ gst_rtp_vraw_depay_negotiate_pool (GstRtpVRawDepay * depay, GstCaps * caps,
|
|||
{
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, alignment;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
GstStructure *config;
|
||||
|
||||
/* find a pool for the negotiated caps now */
|
||||
|
@ -128,12 +128,13 @@ gst_rtp_vraw_depay_negotiate_pool (GstRtpVRawDepay * depay, GstCaps * caps,
|
|||
GST_DEBUG_OBJECT (depay, "got downstream ALLOCATION hints");
|
||||
/* we got configuration from our peer, parse them */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&alignment, &pool);
|
||||
&padding, &alignment, &pool);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (depay, "didn't get downstream ALLOCATION hints");
|
||||
size = info->size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
|
@ -147,7 +148,8 @@ gst_rtp_vraw_depay_negotiate_pool (GstRtpVRawDepay * depay, GstCaps * caps,
|
|||
depay->pool = pool;
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, alignment);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding,
|
||||
alignment);
|
||||
/* just set the metadata, if the pool can support it we will transparently use
|
||||
* it through the video info API. We could also see if the pool support this
|
||||
* metadata and only activate it then. */
|
||||
|
|
|
@ -244,7 +244,7 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
|
|||
GstV4l2Object *obj = pool->obj;
|
||||
const GstCaps *caps;
|
||||
guint size, min_buffers, max_buffers;
|
||||
guint prefix, align;
|
||||
guint prefix, padding, align;
|
||||
|
||||
GST_DEBUG_OBJECT (pool, "set config");
|
||||
|
||||
|
@ -267,7 +267,7 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
|
|||
|
||||
/* parse the config and keep around */
|
||||
if (!gst_buffer_pool_config_get (config, &caps, &size, &min_buffers,
|
||||
&max_buffers, &prefix, &align))
|
||||
&max_buffers, &prefix, &padding, &align))
|
||||
goto wrong_config;
|
||||
|
||||
GST_DEBUG_OBJECT (pool, "config %" GST_PTR_FORMAT, config);
|
||||
|
@ -276,10 +276,11 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
|
|||
pool->max_buffers = MAX (min_buffers, max_buffers);
|
||||
pool->min_buffers = MIN (pool->max_buffers, min_buffers);
|
||||
pool->prefix = prefix;
|
||||
pool->padding = padding;
|
||||
pool->align = align;
|
||||
|
||||
gst_buffer_pool_config_set (config, caps, size, min_buffers,
|
||||
max_buffers, prefix, align);
|
||||
max_buffers, prefix, padding, align);
|
||||
|
||||
return GST_BUFFER_POOL_CLASS (parent_class)->set_config (bpool, config);
|
||||
|
||||
|
@ -888,7 +889,7 @@ gst_v4l2_buffer_pool_new (GstV4l2Object * obj, GstCaps * caps)
|
|||
pool->obj = obj;
|
||||
|
||||
s = gst_buffer_pool_get_config (GST_BUFFER_POOL_CAST (pool));
|
||||
gst_buffer_pool_config_set (s, caps, obj->sizeimage, 2, 0, 0, 0);
|
||||
gst_buffer_pool_config_set (s, caps, obj->sizeimage, 2, 0, 0, 0, 0);
|
||||
gst_buffer_pool_set_config (GST_BUFFER_POOL_CAST (pool), s);
|
||||
|
||||
return GST_BUFFER_POOL (pool);
|
||||
|
|
|
@ -56,6 +56,7 @@ struct _GstV4l2BufferPool
|
|||
guint min_buffers;
|
||||
guint max_buffers;
|
||||
guint prefix;
|
||||
guint padding;
|
||||
guint align;
|
||||
gboolean add_videometa;
|
||||
|
||||
|
|
|
@ -640,7 +640,8 @@ gst_v4l2sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
|
||||
/* we had a pool, check caps */
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL);
|
||||
gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
|
||||
GST_DEBUG_OBJECT (v4l2sink,
|
||||
"we had a pool with caps %" GST_PTR_FORMAT, pcaps);
|
||||
|
@ -650,7 +651,7 @@ gst_v4l2sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
}
|
||||
}
|
||||
/* we need at least 2 buffers to operate */
|
||||
gst_query_set_allocation_params (query, size, 2, 0, 0, 0, pool);
|
||||
gst_query_set_allocation_params (query, size, 2, 0, 0, 0, 0, pool);
|
||||
|
||||
/* we also support various metadata */
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
|
||||
|
|
|
@ -511,17 +511,17 @@ gst_v4l2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
|
|||
GstV4l2Src *src;
|
||||
GstV4l2Object *obj;
|
||||
GstBufferPool *pool;
|
||||
guint size, min, max, prefix, alignment;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
|
||||
src = GST_V4L2SRC (bsrc);
|
||||
obj = src->v4l2object;
|
||||
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&alignment, &pool);
|
||||
&padding, &alignment, &pool);
|
||||
|
||||
GST_DEBUG_OBJECT (src, "allocation: size:%u min:%u max:%u prefix:%u "
|
||||
"align:%u pool:%" GST_PTR_FORMAT, size, min, max, prefix, alignment,
|
||||
pool);
|
||||
"padding: %u align:%u pool:%" GST_PTR_FORMAT, size, min, max,
|
||||
prefix, padding, alignment, pool);
|
||||
|
||||
if (min != 0) {
|
||||
/* if there is a min-buffers suggestion, use it. We add 1 because we need 1
|
||||
|
@ -569,8 +569,9 @@ gst_v4l2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
|
|||
const GstCaps *caps;
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, prefix,
|
||||
gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding,
|
||||
alignment);
|
||||
|
||||
/* if downstream supports video metadata, add this to the pool config */
|
||||
|
@ -581,7 +582,7 @@ gst_v4l2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
|
|||
gst_buffer_pool_set_config (pool, config);
|
||||
}
|
||||
|
||||
gst_query_set_allocation_params (query, size, min, max, prefix,
|
||||
gst_query_set_allocation_params (query, size, min, max, prefix, padding,
|
||||
alignment, pool);
|
||||
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in a new issue