static GParamSpec *g_properties[N_PROPERTIES];
+static gboolean _destroy_buffers (GstVaDecodePicture * pic);
+
static void
gst_va_decoder_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
gst_va_display_lock (self->display);
status = vaEndPicture (dpy, self->context);
gst_va_display_unlock (self->display);
- if (status != VA_STATUS_SUCCESS) {
+ if (status != VA_STATUS_SUCCESS)
GST_WARNING_OBJECT (self, "vaEndPicture: %s", vaErrorStr (status));
- goto bail;
- }
-
- ret = TRUE;
+ else
+ ret = TRUE;
bail:
- gst_va_decoder_destroy_buffers (self, pic);
+ _destroy_buffers (pic);
return ret;
}
static gboolean
-_va_decoder_picture_destroy_buffers (GstVaDecodePicture * pic)
+_destroy_buffers (GstVaDecodePicture * pic)
{
VABufferID buffer;
VADisplay dpy;
guint i;
gboolean ret = TRUE;
+ g_return_val_if_fail (GST_IS_VA_DISPLAY (pic->display), FALSE);
+
dpy = gst_va_display_get_va_dpy (pic->display);
for (i = 0; i < pic->buffers->len; i++) {
return ret;
}
-gboolean
-gst_va_decoder_destroy_buffers (GstVaDecoder * self, GstVaDecodePicture * pic)
-{
- VASurfaceID surface;
-
- g_return_val_if_fail (GST_IS_VA_DECODER (self), FALSE);
- g_return_val_if_fail (pic, FALSE);
-
- surface = gst_va_decode_picture_get_surface (pic);
- if (surface == VA_INVALID_ID) {
- GST_ERROR_OBJECT (self, "Decode picture without VASurfaceID");
- return FALSE;
- }
-
- g_assert (pic->display == self->display);
-
- GST_TRACE_OBJECT (self, "Destroy buffers of surface %#x", surface);
-
- return _va_decoder_picture_destroy_buffers (pic);
-}
-
-
GstVaDecodePicture *
gst_va_decode_picture_new (GstVaDecoder * self, GstBuffer * buffer)
{
if (pic->buffers->len > 0 || pic->slices->len > 0) {
GST_WARNING ("VABufferIDs have not been released.");
- _va_decoder_picture_destroy_buffers (pic);
+ _destroy_buffers (pic);
}
gst_buffer_unref (pic->gstbuffer);
gsize slice_size);
gboolean gst_va_decoder_decode (GstVaDecoder * self,
GstVaDecodePicture * pic);
-gboolean gst_va_decoder_destroy_buffers (GstVaDecoder * self,
- GstVaDecodePicture * pic);
GstVaDecodePicture * gst_va_decode_picture_new (GstVaDecoder * self,
GstBuffer * buffer);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVaDecodePicture *va_pic;
VASliceParameterBufferH264 slice_param;
- gboolean ret;
/* *INDENT-OFF* */
slice_param = (VASliceParameterBufferH264) {
va_pic = gst_h264_picture_get_user_data (picture);
- ret = gst_va_decoder_add_slice_buffer (base->decoder, va_pic, &slice_param,
+ return gst_va_decoder_add_slice_buffer (base->decoder, va_pic, &slice_param,
sizeof (slice_param), slice->nalu.data + slice->nalu.offset,
slice->nalu.size);
- if (!ret) {
- gst_va_decoder_destroy_buffers (base->decoder, va_pic);
- return FALSE;
- }
-
- return TRUE;
}
static gboolean
if (!gst_va_decoder_add_param_buffer (base->decoder, va_pic,
VAPictureParameterBufferType, &pic_param, sizeof (pic_param)))
- goto fail;
+ return FALSE;
/* there are always 6 4x4 scaling lists */
for (i = 0; i < 6; i++) {
[i], pps->scaling_lists_8x8[i]);
}
- if (!gst_va_decoder_add_param_buffer (base->decoder, va_pic,
- VAIQMatrixBufferType, &iq_matrix, sizeof (iq_matrix)))
- goto fail;
-
- return TRUE;
-
-fail:
- {
- gst_va_decoder_destroy_buffers (base->decoder, va_pic);
- return FALSE;
- }
+ return gst_va_decoder_add_param_buffer (base->decoder, va_pic,
+ VAIQMatrixBufferType, &iq_matrix, sizeof (iq_matrix));
}
static gboolean
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVaDecodePicture *va_pic;
VASliceParameterBufferHEVC slice_param;
- gboolean ret;
/* *INDENT-OFF* */
slice_param = (VASliceParameterBufferHEVC) {
va_pic = gst_h265_picture_get_user_data (picture);
- ret = gst_va_decoder_add_slice_buffer (base->decoder, va_pic, &slice_param,
+ return gst_va_decoder_add_slice_buffer (base->decoder, va_pic, &slice_param,
sizeof (slice_param), slice->nalu.data + slice->nalu.offset,
slice->nalu.size);
- if (!ret) {
- gst_va_decoder_destroy_buffers (base->decoder, va_pic);
- return FALSE;
- }
-
- return TRUE;
}
static gboolean
if (!gst_va_decoder_add_param_buffer (base->decoder, va_pic,
VAPictureParameterBufferType, pic_param, sizeof (*pic_param)))
- goto fail;
+ return FALSE;
if (pps->scaling_list_data_present_flag ||
(sps->scaling_list_enabled_flag
iq_matrix.ScalingListDC32x32[i] =
scaling_list->scaling_list_dc_coef_minus8_32x32[i] + 8;
- if (!gst_va_decoder_add_param_buffer (base->decoder, va_pic,
- VAIQMatrixBufferType, &iq_matrix, sizeof (iq_matrix)))
- goto fail;
+ return gst_va_decoder_add_param_buffer (base->decoder, va_pic,
+ VAIQMatrixBufferType, &iq_matrix, sizeof (iq_matrix));
}
return TRUE;
-
-fail:
- {
- gst_va_decoder_destroy_buffers (base->decoder, va_pic);
- return FALSE;
- }
}
static gboolean
gst_va_vp8_dec_decode_picture (GstVp8Decoder * decoder, GstVp8Picture * picture,
GstVp8Parser * parser)
{
- GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
- GstVaDecodePicture *va_pic;
-
- if (!_fill_picture (decoder, picture, parser))
- goto error;
-
- if (!_add_slice (decoder, picture, parser))
- goto error;
-
- return TRUE;
-
-error:
- {
- GST_WARNING_OBJECT (base, "Decode the picture error");
- va_pic = gst_vp8_picture_get_user_data (picture);
- gst_va_decoder_destroy_buffers (base->decoder, va_pic);
- return FALSE;
- }
+ return _fill_picture (decoder, picture, parser) &&
+ _add_slice (decoder, picture, parser);
}
static gboolean
gst_va_vp9_decode_picture (GstVp9Decoder * decoder, GstVp9Picture * picture,
GstVp9Dpb * dpb)
{
- GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
-
- if (!_fill_param (decoder, picture, dpb))
- goto fail;
-
- if (!_fill_slice (decoder, picture))
- goto fail;
-
- return TRUE;
-
-fail:
- {
- GstVaDecodePicture *va_pic;
-
- va_pic = gst_vp9_picture_get_user_data (picture);
- gst_va_decoder_destroy_buffers (base->decoder, va_pic);
- return FALSE;
- }
+ return _fill_param (decoder, picture, dpb) && _fill_slice (decoder, picture);
}
static gboolean