+ GstVideoCodecState *state = gst_video_decoder_get_output_state (decoder);
+ GstBufferPool *pool;
+ gboolean update;
+ guint size, min, max;
+ GstStructure *config;
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
+
+ /* adjust size */
+ size = MAX (size, state->info.size);
+ update = TRUE;
+ } else {
+ pool = NULL;
+ size = state->info.size;
+ min = max = 0;
+ update = FALSE;
+ }
+
+ /* no downstream pool, make our own */
+ if (pool == NULL) {
+ pool = gst_video_buffer_pool_new ();
+ }
+
+ config = gst_buffer_pool_get_config (pool);
+ if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
+ gst_buffer_pool_config_add_option (config,
+ GST_BUFFER_POOL_OPTION_VIDEO_META);
+ }