mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
update for allocation query changes
This commit is contained in:
parent
6ed3bc109b
commit
f3a770a20c
11 changed files with 165 additions and 138 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, 0, NULL);
|
||||
gst_query_add_allocation_pool (query, NULL, size, 2, 0);
|
||||
|
||||
/* we support various metadata */
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/video/gstvideometa.h>
|
||||
#include <gst/video/gstvideopool.h>
|
||||
|
||||
#include "gstdvdec.h"
|
||||
|
@ -252,46 +253,50 @@ static void
|
|||
gst_dvdec_negotiate_pool (GstDVDec * dec, GstCaps * caps, GstVideoInfo * info)
|
||||
{
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
GstBufferPool *pool;
|
||||
guint size, min, max;
|
||||
GstStructure *config;
|
||||
|
||||
/* find a pool for the negotiated caps now */
|
||||
query = gst_query_new_allocation (caps, TRUE);
|
||||
|
||||
if (gst_pad_peer_query (dec->srcpad, query)) {
|
||||
GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints");
|
||||
if (!gst_pad_peer_query (dec->srcpad, query)) {
|
||||
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 */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&padding, &alignment, &pool);
|
||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
||||
size = MAX (size, info->size);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
|
||||
pool = NULL;
|
||||
size = info->size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
if (pool == NULL) {
|
||||
/* 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);
|
||||
}
|
||||
dec->pool = pool;
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
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. */
|
||||
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
|
||||
|
||||
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);
|
||||
|
||||
/* and activate */
|
||||
gst_buffer_pool_set_active (pool, TRUE);
|
||||
|
||||
|
|
|
@ -224,8 +224,9 @@ gst_gdk_pixbuf_setup_pool (GstGdkPixbuf * filter, GstVideoInfo * info)
|
|||
{
|
||||
GstCaps *target;
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
GstBufferPool *pool;
|
||||
GstStructure *config;
|
||||
guint size, min, max;
|
||||
|
||||
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 */
|
||||
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 */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&padding, &alignment, &pool);
|
||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
||||
} else {
|
||||
pool = NULL;
|
||||
size = info->size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
if (pool == NULL) {
|
||||
GstStructure *config;
|
||||
|
||||
/* we did not get a pool, make one ourselves then */
|
||||
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);
|
||||
}
|
||||
filter->pool = pool;
|
||||
|
||||
/* and activate */
|
||||
|
|
|
@ -1163,8 +1163,8 @@ static gboolean
|
|||
gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
|
||||
{
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
GstBufferPool *pool;
|
||||
guint size, min, max;
|
||||
GstStructure *config;
|
||||
|
||||
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 */
|
||||
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 */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&padding, &alignment, &pool);
|
||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
||||
size = MAX (size, dec->info.size);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (dec, "peer query failed, using defaults");
|
||||
pool = NULL;
|
||||
size = dec->info.size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 15;
|
||||
}
|
||||
gst_query_unref (query);
|
||||
|
||||
|
@ -1193,8 +1193,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,
|
||||
padding, alignment | 15);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 15);
|
||||
/* and store */
|
||||
gst_buffer_pool_set_config (pool, config);
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/video/gstvideometa.h>
|
||||
#include <gst/video/gstvideopool.h>
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (pngdec_debug);
|
||||
|
@ -337,46 +339,50 @@ static GstFlowReturn
|
|||
gst_pngdec_negotiate_pool (GstPngDec * dec, GstCaps * caps, GstVideoInfo * info)
|
||||
{
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
GstBufferPool *pool;
|
||||
guint size, min, max;
|
||||
GstStructure *config;
|
||||
|
||||
/* find a pool for the negotiated caps now */
|
||||
query = gst_query_new_allocation (caps, TRUE);
|
||||
|
||||
if (gst_pad_peer_query (dec->srcpad, query)) {
|
||||
GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints");
|
||||
if (!gst_pad_peer_query (dec->srcpad, query)) {
|
||||
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 */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&padding, &alignment, &pool);
|
||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
||||
size = MAX (size, info->size);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
|
||||
pool = NULL;
|
||||
size = info->size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
if (pool == NULL) {
|
||||
/* 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);
|
||||
}
|
||||
dec->pool = pool;
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
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. */
|
||||
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
|
||||
|
||||
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);
|
||||
|
||||
/* and activate */
|
||||
gst_buffer_pool_set_active (pool, TRUE);
|
||||
|
||||
|
|
|
@ -254,8 +254,9 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
GstStructure *structure;
|
||||
GstCaps *templ;
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
GstBufferPool *pool;
|
||||
GstStructure *config;
|
||||
guint size, min, max;
|
||||
|
||||
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 */
|
||||
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 */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&padding, &alignment, &pool);
|
||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
||||
} else {
|
||||
pool = NULL;
|
||||
size = goom->outsize;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
if (pool == NULL) {
|
||||
GstStructure *config;
|
||||
|
||||
/* we did not get a pool, make one ourselves then */
|
||||
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);
|
||||
}
|
||||
goom->pool = pool;
|
||||
|
||||
/* and activate */
|
||||
|
|
|
@ -252,7 +252,8 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
GstCaps *templ;
|
||||
GstQuery *query;
|
||||
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);
|
||||
|
||||
|
@ -281,36 +282,36 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
|
||||
gst_goom_src_setcaps (goom, target);
|
||||
|
||||
/* try to get a bufferpool now */
|
||||
/* find a pool for the negotiated caps now */
|
||||
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 */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&padding, &alignment, &pool);
|
||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
||||
} else {
|
||||
pool = NULL;
|
||||
size = goom->outsize;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
if (pool == NULL) {
|
||||
GstStructure *config;
|
||||
|
||||
/* we did not get a pool, make one ourselves then */
|
||||
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);
|
||||
}
|
||||
goom->pool = pool;
|
||||
|
||||
/* and activate */
|
||||
|
|
|
@ -226,8 +226,9 @@ gst_monoscope_src_negotiate (GstMonoscope * monoscope)
|
|||
GstStructure *structure;
|
||||
GstCaps *templ;
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, alignment;
|
||||
GstBufferPool *pool;
|
||||
GstStructure *config;
|
||||
guint size, min, max;
|
||||
|
||||
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 */
|
||||
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 */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&alignment, &pool);
|
||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
||||
} else {
|
||||
pool = NULL;
|
||||
size = monoscope->outsize;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
if (pool == NULL) {
|
||||
GstStructure *config;
|
||||
|
||||
/* we did not get a pool, make one ourselves then */
|
||||
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);
|
||||
}
|
||||
monoscope->pool = pool;
|
||||
|
||||
/* and activate */
|
||||
|
|
|
@ -118,29 +118,29 @@ gst_rtp_vraw_depay_negotiate_pool (GstRtpVRawDepay * depay, GstCaps * caps,
|
|||
{
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
guint size, min, max;
|
||||
GstStructure *config;
|
||||
|
||||
/* find a pool for the negotiated caps now */
|
||||
query = gst_query_new_allocation (caps, TRUE);
|
||||
|
||||
if (gst_pad_peer_query (GST_RTP_BASE_DEPAYLOAD_SRCPAD (depay), query)) {
|
||||
GST_DEBUG_OBJECT (depay, "got downstream ALLOCATION hints");
|
||||
if (!gst_pad_peer_query (GST_RTP_BASE_DEPAYLOAD_SRCPAD (depay), query)) {
|
||||
/* 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 */
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&padding, &alignment, &pool);
|
||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (depay, "didn't get downstream ALLOCATION hints");
|
||||
GST_DEBUG_OBJECT (depay, "didn't get downstream pool hints");
|
||||
size = info->size;
|
||||
min = max = 0;
|
||||
prefix = 0;
|
||||
padding = 0;
|
||||
alignment = 0;
|
||||
}
|
||||
|
||||
if (pool == NULL) {
|
||||
/* we did not get a pool, make one ourselves then */
|
||||
pool = gst_buffer_pool_new ();
|
||||
pool = gst_video_buffer_pool_new ();
|
||||
}
|
||||
|
||||
if (depay->pool)
|
||||
|
@ -148,12 +148,14 @@ 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, 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. */
|
||||
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
|
||||
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
|
||||
* it through the video info API. We could also see if the pool support this
|
||||
* metadata 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);
|
||||
/* and activate */
|
||||
|
|
|
@ -651,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, 0, pool);
|
||||
gst_query_add_allocation_pool (query, pool, size, 2, 0);
|
||||
|
||||
/* we also support various metadata */
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
|
||||
|
|
|
@ -511,17 +511,24 @@ gst_v4l2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
|
|||
GstV4l2Src *src;
|
||||
GstV4l2Object *obj;
|
||||
GstBufferPool *pool;
|
||||
guint size, min, max, prefix, padding, alignment;
|
||||
guint size, min, max;
|
||||
gboolean update;
|
||||
|
||||
src = GST_V4L2SRC (bsrc);
|
||||
obj = src->v4l2object;
|
||||
|
||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||
&padding, &alignment, &pool);
|
||||
if (gst_query_get_n_allocation_pools (query) > 0) {
|
||||
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 "
|
||||
"padding: %u align:%u pool:%" GST_PTR_FORMAT, size, min, max,
|
||||
prefix, padding, alignment, pool);
|
||||
GST_DEBUG_OBJECT (src, "allocation: size:%u min:%u max:%u pool:%"
|
||||
GST_PTR_FORMAT, size, min, max, pool);
|
||||
|
||||
if (min != 0) {
|
||||
/* 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);
|
||||
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);
|
||||
gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
|
||||
|
||||
/* if downstream supports video metadata, add this to the pool config */
|
||||
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_query_set_allocation_params (query, size, min, max, prefix, padding,
|
||||
alignment, pool);
|
||||
if (update)
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue