decoder: sanitize uses of codec frame input buffer (cosmetics).

Alias GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer to a simple
"buffer" variable.
This commit is contained in:
Gwenole Beauchesne 2013-03-21 13:28:05 +01:00
parent 9e1da76971
commit 57ed7e3f8b
5 changed files with 19 additions and 15 deletions

View file

@ -2698,6 +2698,8 @@ decode_slice(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnit *unit)
GstVaapiPictureH264 * const picture = priv->current_picture;
GstH264SliceHdr * const slice_hdr = &pi->data.slice_hdr;
GstVaapiSlice *slice;
GstBuffer * const buffer =
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
GST_DEBUG("slice (%u bytes)", pi->nalu.size);
@ -2707,8 +2709,8 @@ decode_slice(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnit *unit)
}
slice = GST_VAAPI_SLICE_NEW(H264, decoder,
(GST_BUFFER_DATA(GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer) +
unit->offset + pi->nalu.offset), pi->nalu.size);
(GST_BUFFER_DATA(buffer) + unit->offset + pi->nalu.offset),
pi->nalu.size);
if (!slice) {
GST_ERROR("failed to allocate slice");
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;

View file

@ -681,14 +681,14 @@ gst_vaapi_decoder_jpeg_decode(GstVaapiDecoder *base_decoder,
{
GstVaapiDecoderJpeg * const decoder = GST_VAAPI_DECODER_JPEG(base_decoder);
GstVaapiDecoderStatus status;
GstBuffer * const buffer =
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
status = ensure_decoder(decoder);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
unit->buffer = gst_buffer_create_sub(
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer,
unit->offset, unit->size);
unit->buffer = gst_buffer_create_sub(buffer, unit->offset, unit->size);
if (!unit->buffer)
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;

View file

@ -1194,6 +1194,8 @@ decode_slice(GstVaapiDecoderMpeg2 *decoder, GstVaapiDecoderUnit *unit)
GstVaapiSlice *slice;
VASliceParameterBufferMPEG2 *slice_param;
GstMpegVideoSliceHdr * const slice_hdr = unit->parsed_info;
GstBuffer * const buffer =
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
GST_DEBUG("slice %d (%u bytes)", slice_hdr->slice_vertical_position,
unit->size);
@ -1202,8 +1204,7 @@ decode_slice(GstVaapiDecoderMpeg2 *decoder, GstVaapiDecoderUnit *unit)
return GST_VAAPI_DECODER_STATUS_SUCCESS;
slice = GST_VAAPI_SLICE_NEW(MPEG2, decoder,
(GST_BUFFER_DATA(GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer) +
unit->offset), unit->size);
(GST_BUFFER_DATA(buffer) + unit->offset), unit->size);
if (!slice) {
GST_ERROR("failed to allocate slice");
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
@ -1473,14 +1474,14 @@ gst_vaapi_decoder_mpeg2_decode(GstVaapiDecoder *base_decoder,
GST_VAAPI_DECODER_MPEG2_CAST(base_decoder);
GstVaapiDecoderStatus status;
GstMpegVideoPacket packet;
GstBuffer * const buffer =
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
status = ensure_decoder(decoder);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
packet.data =
(GST_BUFFER_DATA(GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer) +
unit->offset);
packet.data = GST_BUFFER_DATA(buffer) + unit->offset;
packet.size = unit->size;
packet.type = packet.data[3];
packet.offset = 4;

View file

@ -1086,14 +1086,14 @@ gst_vaapi_decoder_mpeg4_decode(GstVaapiDecoder *base_decoder,
GstVaapiDecoderMpeg4 * const decoder =
GST_VAAPI_DECODER_MPEG4(base_decoder);
GstVaapiDecoderStatus status;
GstBuffer * const buffer =
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
status = ensure_decoder(decoder);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
unit->buffer = gst_buffer_create_sub(
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer,
unit->offset, unit->size);
unit->buffer = gst_buffer_create_sub(buffer, unit->offset, unit->size);
if (!unit->buffer)
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;

View file

@ -1253,14 +1253,15 @@ gst_vaapi_decoder_vc1_decode(GstVaapiDecoder *base_decoder,
{
GstVaapiDecoderVC1 * const decoder = GST_VAAPI_DECODER_VC1(base_decoder);
GstVaapiDecoderStatus status;
GstBuffer * const buffer =
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
status = ensure_decoder(decoder);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
status = decode_buffer(decoder,
(GST_BUFFER_DATA(GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer) +
unit->offset), unit->size);
(GST_BUFFER_DATA(buffer) + unit->offset), unit->size);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
return GST_VAAPI_DECODER_STATUS_SUCCESS;