libs: fix code style for errors

This commit is contained in:
Víctor Manuel Jáquez Leal 2016-10-19 19:04:20 +02:00
parent 3578716a4f
commit b1f6da98de
39 changed files with 463 additions and 212 deletions

View file

@ -177,9 +177,11 @@ gst_vaapi_buffer_proxy_new (guintptr handle, guint type, gsize size,
/* ERRORS */
error_unsupported_mem_type:
GST_ERROR ("unsupported buffer type (%d)", proxy->type);
gst_vaapi_buffer_proxy_unref_internal (proxy);
return NULL;
{
GST_ERROR ("unsupported buffer type (%d)", proxy->type);
gst_vaapi_buffer_proxy_unref_internal (proxy);
return NULL;
}
#else
return NULL;
#endif
@ -214,13 +216,17 @@ gst_vaapi_buffer_proxy_new_from_object (GstVaapiObject * object,
/* ERRORS */
error_unsupported_mem_type:
GST_ERROR ("unsupported buffer type (%d)", proxy->type);
gst_vaapi_buffer_proxy_unref_internal (proxy);
return NULL;
{
GST_ERROR ("unsupported buffer type (%d)", proxy->type);
gst_vaapi_buffer_proxy_unref_internal (proxy);
return NULL;
}
error_acquire_handle:
GST_ERROR ("failed to acquire the underlying VA buffer handle");
gst_vaapi_buffer_proxy_unref_internal (proxy);
return NULL;
{
GST_ERROR ("failed to acquire the underlying VA buffer handle");
gst_vaapi_buffer_proxy_unref_internal (proxy);
return NULL;
}
#else
return NULL;
#endif

View file

@ -128,9 +128,12 @@ gst_vaapi_coded_buffer_new (GstVaapiContext * context, guint buf_size)
goto error;
return buf;
/* ERRORS */
error:
gst_vaapi_object_unref (buf);
return NULL;
{
gst_vaapi_object_unref (buf);
return NULL;
}
}
/*

View file

@ -100,9 +100,12 @@ gst_vaapi_coded_buffer_proxy_new_from_pool (GstVaapiCodedBufferPool * pool)
gst_vaapi_object_ref (proxy->buffer);
return proxy;
/* ERRORS */
error:
gst_vaapi_coded_buffer_proxy_unref (proxy);
return NULL;
{
gst_vaapi_coded_buffer_proxy_unref (proxy);
return NULL;
}
}
/**

View file

@ -368,9 +368,12 @@ gst_vaapi_context_new (GstVaapiDisplay * display,
goto error;
return context;
/* ERRORS */
error:
gst_vaapi_object_unref (context);
return NULL;
{
gst_vaapi_object_unref (context);
return NULL;
}
}
/**

View file

@ -120,9 +120,12 @@ overlay_rectangle_new (GstVideoOverlayRectangle * rect,
render_rect->height = height;
return overlay;
/* ERRORS */
error:
overlay_rectangle_unref (overlay);
return NULL;
{
overlay_rectangle_unref (overlay);
return NULL;
}
}
static void
@ -438,7 +441,10 @@ gst_vaapi_context_apply_composition (GstVaapiContext * context,
return FALSE;
return TRUE;
/* ERRORS */
error:
gst_vaapi_context_overlay_reset (context);
return FALSE;
{
gst_vaapi_context_overlay_reset (context);
return FALSE;
}
}

View file

@ -531,9 +531,12 @@ gst_vaapi_decoder_new (const GstVaapiDecoderClass * klass,
goto error;
return decoder;
/* ERRORS */
error:
gst_vaapi_decoder_unref (decoder);
return NULL;
{
gst_vaapi_decoder_unref (decoder);
return NULL;
}
}
/**

View file

@ -94,9 +94,12 @@ dpb_new (guint max_pictures)
goto error;
return dpb;
/* ERRORS */
error:
gst_vaapi_dpb_unref (dpb);
return NULL;
{
gst_vaapi_dpb_unref (dpb);
return NULL;
}
}
static gint

View file

