update for allocation query changes

This commit is contained in:
Wim Taymans 2012-03-15 20:39:10 +01:00
parent d9e16a498c
commit 427ad305c5

View file

@ -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 (&params);
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, &params);
ret = TRUE;
break;
}
default:
ret = gst_pad_query_default (pad, parent, query);
break;