diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-03-15 20:39:10 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-03-15 20:39:10 +0100 |
commit | 427ad305c52ad2e354945c005b59704dc88f7e89 (patch) | |
tree | 0bb0e12af23bf6f065ec4e5e7026fb9ca56c20f2 | |
parent | d9e16a498c03f1df37345a672c432036ba14f1ae (diff) |
update for allocation query changes
-rw-r--r-- | ext/ffmpeg/gstffmpegdec.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 60b0fb5..b7bf367 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -1098,8 +1098,8 @@ static gboolean gst_ffmpegdec_bufferpool (GstFFMpegDec * ffmpegdec, GstCaps * caps) { GstQuery *query; - GstBufferPool *pool = NULL; - guint size, min, max, prefix, padding, alignment; + GstBufferPool *pool; + guint size, min, max; GstStructure *config; guint edge; AVCodecContext *context = ffmpegdec->context; @@ -1111,21 +1111,23 @@ gst_ffmpegdec_bufferpool (GstFFMpegDec * ffmpegdec, GstCaps * caps) query = gst_query_new_allocation (caps, TRUE); if (gst_pad_peer_query (ffmpegdec->srcpad, query)) { - /* we got configuration from our peer, parse them */ - gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, - &padding, &alignment, &pool); - size = MAX (size, ffmpegdec->out_info.size); - have_videometa = gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE); } else { + /* use query defaults */ GST_DEBUG_OBJECT (ffmpegdec, "peer query failed, using defaults"); + have_videometa = 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); + + size = MAX (size, ffmpegdec->out_info.size); + } else { + pool = NULL; size = ffmpegdec->out_info.size; min = max = 0; - prefix = 0; - padding = 0; - alignment = 15; - have_videometa = FALSE; } gst_query_unref (query); @@ -1136,8 +1138,7 @@ gst_ffmpegdec_bufferpool (GstFFMpegDec * ffmpegdec, 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); have_alignment = gst_buffer_pool_has_option (pool, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); @@ -1440,8 +1441,8 @@ gst_ffmpegdec_audio_negotiate (GstFFMpegDec * ffmpegdec, gboolean force) memcpy (ffmpegdec->format.audio.gst_layout, ffmpegdec->format.audio.ffmpeg_layout, sizeof (GstAudioChannelPosition) * ffmpegdec->format.audio.channels); - gst_audio_channel_positions_to_valid_order (ffmpegdec->format.audio. - gst_layout, ffmpegdec->format.audio.channels); + gst_audio_channel_positions_to_valid_order (ffmpegdec->format. + audio.gst_layout, ffmpegdec->format.audio.channels); GST_LOG_OBJECT (ffmpegdec, "output caps %" GST_PTR_FORMAT, caps); @@ -2721,13 +2722,18 @@ gst_ffmpegdec_sink_query (GstPad * pad, GstObject * parent, GstQuery * query) break; } case GST_QUERY_ALLOCATION: - /* we would like to have some padding so that we don't have to memcpy, - * since we have variable sized input, set size to 0, min/max buffers and - * a pool are not useful for us. */ - gst_query_set_allocation_params (query, 0, 0, 0, 0, - FF_INPUT_BUFFER_PADDING_SIZE, 0, NULL); + { + GstAllocationParams params; + + gst_allocation_params_init (¶ms); + params.flags = GST_MEMORY_FLAG_ZERO_PADDED; + params.padding = FF_INPUT_BUFFER_PADDING_SIZE; + /* we would like to have some padding so that we don't have to + * memcpy. We don't suggest an allocator. */ + gst_query_add_allocation_param (query, NULL, ¶ms); ret = TRUE; break; + } default: ret = gst_pad_query_default (pad, parent, query); break; |