@ -1144,12 +1144,14 @@ mvc_reset (GstVaapiDecoderH264 * decoder)
/* ERRORS */
error_allocate:
g_free (priv->prev_ref_frames);
priv->prev_ref_frames = NULL;
g_free (priv->prev_frames);
priv->prev_frames = NULL;
priv->prev_frames_alloc = 0;
return FALSE;
{
g_free (priv->prev_ref_frames);
priv->prev_ref_frames = NULL;
g_free (priv->prev_frames);
priv->prev_frames = NULL;
priv->prev_frames_alloc = 0;
return FALSE;
}
}
static GstVaapiDecoderStatus
@ -1627,15 +1629,20 @@ decode_current_picture (GstVaapiDecoderH264 * decoder)
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_SUCCESS;
/* ERRORS */
error:
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
{
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
}
drop_frame:
priv->decoder_state = 0;
priv->pic_structure = GST_H264_SEI_PIC_STRUCT_FRAME;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME;
{
priv->decoder_state = 0;
priv->pic_structure = GST_H264_SEI_PIC_STRUCT_FRAME;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME;
}
}
static GstVaapiDecoderStatus
@ -2990,8 +2997,10 @@ fill_picture_first_field_gap (GstVaapiDecoderH264 * decoder,
/* ERRORS */
error_allocate_field:
GST_ERROR ("failed to allocate missing field for current frame store");
return NULL;
{
GST_ERROR ("failed to allocate missing field for current frame store");
return NULL;
}
}
static gboolean
@ -3033,11 +3042,15 @@ cleanup:
/* ERRORS */
error_exec_ref_pic_marking:
GST_ERROR ("failed to execute reference picture marking process");
goto cleanup;
{
GST_ERROR ("failed to execute reference picture marking process");
goto cleanup;
}
error_dpb_add:
GST_ERROR ("failed to store lost picture into the DPB");
goto cleanup;
{
GST_ERROR ("failed to store lost picture into the DPB");
goto cleanup;
}
}
static GstVaapiPictureH264 *
@ -3096,17 +3109,25 @@ fill_picture_other_field_gap (GstVaapiDecoderH264 * decoder,
/* ERRORS */
error_find_field:
GST_ERROR ("failed to find field with POC nearest to %d", f0->base.poc);
return NULL;
{
GST_ERROR ("failed to find field with POC nearest to %d", f0->base.poc);
return NULL;
}
error_allocate_field:
GST_ERROR ("failed to allocate missing field for previous frame store");
return NULL;
{
GST_ERROR ("failed to allocate missing field for previous frame store");
return NULL;
}
error_exec_ref_pic_marking:
GST_ERROR ("failed to execute reference picture marking process");
return NULL;
{
GST_ERROR ("failed to execute reference picture marking process");
return NULL;
}
error_append_field:
GST_ERROR ("failed to add missing field into previous frame store");
return NULL;
{
GST_ERROR ("failed to add missing field into previous frame store");
return NULL;
}
}
static gboolean
@ -3206,14 +3227,20 @@ cleanup:
/* ERRORS */
error_allocate_picture:
GST_ERROR ("failed to allocate lost picture");
goto cleanup;
{
GST_ERROR ("failed to allocate lost picture");
goto cleanup;
}
error_exec_ref_pic_marking:
GST_ERROR ("failed to execute reference picture marking process");
goto cleanup;
{
GST_ERROR ("failed to execute reference picture marking process");
goto cleanup;
}
error_dpb_add:
GST_ERROR ("failed to store lost picture into the DPB");
goto cleanup;
{
GST_ERROR ("failed to store lost picture into the DPB");
goto cleanup;
}
}
static gboolean
@ -4307,8 +4334,10 @@ gst_vaapi_decoder_h264_decode_codec_data (GstVaapiDecoder * base_decoder,
status = GST_VAAPI_DECODER_STATUS_SUCCESS;
cleanup:
gst_vaapi_parser_info_h264_replace (&pi, NULL);
return status;
{
gst_vaapi_parser_info_h264_replace (&pi, NULL);
return status;
}
}
static GstVaapiDecoderStatus
@ -4547,8 +4576,10 @@ gst_vaapi_decoder_h264_parse (GstVaapiDecoder * base_decoder,
return GST_VAAPI_DECODER_STATUS_SUCCESS;
exit:
gst_vaapi_parser_info_h264_unref (pi);
return status;
{
gst_vaapi_parser_info_h264_unref (pi);
return status;
}
}
static GstVaapiDecoderStatus

View file

