GstVaapiPicture * const picture = priv->current_picture;
GstVaapiSlice *slice;
VASliceParameterBufferMPEG2 *slice_param;
- GstMpegVideoPacket * const packet = &unit->packet;
GstMpegVideoSliceHdr * const slice_hdr = &unit->data.slice_hdr;
GST_DEBUG("slice %d (%u bytes)", slice_hdr->slice_vertical_position,
- packet->size);
-
- unit->base.buffer = gst_buffer_create_sub(
- GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer,
- unit->base.offset, unit->base.size);
- if (!unit->base.buffer) {
- GST_ERROR("failed to allocate slice data");
- return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
- }
+ unit->base.size);
slice = GST_VAAPI_SLICE_NEW(MPEG2, decoder,
- GST_BUFFER_DATA(unit->base.buffer), packet->size);
+ (GST_BUFFER_DATA(GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer) +
+ unit->base.offset), unit->base.size);
if (!slice) {
GST_ERROR("failed to allocate slice");
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;