update for allocation query changes

This commit is contained in:
Wim Taymans 2012-03-15 20:37:56 +01:00
parent 6ed3bc109b
commit f3a770a20c
11 changed files with 165 additions and 138 deletions

View file

@ -346,7 +346,7 @@ gst_aasink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
size = GST_VIDEO_INFO_SIZE (&info); size = GST_VIDEO_INFO_SIZE (&info);
/* we need at least 2 buffer because we hold on to the last one */ /* 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, 0, NULL); gst_query_add_allocation_pool (query, NULL, size, 2, 0);
/* we support various metadata */ /* we support various metadata */
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE); gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);

View file

@ -44,6 +44,7 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h> #include <gst/video/gstvideopool.h>
#include "gstdvdec.h" #include "gstdvdec.h"
@ -252,46 +253,50 @@ static void
gst_dvdec_negotiate_pool (GstDVDec * dec, GstCaps * caps, GstVideoInfo * info) gst_dvdec_negotiate_pool (GstDVDec * dec, GstCaps * caps, GstVideoInfo * info)
{ {
GstQuery *query; GstQuery *query;
GstBufferPool *pool = NULL; GstBufferPool *pool;
guint size, min, max, prefix, padding, alignment; guint size, min, max;
GstStructure *config; GstStructure *config;
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
query = gst_query_new_allocation (caps, TRUE); query = gst_query_new_allocation (caps, TRUE);
if (gst_pad_peer_query (dec->srcpad, query)) { if (!gst_pad_peer_query (dec->srcpad, query)) {
GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints"); GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
}
if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */ /* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
&padding, &alignment, &pool);
size = MAX (size, info->size); size = MAX (size, info->size);
} else { } else {
GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints"); pool = NULL;
size = info->size; size = info->size;
min = max = 0; min = max = 0;
prefix = 0;
padding = 0;
alignment = 0;
} }
if (pool == NULL) { if (pool == NULL) {
/* we did not get a pool, make one ourselves then */ /* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new (); pool = gst_video_buffer_pool_new ();
} }
if (dec->pool) if (dec->pool) {
gst_buffer_pool_set_active (dec->pool, FALSE);
gst_object_unref (dec->pool); gst_object_unref (dec->pool);
}
dec->pool = pool; dec->pool = pool;
config = gst_buffer_pool_get_config (pool); config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding, gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
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. */
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
/* 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. */
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
}
gst_buffer_pool_set_config (pool, config); gst_buffer_pool_set_config (pool, config);
/* and activate */ /* and activate */
gst_buffer_pool_set_active (pool, TRUE); gst_buffer_pool_set_active (pool, TRUE);

View file

@ -224,8 +224,9 @@ gst_gdk_pixbuf_setup_pool (GstGdkPixbuf * filter, GstVideoInfo * info)
{ {
GstCaps *target; GstCaps *target;
GstQuery *query; GstQuery *query;
GstBufferPool *pool = NULL; GstBufferPool *pool;
guint size, min, max, prefix, padding, alignment; GstStructure *config;
guint size, min, max;
target = gst_pad_get_current_caps (filter->srcpad); target = gst_pad_get_current_caps (filter->srcpad);
@ -233,32 +234,34 @@ gst_gdk_pixbuf_setup_pool (GstGdkPixbuf * filter, GstVideoInfo * info)
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE); query = gst_query_new_allocation (target, TRUE);
if (gst_pad_peer_query (filter->srcpad, query)) { if (!gst_pad_peer_query (filter->srcpad, query)) {
/* not a problem, we use the query defaults */
GST_DEBUG_OBJECT (filter, "ALLOCATION query failed");
}
if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */ /* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
&padding, &alignment, &pool);
} else { } else {
pool = NULL;
size = info->size; size = info->size;
min = max = 0; min = max = 0;
prefix = 0;
padding = 0;
alignment = 0;
} }
if (pool == NULL) { if (pool == NULL) {
GstStructure *config;
/* we did not get a pool, make one ourselves then */ /* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new (); pool = gst_buffer_pool_new ();
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, target, size, min, max, prefix,
padding, alignment);
gst_buffer_pool_set_config (pool, config);
} }
if (filter->pool) /* and configure */
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
gst_buffer_pool_set_config (pool, config);
if (filter->pool) {
gst_buffer_pool_set_active (filter->pool, FALSE);
gst_object_unref (filter->pool); gst_object_unref (filter->pool);
}
filter->pool = pool; filter->pool = pool;
/* and activate */ /* and activate */

View file

@ -1163,8 +1163,8 @@ static gboolean
gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps) gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
{ {
GstQuery *query; GstQuery *query;
GstBufferPool *pool = NULL; GstBufferPool *pool;
guint size, min, max, prefix, padding, alignment; guint size, min, max;
GstStructure *config; GstStructure *config;
GST_DEBUG_OBJECT (dec, "setting up bufferpool"); GST_DEBUG_OBJECT (dec, "setting up bufferpool");
@ -1172,18 +1172,18 @@ gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
query = gst_query_new_allocation (caps, TRUE); query = gst_query_new_allocation (caps, TRUE);
if (gst_pad_peer_query (dec->srcpad, query)) { if (!gst_pad_peer_query (dec->srcpad, query)) {
GST_DEBUG_OBJECT (dec, "peer query failed, using defaults");
}
if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */ /* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
&padding, &alignment, &pool);
size = MAX (size, dec->info.size); size = MAX (size, dec->info.size);
} else { } else {
GST_DEBUG_OBJECT (dec, "peer query failed, using defaults"); pool = NULL;
size = dec->info.size; size = dec->info.size;
min = max = 0; min = max = 0;
prefix = 0;
padding = 0;
alignment = 15;
} }
gst_query_unref (query); gst_query_unref (query);
@ -1193,8 +1193,7 @@ gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
} }
config = gst_buffer_pool_get_config (pool); config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 15);
padding, alignment | 15);
/* and store */ /* and store */
gst_buffer_pool_set_config (pool, config); gst_buffer_pool_set_config (pool, config);

View file

@ -28,6 +28,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h>
#include <gst/gst-i18n-plugin.h> #include <gst/gst-i18n-plugin.h>
GST_DEBUG_CATEGORY_STATIC (pngdec_debug); GST_DEBUG_CATEGORY_STATIC (pngdec_debug);
@ -337,46 +339,50 @@ static GstFlowReturn
gst_pngdec_negotiate_pool (GstPngDec * dec, GstCaps * caps, GstVideoInfo * info) gst_pngdec_negotiate_pool (GstPngDec * dec, GstCaps * caps, GstVideoInfo * info)
{ {
GstQuery *query; GstQuery *query;
GstBufferPool *pool = NULL; GstBufferPool *pool;
guint size, min, max, prefix, padding, alignment; guint size, min, max;
GstStructure *config; GstStructure *config;
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
query = gst_query_new_allocation (caps, TRUE); query = gst_query_new_allocation (caps, TRUE);
if (gst_pad_peer_query (dec->srcpad, query)) { if (!gst_pad_peer_query (dec->srcpad, query)) {
GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints"); GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
}
if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */ /* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
&padding, &alignment, &pool);
size = MAX (size, info->size); size = MAX (size, info->size);
} else { } else {
GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints"); pool = NULL;
size = info->size; size = info->size;
min = max = 0; min = max = 0;
prefix = 0;
padding = 0;
alignment = 0;
} }
if (pool == NULL) { if (pool == NULL) {
/* we did not get a pool, make one ourselves then */ /* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new (); pool = gst_video_buffer_pool_new ();
} }
if (dec->pool) if (dec->pool) {
gst_buffer_pool_set_active (dec->pool, TRUE);
gst_object_unref (dec->pool); gst_object_unref (dec->pool);
}
dec->pool = pool; dec->pool = pool;
config = gst_buffer_pool_get_config (pool); config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding, gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
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. */
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
/* 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. */
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
}
gst_buffer_pool_set_config (pool, config); gst_buffer_pool_set_config (pool, config);
/* and activate */ /* and activate */
gst_buffer_pool_set_active (pool, TRUE); gst_buffer_pool_set_active (pool, TRUE);

View file

@ -254,8 +254,9 @@ gst_goom_src_negotiate (GstGoom * goom)
GstStructure *structure; GstStructure *structure;
GstCaps *templ; GstCaps *templ;
GstQuery *query; GstQuery *query;
GstBufferPool *pool = NULL; GstBufferPool *pool;
guint size, min, max, prefix, padding, alignment; GstStructure *config;
guint size, min, max;
templ = gst_pad_get_pad_template_caps (goom->srcpad); templ = gst_pad_get_pad_template_caps (goom->srcpad);
@ -288,32 +289,33 @@ gst_goom_src_negotiate (GstGoom * goom)
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE); query = gst_query_new_allocation (target, TRUE);
if (gst_pad_peer_query (goom->srcpad, query)) { if (!gst_pad_peer_query (goom->srcpad, query)) {
/* no problem, we use the query defaults */
GST_DEBUG_OBJECT (goom, "ALLOCATION query failed");
}
if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */ /* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
&padding, &alignment, &pool);
} else { } else {
pool = NULL;
size = goom->outsize; size = goom->outsize;
min = max = 0; min = max = 0;
prefix = 0;
padding = 0;
alignment = 0;
} }
if (pool == NULL) { if (pool == NULL) {
GstStructure *config;
/* we did not get a pool, make one ourselves then */ /* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new (); pool = gst_buffer_pool_new ();
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, target, size, min, max, prefix,
padding, alignment);
gst_buffer_pool_set_config (pool, config);
} }
if (goom->pool) config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
gst_buffer_pool_set_config (pool, config);
if (goom->pool) {
gst_buffer_pool_set_active (goom->pool, FALSE);
gst_object_unref (goom->pool); gst_object_unref (goom->pool);
}
goom->pool = pool; goom->pool = pool;
/* and activate */ /* and activate */

View file

@ -252,7 +252,8 @@ gst_goom_src_negotiate (GstGoom * goom)
GstCaps *templ; GstCaps *templ;
GstQuery *query; GstQuery *query;
GstBufferPool *pool = NULL; GstBufferPool *pool = NULL;
guint size, min, max, prefix, padding, alignment; GstStructure *config;
guint size, min, max;
templ = gst_pad_get_pad_template_caps (goom->srcpad); templ = gst_pad_get_pad_template_caps (goom->srcpad);
@ -281,36 +282,36 @@ gst_goom_src_negotiate (GstGoom * goom)
gst_goom_src_setcaps (goom, target); gst_goom_src_setcaps (goom, target);
/* try to get a bufferpool now */
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE); query = gst_query_new_allocation (target, TRUE);
if (gst_pad_peer_query (goom->srcpad, query)) { if (!gst_pad_peer_query (goom->srcpad, query)) {
/* no problem, we use the query defaults */
GST_DEBUG_OBJECT (goom, "ALLOCATION query failed");
}
if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */ /* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
&padding, &alignment, &pool);
} else { } else {
pool = NULL;
size = goom->outsize; size = goom->outsize;
min = max = 0; min = max = 0;
prefix = 0;
padding = 0;
alignment = 0;
} }
if (pool == NULL) { if (pool == NULL) {
GstStructure *config;
/* we did not get a pool, make one ourselves then */ /* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new (); pool = gst_buffer_pool_new ();
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, target, size, min, max, prefix,
padding, alignment);
gst_buffer_pool_set_config (pool, config);
} }
if (goom->pool) config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
gst_buffer_pool_set_config (pool, config);
if (goom->pool) {
gst_buffer_pool_set_active (goom->pool, FALSE);
gst_object_unref (goom->pool); gst_object_unref (goom->pool);
}
goom->pool = pool; goom->pool = pool;
/* and activate */ /* and activate */

View file

@ -226,8 +226,9 @@ gst_monoscope_src_negotiate (GstMonoscope * monoscope)
GstStructure *structure; GstStructure *structure;
GstCaps *templ; GstCaps *templ;
GstQuery *query; GstQuery *query;
GstBufferPool *pool = NULL; GstBufferPool *pool;
guint size, min, max, prefix, alignment; GstStructure *config;
guint size, min, max;
templ = gst_pad_get_pad_template_caps (monoscope->srcpad); templ = gst_pad_get_pad_template_caps (monoscope->srcpad);
@ -260,31 +261,31 @@ gst_monoscope_src_negotiate (GstMonoscope * monoscope)
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE); query = gst_query_new_allocation (target, TRUE);
if (gst_pad_peer_query (monoscope->srcpad, query)) { if (!gst_pad_peer_query (monoscope->srcpad, query)) {
}
if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */ /* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
&alignment, &pool);
} else { } else {
pool = NULL;
size = monoscope->outsize; size = monoscope->outsize;
min = max = 0; min = max = 0;
prefix = 0;
alignment = 0;
} }
if (pool == NULL) { if (pool == NULL) {
GstStructure *config;
/* we did not get a pool, make one ourselves then */ /* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new (); pool = gst_buffer_pool_new ();
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, target, size, min, max, prefix,
alignment);
gst_buffer_pool_set_config (pool, config);
} }
if (monoscope->pool) config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
gst_buffer_pool_set_config (pool, config);
if (monoscope->pool) {
gst_buffer_pool_set_active (monoscope->pool, TRUE);
gst_object_unref (monoscope->pool); gst_object_unref (monoscope->pool);
}
monoscope->pool = pool; monoscope->pool = pool;
/* and activate */ /* and activate */

View file

@ -118,29 +118,29 @@ gst_rtp_vraw_depay_negotiate_pool (GstRtpVRawDepay * depay, GstCaps * caps,
{ {
GstQuery *query; GstQuery *query;
GstBufferPool *pool = NULL; GstBufferPool *pool = NULL;
guint size, min, max, prefix, padding, alignment; guint size, min, max;
GstStructure *config; GstStructure *config;
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
query = gst_query_new_allocation (caps, TRUE); query = gst_query_new_allocation (caps, TRUE);
if (gst_pad_peer_query (GST_RTP_BASE_DEPAYLOAD_SRCPAD (depay), query)) { if (!gst_pad_peer_query (GST_RTP_BASE_DEPAYLOAD_SRCPAD (depay), query)) {
GST_DEBUG_OBJECT (depay, "got downstream ALLOCATION hints"); /* not a problem, we use the defaults of query */
GST_DEBUG_OBJECT (depay, "could not get downstream ALLOCATION hints");
}
if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */ /* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
&padding, &alignment, &pool);
} else { } else {
GST_DEBUG_OBJECT (depay, "didn't get downstream ALLOCATION hints"); GST_DEBUG_OBJECT (depay, "didn't get downstream pool hints");
size = info->size; size = info->size;
min = max = 0; min = max = 0;
prefix = 0;
padding = 0;
alignment = 0;
} }
if (pool == NULL) { if (pool == NULL) {
/* we did not get a pool, make one ourselves then */ /* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new (); pool = gst_video_buffer_pool_new ();
} }
if (depay->pool) if (depay->pool)
@ -148,12 +148,14 @@ gst_rtp_vraw_depay_negotiate_pool (GstRtpVRawDepay * depay, GstCaps * caps,
depay->pool = pool; depay->pool = pool;
config = gst_buffer_pool_get_config (pool); config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding, gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
alignment); if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
/* just set the metadata, if the pool can support it we will transparently use /* 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 * it through the video info API. We could also see if the pool support this
* metadata and only activate it then. */ * metadata and only activate it then. */
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
}
gst_buffer_pool_set_config (pool, config); gst_buffer_pool_set_config (pool, config);
/* and activate */ /* and activate */

View file

@ -651,7 +651,7 @@ gst_v4l2sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
} }
} }
/* we need at least 2 buffers to operate */ /* we need at least 2 buffers to operate */
gst_query_set_allocation_params (query, size, 2, 0, 0, 0, 0, pool); gst_query_add_allocation_pool (query, pool, size, 2, 0);
/* we also support various metadata */ /* we also support various metadata */
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE); gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);

View file

@ -511,17 +511,24 @@ gst_v4l2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
GstV4l2Src *src; GstV4l2Src *src;
GstV4l2Object *obj; GstV4l2Object *obj;
GstBufferPool *pool; GstBufferPool *pool;
guint size, min, max, prefix, padding, alignment; guint size, min, max;
gboolean update;
src = GST_V4L2SRC (bsrc); src = GST_V4L2SRC (bsrc);
obj = src->v4l2object; obj = src->v4l2object;
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, if (gst_query_get_n_allocation_pools (query) > 0) {
&padding, &alignment, &pool); gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
update = TRUE;
} else {
pool = NULL;
min = max = 0;
size = 0;
update = FALSE;
}
GST_DEBUG_OBJECT (src, "allocation: size:%u min:%u max:%u prefix:%u " GST_DEBUG_OBJECT (src, "allocation: size:%u min:%u max:%u pool:%"
"padding: %u align:%u pool:%" GST_PTR_FORMAT, size, min, max, GST_PTR_FORMAT, size, min, max, pool);
prefix, padding, alignment, pool);
if (min != 0) { if (min != 0) {
/* if there is a min-buffers suggestion, use it. We add 1 because we need 1 /* if there is a min-buffers suggestion, use it. We add 1 because we need 1
@ -571,8 +578,7 @@ gst_v4l2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
config = gst_buffer_pool_get_config (pool); config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL, gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
NULL); NULL);
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding, gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
alignment);
/* if downstream supports video metadata, add this to the pool config */ /* if downstream supports video metadata, add this to the pool config */
if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE))
@ -582,8 +588,10 @@ gst_v4l2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
gst_buffer_pool_set_config (pool, config); gst_buffer_pool_set_config (pool, config);
} }
gst_query_set_allocation_params (query, size, min, max, prefix, padding, if (update)
alignment, pool); gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
else
gst_query_add_allocation_pool (query, pool, size, min, max);
return TRUE; return TRUE;
} }