Use AV_ namespace for INPUT_BUFFER_PADDING_SIZE

https://bugzilla.gnome.org/show_bug.cgi?id=792900
This commit is contained in:
Nicolas Dufresne 2018-04-30 15:41:40 -04:00 committed by Mathieu Duponchelle
parent 2485cc582a
commit 7b3e41e20b
3 changed files with 20 additions and 20 deletions

View file

@ -283,7 +283,7 @@ gst_ffmpegauddec_propose_allocation (GstAudioDecoder * decoder,
gst_allocation_params_init (&params);
params.flags = GST_MEMORY_FLAG_ZERO_PADDED;
params.align = 15;
params.padding = FF_INPUT_BUFFER_PADDING_SIZE;
params.padding = AV_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);
@ -744,10 +744,10 @@ gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
bsize = map.size;
if (bsize > 0 && (!GST_MEMORY_IS_ZERO_PADDED (map.memory)
|| (map.maxsize - map.size) < FF_INPUT_BUFFER_PADDING_SIZE)) {
|| (map.maxsize - map.size) < AV_INPUT_BUFFER_PADDING_SIZE)) {
/* add padding */
if (ffmpegdec->padded_size < bsize + FF_INPUT_BUFFER_PADDING_SIZE) {
ffmpegdec->padded_size = bsize + FF_INPUT_BUFFER_PADDING_SIZE;
if (ffmpegdec->padded_size < bsize + AV_INPUT_BUFFER_PADDING_SIZE) {
ffmpegdec->padded_size = bsize + AV_INPUT_BUFFER_PADDING_SIZE;
ffmpegdec->padded = g_realloc (ffmpegdec->padded, ffmpegdec->padded_size);
GST_LOG_OBJECT (ffmpegdec, "resized padding buffer to %d",
ffmpegdec->padded_size);
@ -755,7 +755,7 @@ gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
"Copy input to add padding");
memcpy (ffmpegdec->padded, bdata, bsize);
memset (ffmpegdec->padded + bsize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
memset (ffmpegdec->padded + bsize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
bdata = ffmpegdec->padded;
do_padding = TRUE;
@ -764,7 +764,7 @@ gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
}
do {
guint8 tmp_padding[FF_INPUT_BUFFER_PADDING_SIZE];
guint8 tmp_padding[AV_INPUT_BUFFER_PADDING_SIZE];
data = bdata;
size = bsize;
@ -773,15 +773,15 @@ gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
/* add temporary padding */
GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
"Add temporary input padding");
memcpy (tmp_padding, data + size, FF_INPUT_BUFFER_PADDING_SIZE);
memset (data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
memcpy (tmp_padding, data + size, AV_INPUT_BUFFER_PADDING_SIZE);
memset (data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
}
/* decode a frame of audio now */
len = gst_ffmpegauddec_frame (ffmpegdec, data, size, &have_data, &ret);
if (do_padding) {
memcpy (data + size, tmp_padding, FF_INPUT_BUFFER_PADDING_SIZE);
memcpy (data + size, tmp_padding, AV_INPUT_BUFFER_PADDING_SIZE);
}
if (ret != GST_FLOW_OK) {

View file

@ -3209,7 +3209,7 @@ gst_ffmpeg_caps_with_codecid (enum AVCodecID codec_id,
* as is, as that is what most players do. */
context->extradata =
av_mallocz (GST_ROUND_UP_16 (size * 2 +
FF_INPUT_BUFFER_PADDING_SIZE));
AV_INPUT_BUFFER_PADDING_SIZE));
copy_config (context->extradata, data, size, &extrasize);
GST_DEBUG ("escaped size: %d", extrasize);
context->extradata_size = extrasize;
@ -3220,7 +3220,7 @@ gst_ffmpeg_caps_with_codecid (enum AVCodecID codec_id,
GST_DEBUG ("copy codec_data");
context->extradata =
av_mallocz (GST_ROUND_UP_16 (map.size +
FF_INPUT_BUFFER_PADDING_SIZE));
AV_INPUT_BUFFER_PADDING_SIZE));
memcpy (context->extradata, map.data, map.size);
context->extradata_size = map.size;
}

View file

@ -1822,10 +1822,10 @@ gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder,
bsize = minfo.size;
if (bsize > 0 && (!GST_MEMORY_IS_ZERO_PADDED (minfo.memory)
|| (minfo.maxsize - minfo.size) < FF_INPUT_BUFFER_PADDING_SIZE)) {
|| (minfo.maxsize - minfo.size) < AV_INPUT_BUFFER_PADDING_SIZE)) {
/* add padding */
if (ffmpegdec->padded_size < bsize + FF_INPUT_BUFFER_PADDING_SIZE) {
ffmpegdec->padded_size = bsize + FF_INPUT_BUFFER_PADDING_SIZE;
if (ffmpegdec->padded_size < bsize + AV_INPUT_BUFFER_PADDING_SIZE) {
ffmpegdec->padded_size = bsize + AV_INPUT_BUFFER_PADDING_SIZE;
ffmpegdec->padded = g_realloc (ffmpegdec->padded, ffmpegdec->padded_size);
GST_LOG_OBJECT (ffmpegdec, "resized padding buffer to %d",
ffmpegdec->padded_size);
@ -1833,7 +1833,7 @@ gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder,
GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
"Copy input to add padding");
memcpy (ffmpegdec->padded, bdata, bsize);
memset (ffmpegdec->padded + bsize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
memset (ffmpegdec->padded + bsize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
bdata = ffmpegdec->padded;
do_padding = TRUE;
@ -1842,7 +1842,7 @@ gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder,
}
do {
guint8 tmp_padding[FF_INPUT_BUFFER_PADDING_SIZE];
guint8 tmp_padding[AV_INPUT_BUFFER_PADDING_SIZE];
/* parse, if at all possible */
data = bdata;
@ -1852,8 +1852,8 @@ gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder,
/* add temporary padding */
GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
"Add temporary input padding");
memcpy (tmp_padding, data + size, FF_INPUT_BUFFER_PADDING_SIZE);
memset (data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
memcpy (tmp_padding, data + size, AV_INPUT_BUFFER_PADDING_SIZE);
memset (data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
}
/* decode a frame of audio/video now */
@ -1869,7 +1869,7 @@ gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder,
}
if (do_padding) {
memcpy (data + size, tmp_padding, FF_INPUT_BUFFER_PADDING_SIZE);
memcpy (data + size, tmp_padding, AV_INPUT_BUFFER_PADDING_SIZE);
}
if (len == 0 && have_data == 0) {
@ -2150,7 +2150,7 @@ gst_ffmpegviddec_propose_allocation (GstVideoDecoder * decoder,
gst_allocation_params_init (&params);
params.flags = GST_MEMORY_FLAG_ZERO_PADDED;
params.align = DEFAULT_STRIDE_ALIGN;
params.padding = FF_INPUT_BUFFER_PADDING_SIZE;
params.padding = AV_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);