@ -1309,13 +1309,18 @@ decode_current_picture (GstVaapiDecoderH265 * decoder)
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_SUCCESS;
/* ERRORS */
error:
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
{
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
}
drop_frame:
priv->decoder_state = 0;
priv->pic_structure = GST_VAAPI_PICTURE_STRUCTURE_FRAME;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME;
{
priv->decoder_state = 0;
priv->pic_structure = GST_VAAPI_PICTURE_STRUCTURE_FRAME;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME;
}
}
static GstVaapiDecoderStatus

View file

@ -235,13 +235,18 @@ decode_current_picture (GstVaapiDecoderJpeg * decoder)
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_SUCCESS;
/* ERRORS */
error:
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
{
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
}
drop_frame:
priv->decoder_state = 0;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME;
{
priv->decoder_state = 0;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME;
}
}
static gboolean

View file

@ -559,14 +559,19 @@ decode_current_picture (GstVaapiDecoderMpeg2 * decoder)
}
return GST_VAAPI_DECODER_STATUS_SUCCESS;
/* ERRORS */
error:
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
{
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
}
drop_frame:
priv->state &= GST_MPEG_VIDEO_STATE_VALID_SEQ_HEADERS;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME;
{
priv->state &= GST_MPEG_VIDEO_STATE_VALID_SEQ_HEADERS;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME;
}
}
static GstVaapiDecoderStatus

View file

@ -248,10 +248,13 @@ decode_current_picture (GstVaapiDecoderVC1 * decoder)
}
return GST_VAAPI_DECODER_STATUS_SUCCESS;
/* ERRORS */
error:
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
{
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
}
}
static GstVaapiDecoderStatus

View file

@ -514,10 +514,13 @@ decode_current_picture (GstVaapiDecoderVp8 * decoder)
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_SUCCESS;
/* ERRORS */
error:
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
{
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
}
}
static GstVaapiDecoderStatus

View file

@ -531,10 +531,13 @@ ret:
return GST_VAAPI_DECODER_STATUS_SUCCESS;
/* ERRORS */
error:
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
{
/* XXX: fix for cases where first field failed to be decoded */
gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
}
}
static gboolean

View file

@ -1121,9 +1121,12 @@ gst_vaapi_display_new (GstVaapiDisplay * display,
goto error;
return display;
/* ERRORS */
error:
gst_vaapi_display_unref_internal (display);
return NULL;
{
gst_vaapi_display_unref_internal (display);
return NULL;
}
}
/**

View file

@ -82,9 +82,12 @@ cache_entry_new (const GstVaapiDisplayInfo * di)
}
return entry;
/* ERRORS */
error:
cache_entry_free (entry);
return NULL;
{
cache_entry_free (entry);
return NULL;
}
}
static inline gboolean

View file

@ -579,6 +579,7 @@ is_chroma_type_supported (GstVaapiEncoder * encoder)
return TRUE;
/* ERRORS */
unsupported:
{
GST_ERROR ("We only support YUV 4:2:0 and YUV 4:2:2 for encoding. "
@ -1132,9 +1133,12 @@ gst_vaapi_encoder_new (const GstVaapiEncoderClass * klass,
goto error;
return encoder;
/* ERRORS */
error:
gst_vaapi_encoder_unref (encoder);
return NULL;
{
gst_vaapi_encoder_unref (encoder);
return NULL;
}
}
/** Returns a GType for the #GstVaapiEncoderTune set */

View file

@ -2526,11 +2526,15 @@ gst_vaapi_encoder_h264_encode (GstVaapiEncoder * base_encoder,
goto error;
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
/* ERRORS */
error:
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
{
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
}
}
static GstVaapiEncoderStatus

View file

@ -2091,11 +2091,15 @@ gst_vaapi_encoder_h265_encode (GstVaapiEncoder * base_encoder,
goto error;
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
/* ERRORS */
error:
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
{
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
}
}
static GstVaapiEncoderStatus

View file

@ -651,6 +651,7 @@ ensure_packed_headers (GstVaapiEncoderJpeg * encoder,
return TRUE;
/* ERRORS */
error_create_packed_hdr:
{
GST_ERROR ("failed to create packed raw data header buffer");
@ -688,11 +689,15 @@ gst_vaapi_encoder_jpeg_encode (GstVaapiEncoder * base_encoder,
reconstruct);
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
/* ERRORS */
error:
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
{
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
}
}
static GstVaapiEncoderStatus

View file

@ -426,9 +426,12 @@ ensure_sequence (GstVaapiEncoderMpeg2 * encoder, GstVaapiEncPicture * picture)
gst_vaapi_codec_object_replace (&sequence, NULL);
return TRUE;
/* ERRORS */
error:
gst_vaapi_codec_object_replace (&sequence, NULL);
return FALSE;
{
gst_vaapi_codec_object_replace (&sequence, NULL);
return FALSE;
}
}
static gboolean
@ -570,11 +573,15 @@ gst_vaapi_encoder_mpeg2_encode (GstVaapiEncoder * base_encoder,
reconstruct);
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
/* ERRORS */
error:
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
{
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
}
}
static GstVaapiEncoderStatus
@ -715,8 +722,11 @@ gst_vaapi_encoder_mpeg2_reconfigure (GstVaapiEncoder * base_encoder)
goto error;
return set_context_info (base_encoder);
/* ERRORS */
error:
return GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED;
{
return GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED;
}
}
static gboolean

