Commit 7c0e2b5b authored by Wim Taymans's avatar Wim Taymans

update for allocation query changes

parent 02dc419a
......@@ -4,6 +4,7 @@ libgstlibvisual_la_SOURCES = visual.c
libgstlibvisual_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(LIBVISUAL_CFLAGS)
libgstlibvisual_la_LIBADD = \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_MAJORMINOR).la \
$(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
$(GST_BASE_LIBS) $(LIBVISUAL_LIBS)
libgstlibvisual_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstlibvisual_la_LIBTOOLFLAGS = --tag=disable-static
......
......@@ -24,6 +24,7 @@
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include <gst/video/video.h>
#include <gst/video/gstvideopool.h>
#include <gst/audio/audio.h>
#include <libvisual/libvisual.h>
......@@ -422,7 +423,8 @@ gst_vis_src_negotiate (GstVisual * visual)
GstCaps *caps;
GstQuery *query;
GstBufferPool *pool = NULL;
guint size, min, max, prefix, padding, alignment;
GstStructure *config;
guint size, min, max;
caps = gst_pad_query_caps (visual->srcpad, NULL);
......@@ -461,30 +463,32 @@ gst_vis_src_negotiate (GstVisual * visual)
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE);
if (gst_pad_peer_query (visual->srcpad, query)) {
/* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
&padding, &alignment, &pool);
if (!gst_pad_peer_query (visual->srcpad, query)) {
/* not a problem, we deal with the defaults of the query */
GST_DEBUG_OBJECT (visual, "allocation query failed");
}
if (gst_query_get_n_allocation_pools (query) > 0) {
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
size = MAX (size, visual->outsize);
} else {
pool = NULL;
size = visual->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);
/* no pool, just parameters, we can make our own */
GST_DEBUG_OBJECT (visual, "no pool, making new pool");
pool = gst_video_buffer_pool_new ();
}
/* 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 (visual->pool)
gst_object_unref (visual->pool);
visual->pool = pool;
......@@ -899,8 +903,8 @@ gst_visual_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
visual->actor =
visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->info->
plugname);
visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->
info->plugname);
visual->video = visual_video_new ();
visual->audio = visual_audio_new ();
/* can't have a play without actors */
......
......@@ -773,7 +773,7 @@ theora_negotiate (GstTheoraDec * dec)
GstVideoFormat format;
GstQuery *query;
GstBufferPool *pool;
guint size, min, max, prefix, padding, alignment;
guint size, min, max;
GstStructure *config;
GstCaps *caps;
GstVideoInfo info, cinfo;
......@@ -876,23 +876,22 @@ theora_negotiate (GstTheoraDec * dec)
query = gst_query_new_allocation (caps, TRUE);
if (gst_pad_peer_query (dec->srcpad, query)) {
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,
&padding, &alignment, &pool);
/* check if downstream supports cropping */
dec->has_cropping =
gst_query_has_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE);
} else {
/* not a problem, deal with defaults */
GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
dec->has_cropping = FALSE;
}
if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
} else {
pool = NULL;
size = 0;
min = max = 0;
prefix = 0;
padding = 0;
alignment = 0;
pool = NULL;
dec->has_cropping = FALSE;
}
GST_DEBUG_OBJECT (dec, "downstream cropping %d", dec->has_cropping);
......@@ -918,14 +917,16 @@ theora_negotiate (GstTheoraDec * dec)
size = MAX (size, GST_VIDEO_INFO_SIZE (&dec->vinfo));
config = gst_buffer_pool_get_config (pool);
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);
gst_caps_unref (caps);
/* 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);
/* and activate */
......
......@@ -92,7 +92,7 @@ gst_video_filter_propose_allocation (GstBaseTransform * trans,
} else
pool = NULL;
gst_query_set_allocation_params (query, size, 0, 0, 0, 0, 15, pool);
gst_query_add_allocation_pool (query, pool, size, 0, 0);
gst_object_unref (pool);
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
......@@ -113,19 +113,21 @@ config_failed:
static gboolean
gst_video_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query)
{
GstBufferPool *pool = NULL;
guint size, min, max, prefix, padding, alignment;
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
&padding, &alignment, &pool);
if (gst_query_get_n_allocation_pools (query) > 0) {
GstBufferPool *pool = NULL;
if (pool) {
GstStructure *config;
gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
gst_buffer_pool_set_config (pool, config);
if (pool) {
GstStructure *config;
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
gst_buffer_pool_set_config (pool, config);
gst_object_unref (pool);
}
}
return GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans,
query);
......
......@@ -610,30 +610,31 @@ static gboolean
gst_video_test_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
{
GstVideoTestSrc *videotestsrc;
GstBufferPool *pool;
guint size, min, max, prefix, padding, alignment;
videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
&padding, &alignment, &pool);
/* adjust size */
size = MAX (size, videotestsrc->info.size);
if (gst_query_get_n_allocation_pools (query) > 0) {
GstBufferPool *pool;
guint size, min, max;
if (pool) {
GstStructure *config;
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
gst_buffer_pool_set_config (pool, config);
}
gst_query_set_allocation_params (query, size, min, max, prefix,
padding, alignment, pool);
/* adjust size */
size = MAX (size, videotestsrc->info.size);
if (pool) {
GstStructure *config;
if (pool)
gst_object_unref (pool);
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
gst_buffer_pool_set_config (pool, config);
}
gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
if (pool)
gst_object_unref (pool);
}
return TRUE;
}
......
......@@ -1472,7 +1472,7 @@ gst_ximagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
goto config_failed;
}
/* 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, 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);
......
......@@ -1986,7 +1986,7 @@ gst_xvimagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
goto config_failed;
}
/* 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, 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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment