From: Wim Taymans Date: Thu, 15 Mar 2012 19:36:51 +0000 (+0100) Subject: update for allocation query changes X-Git-Tag: 1.19.3~511^2~6685 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c0e2b5b1e54bebea4ade2e820586910457fc5e1;p=platform%2Fupstream%2Fgstreamer.git update for allocation query changes --- diff --git a/ext/libvisual/Makefile.am b/ext/libvisual/Makefile.am index 27431e5..e8fdc7c 100644 --- a/ext/libvisual/Makefile.am +++ b/ext/libvisual/Makefile.am @@ -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 diff --git a/ext/libvisual/visual.c b/ext/libvisual/visual.c index 29e85ff..3cba8f1 100644 --- a/ext/libvisual/visual.c +++ b/ext/libvisual/visual.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -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 */ diff --git a/ext/theora/gsttheoradec.c b/ext/theora/gsttheoradec.c index 358c6b4..9558ea6 100644 --- a/ext/theora/gsttheoradec.c +++ b/ext/theora/gsttheoradec.c @@ -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 */ diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c index 706ac22..d37956c 100644 --- a/gst-libs/gst/video/gstvideofilter.c +++ b/gst-libs/gst/video/gstvideofilter.c @@ -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); diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index 72b21b6..2564497 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -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; } diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 305169b..a5b3859 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -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); diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 2460973..ef5cf86 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -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);