View file

@ -247,9 +247,12 @@ ensure_sequence (GstVaapiEncoderVP8 * encoder, GstVaapiEncPicture * picture)
gst_vaapi_codec_object_replace (&sequence, NULL);
return TRUE;
/* ERRORS */
error:
gst_vaapi_codec_object_replace (&sequence, NULL);
return FALSE;
{
gst_vaapi_codec_object_replace (&sequence, NULL);
return FALSE;
}
}
static gboolean
@ -384,11 +387,15 @@ gst_vaapi_encoder_vp8_encode (GstVaapiEncoder * base_encoder,
}
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
/* ERRORS */
error:
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
{
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
}
}
static GstVaapiEncoderStatus
@ -446,8 +453,11 @@ gst_vaapi_encoder_vp8_reconfigure (GstVaapiEncoder * base_encoder)
return set_context_info (base_encoder);
/* ERRORS */
error:
return GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED;
{
return GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED;
}
}
static gboolean

View file

@ -207,9 +207,12 @@ ensure_sequence (GstVaapiEncoderVP9 * encoder, GstVaapiEncPicture * picture)
gst_vaapi_codec_object_replace (&sequence, NULL);
return TRUE;
/* ERRORS */
error:
gst_vaapi_codec_object_replace (&sequence, NULL);
return FALSE;
{
gst_vaapi_codec_object_replace (&sequence, NULL);
return FALSE;
}
}
static void
@ -364,11 +367,15 @@ gst_vaapi_encoder_vp9_encode (GstVaapiEncoder * base_encoder,
update_ref_list (encoder, picture, reconstruct);
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
/* ERRORS */
error:
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
{
if (reconstruct)
gst_vaapi_encoder_release_surface (GST_VAAPI_ENCODER (encoder),
reconstruct);
return ret;
}
}
static GstVaapiEncoderStatus

View file

@ -191,9 +191,12 @@ vpp_get_filters_unlocked (GstVaapiFilter * filter, guint * num_filters_ptr)
*num_filters_ptr = num_filters;
return filters;
/* ERRORS */
error:
g_free (filters);
return NULL;
{
g_free (filters);
return NULL;
}
}
static VAProcFilterType *
@ -238,9 +241,12 @@ vpp_get_filter_caps_unlocked (GstVaapiFilter * filter, VAProcFilterType type,
*num_caps_ptr = num_caps;
return caps;
/* ERRORS */
error:
g_free (caps);
return NULL;
{
g_free (caps);
return NULL;
}
}
static gpointer
@ -495,9 +501,12 @@ op_data_new (GstVaapiFilterOp op, GParamSpec * pspec)
}
return op_data;
/* ERRORS */
error:
op_data_free (op_data);
return NULL;
{
op_data_free (op_data);
return NULL;
}
}
static inline gpointer
@ -608,9 +617,12 @@ get_operations_default (void)
}
return ops;
/* ERRORS */
error:
g_ptr_array_unref (ops);
return NULL;
{
g_ptr_array_unref (ops);
return NULL;
}
}
/* Get the ordered list of operations, based on VA/VPP queries */
@ -675,12 +687,15 @@ get_operations_ordered (GstVaapiFilter * filter, GPtrArray * default_ops)
g_ptr_array_unref (default_ops);
return ops;
/* ERRORS */
error:
g_free (filter_caps);
g_free (filters);
g_ptr_array_unref (ops);
g_ptr_array_unref (default_ops);
return NULL;
{
g_free (filter_caps);
g_free (filters);
g_ptr_array_unref (ops);
g_ptr_array_unref (default_ops);
return NULL;
}
}
#endif
@ -1027,8 +1042,11 @@ ensure_formats (GstVaapiFilter * filter)
g_free (surface_attribs);
return TRUE;
/* ERRORS */
error:
g_free (surface_attribs);
{
g_free (surface_attribs);
}
#endif
return FALSE;
}
@ -1175,9 +1193,12 @@ gst_vaapi_filter_new (GstVaapiDisplay * display)
goto error;
return filter;
/* ERRORS */
error:
gst_vaapi_filter_unref (filter);
return NULL;
{
gst_vaapi_filter_unref (filter);
return NULL;
}
#else
GST_WARNING ("video processing is not supported, "
"please consider an upgrade to VA-API >= 0.34");
@ -1528,10 +1549,13 @@ gst_vaapi_filter_process_unlocked (GstVaapiFilter * filter,
vaapi_destroy_buffer (filter->va_display, &pipeline_param_buf_id);
return GST_VAAPI_FILTER_STATUS_SUCCESS;
/* ERRORS */
error:
deint_refs_clear_all (filter);
vaapi_destroy_buffer (filter->va_display, &pipeline_param_buf_id);
return GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED;
{
deint_refs_clear_all (filter);
vaapi_destroy_buffer (filter->va_display, &pipeline_param_buf_id);
return GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED;
}
#endif
return GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_OPERATION;
}

View file

@ -258,9 +258,12 @@ GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiImage,
goto error;
return image;
/* ERRORS */
error:
gst_vaapi_object_unref (image);
return NULL;
{
gst_vaapi_object_unref (image);
return NULL;
}
}
/**
@ -297,9 +300,12 @@ gst_vaapi_image_new_with_image (GstVaapiDisplay * display, VAImage * va_image)
goto error;
return image;
/* ERRORS */
error:
gst_vaapi_object_unref (image);
return NULL;
{
gst_vaapi_object_unref (image);
return NULL;
}
}
/**

View file

@ -111,7 +111,10 @@ gst_vaapi_image_pool_new (GstVaapiDisplay * display, const GstVideoInfo * vip)
goto error;
return pool;
/* ERRORS */
error:
gst_vaapi_mini_object_unref (GST_VAAPI_MINI_OBJECT (pool));
return NULL;
{
gst_vaapi_mini_object_unref (GST_VAAPI_MINI_OBJECT (pool));
return NULL;
}
}

View file

@ -98,9 +98,12 @@ gst_vaapi_parser_frame_new (guint width, guint height)
frame->output_offset = 0;
return frame;
/* ERRORS */
error:
gst_vaapi_parser_frame_unref (frame);
return NULL;
{
gst_vaapi_parser_frame_unref (frame);
return NULL;
}
}
/**

View file

@ -70,9 +70,12 @@ gst_vaapi_pixmap_new (const GstVaapiPixmapClass * pixmap_class,
goto error;
return pixmap;
/* ERRORS */
error:
gst_vaapi_pixmap_unref_internal (pixmap);
return NULL;
{
gst_vaapi_pixmap_unref_internal (pixmap);
return NULL;
}
}
GstVaapiPixmap *
@ -91,9 +94,12 @@ gst_vaapi_pixmap_new_from_native (const GstVaapiPixmapClass * pixmap_class,
goto error;
return pixmap;
/* ERRORS */
error:
gst_vaapi_pixmap_unref_internal (pixmap);
return NULL;
{
gst_vaapi_pixmap_unref_internal (pixmap);
return NULL;
}
}
/**

View file

@ -156,9 +156,12 @@ GST_VAAPI_OBJECT_DEFINE_CLASS (GstVaapiSubpicture, gst_vaapi_subpicture)
goto error;
return subpicture;
/* ERRORS */
error:
gst_vaapi_object_unref (subpicture);
return NULL;
{
gst_vaapi_object_unref (subpicture);
return NULL;
}
}
/**

View file

@ -344,9 +344,12 @@ gst_vaapi_surface_new (GstVaapiDisplay * display,
goto error;
return surface;
/* ERRORS */
error:
gst_vaapi_object_unref (surface);
return NULL;
{
gst_vaapi_object_unref (surface);
return NULL;
}
}
/**
@ -380,9 +383,12 @@ gst_vaapi_surface_new_full (GstVaapiDisplay * display,
goto error;
return surface;
/* ERRORS */
error:
gst_vaapi_object_unref (surface);
return NULL;
{
gst_vaapi_object_unref (surface);
return NULL;
}
}
/**
@ -443,9 +449,12 @@ gst_vaapi_surface_new_from_buffer_proxy (GstVaapiDisplay * display,
goto error;
return surface;
/* ERRORS */
error:
gst_vaapi_object_unref (surface);
return NULL;
{
gst_vaapi_object_unref (surface);
return NULL;
}
}
/**

View file

@ -161,9 +161,12 @@ gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display,
goto error;
return pool;
/* ERRORS */
error:
gst_vaapi_mini_object_unref (GST_VAAPI_MINI_OBJECT (pool));
return NULL;
{
gst_vaapi_mini_object_unref (GST_VAAPI_MINI_OBJECT (pool));
return NULL;
}
}
/**

View file

@ -102,9 +102,12 @@ gst_vaapi_surface_proxy_new (GstVaapiSurface * surface)
gst_vaapi_surface_proxy_init_properties (proxy);
return proxy;
/* ERRORS */
error:
gst_vaapi_surface_proxy_unref (proxy);
return NULL;
{
gst_vaapi_surface_proxy_unref (proxy);
return NULL;
}
}
/**
@ -140,9 +143,12 @@ gst_vaapi_surface_proxy_new_from_pool (GstVaapiSurfacePool * pool)
gst_vaapi_surface_proxy_init_properties (proxy);
return proxy;
/* ERRORS */
error:
gst_vaapi_surface_proxy_unref (proxy);
return NULL;
{
gst_vaapi_surface_proxy_unref (proxy);
return NULL;
}
}
/**

View file

@ -82,9 +82,12 @@ gst_vaapi_texture_new_internal (const GstVaapiTextureClass * klass,
goto error;
return texture;
/* ERRORS */
error:
gst_vaapi_object_unref (texture);
return NULL;
{
gst_vaapi_object_unref (texture);
return NULL;
}
}
/**

View file

@ -106,9 +106,12 @@ vaapi_create_buffer (VADisplay dpy, VAContextID ctx, int type, guint size,
*buf_id_ptr = buf_id;
return TRUE;
/* ERRORS */
error:
vaapi_destroy_buffer (dpy, &buf_id);
return FALSE;
{
vaapi_destroy_buffer (dpy, &buf_id);
return FALSE;
}
}
/* Destroy VA buffer */

View file

@ -472,9 +472,12 @@ egl_vtable_new (EglDisplay * display, guint gles_version)
goto error;
return vtable;
/* ERRORS */
error:
egl_object_replace (&vtable, NULL);
return NULL;
{
egl_object_replace (&vtable, NULL);
return NULL;
}
}
static EglVTable *
@ -596,9 +599,12 @@ done:
g_cond_broadcast (&display->gl_thread_ready);
return NULL;
/* ERRORS */
error:
display->base.is_valid = FALSE;
goto done;
{
display->base.is_valid = FALSE;
goto done;
}
}
static gboolean
@ -651,9 +657,12 @@ egl_display_new_full (gpointer handle, gboolean is_wrapped)
goto error;
return display;
/* ERRORS */
error:
egl_object_unref (display);
return NULL;
{
egl_object_unref (display);
return NULL;
}
}
EglDisplay *
@ -766,9 +775,12 @@ egl_config_new_with_attribs (EglDisplay * display, const EGLint * attribs)
goto error;
return config;
/* ERRORS */
error:
egl_object_replace (&config, NULL);
return NULL;
{
egl_object_replace (&config, NULL);
return NULL;
}
}
static EglConfig *
@ -1030,9 +1042,12 @@ do_egl_context_new (CreateContextArgs * args)
args->context = ctx;
return;
/* ERRORS */
error:
egl_object_replace (&ctx, NULL);
args->context = NULL;
{
egl_object_replace (&ctx, NULL);
args->context = NULL;
}
}
EglContext *
@ -1256,9 +1271,12 @@ egl_program_new (EglContext * ctx, const gchar * frag_shader_text,
goto error;
return program;
/* ERRORS */
error:
egl_object_replace (&program, NULL);
return NULL;
{
egl_object_replace (&program, NULL);
return NULL;
}
}
/* ------------------------------------------------------------------------- */
@ -1319,9 +1337,12 @@ egl_window_new (EglContext * ctx, gpointer native_window)
goto error;
return window;
/* ERRORS */
error:
egl_object_replace (&window, NULL);
return NULL;
{
egl_object_replace (&window, NULL);
return NULL;
}
}
/* ------------------------------------------------------------------------- */

View file

@ -357,16 +357,21 @@ gl_create_context (Display * dpy, int screen, GLContextState * parent)
cs->visual = glXGetVisualFromFBConfig (cs->display, fbconfigs[n]);
cs->context = glXCreateNewContext (cs->display,
fbconfigs[n], GLX_RGBA_TYPE, parent ? parent->context : NULL, True);
if (cs->context)
goto end;
if (!cs->context)
goto error;
error:
gl_destroy_context (cs);
cs = NULL;
end:
if (fbconfigs)
XFree (fbconfigs);
return cs;
/* ERRORS */
error:
{
gl_destroy_context (cs);
cs = NULL;
goto end;
}
}
/**
@ -890,9 +895,12 @@ gl_create_pixmap_object (Display * dpy, guint width, guint height)
gl_unbind_texture (&pixo->old_texture);
return pixo;
/* ERRORS */
error:
gl_destroy_pixmap_object (pixo);
return NULL;
{
gl_destroy_pixmap_object (pixo);
return NULL;
}
}
/**
@ -1042,9 +1050,12 @@ gl_create_framebuffer_object (GLenum target,
goto error;
return fbo;
/* ERRORS */
error:
gl_destroy_framebuffer_object (fbo);
return NULL;
{
gl_destroy_framebuffer_object (fbo);
return NULL;
}
}
/**

View file

@ -99,9 +99,12 @@ gst_vaapi_window_new_internal (const GstVaapiWindowClass * window_class,
goto error;
return window;
/* ERRORS */
error:
gst_vaapi_window_unref_internal (window);
return NULL;
{
gst_vaapi_window_unref_internal (window);
return NULL;
}
}
/**

View file

@ -357,9 +357,12 @@ gst_vaapi_window_glx_new (GstVaapiDisplay * display, guint width, guint height)
goto error;
return window;
/* ERRORS */
error:
gst_vaapi_window_unref (window);
return NULL;
{
gst_vaapi_window_unref (window);
return NULL;
}
}
/**
@ -394,9 +397,12 @@ gst_vaapi_window_glx_new_with_xid (GstVaapiDisplay * display, Window xid)
goto error;
return window;
/* ERRORS */
error:
gst_vaapi_window_unref (window);
return NULL;
{
gst_vaapi_window_unref (window);
return NULL;
}
}
/**

View file

@ -198,10 +198,13 @@ gst_vaapi_window_wayland_sync (GstVaapiWindow * window)
}
return TRUE;
/* ERRORS */
error:
priv->sync_failed = TRUE;
GST_ERROR ("Error on dispatching events: %s", g_strerror (errno));
return FALSE;
{
priv->sync_failed = TRUE;
GST_ERROR ("Error on dispatching events: %s", g_strerror (errno));
return FALSE;
}
}
static void
@ -433,19 +436,25 @@ vpp_convert (GstVaapiWindow * window,
/* ERRORS */
error_create_filter:
GST_WARNING ("failed to create VPP filter. Disabling");
priv->use_vpp = FALSE;
return NULL;
{
GST_WARNING ("failed to create VPP filter. Disabling");
priv->use_vpp = FALSE;
return NULL;
}
error_unsupported_format:
GST_ERROR ("unsupported render target format %s",
gst_vaapi_video_format_to_string (priv->surface_format));
priv->use_vpp = FALSE;
return NULL;
{
GST_ERROR ("unsupported render target format %s",
gst_vaapi_video_format_to_string (priv->surface_format));
priv->use_vpp = FALSE;
return NULL;
}
error_process_filter:
GST_ERROR ("failed to process surface %" GST_VAAPI_ID_FORMAT " (error %d)",
GST_VAAPI_ID_ARGS (GST_VAAPI_OBJECT_ID (surface)), status);
gst_vaapi_video_pool_put_object (priv->surface_pool, vpp_surface);
return NULL;
{
GST_ERROR ("failed to process surface %" GST_VAAPI_ID_FORMAT " (error %d)",
GST_VAAPI_ID_ARGS (GST_VAAPI_OBJECT_ID (surface)), status);
gst_vaapi_video_pool_put_object (priv->surface_pool, vpp_surface);
return NULL;
}
}
static gboolean