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 */ /* ERRORS */
error_unsupported_mem_type: error_unsupported_mem_type:
GST_ERROR ("unsupported buffer type (%d)", proxy->type); {
gst_vaapi_buffer_proxy_unref_internal (proxy); GST_ERROR ("unsupported buffer type (%d)", proxy->type);
return NULL; gst_vaapi_buffer_proxy_unref_internal (proxy);
return NULL;
}
#else #else
return NULL; return NULL;
#endif #endif
@ -214,13 +216,17 @@ gst_vaapi_buffer_proxy_new_from_object (GstVaapiObject * object,
/* ERRORS */ /* ERRORS */
error_unsupported_mem_type: error_unsupported_mem_type:
GST_ERROR ("unsupported buffer type (%d)", proxy->type); {
gst_vaapi_buffer_proxy_unref_internal (proxy); GST_ERROR ("unsupported buffer type (%d)", proxy->type);
return NULL; gst_vaapi_buffer_proxy_unref_internal (proxy);
return NULL;
}
error_acquire_handle: error_acquire_handle:
GST_ERROR ("failed to acquire the underlying VA buffer handle"); {
gst_vaapi_buffer_proxy_unref_internal (proxy); GST_ERROR ("failed to acquire the underlying VA buffer handle");
return NULL; gst_vaapi_buffer_proxy_unref_internal (proxy);
return NULL;
}
#else #else
return NULL; return NULL;
#endif #endif

View file

@ -128,9 +128,12 @@ gst_vaapi_coded_buffer_new (GstVaapiContext * context, guint buf_size)
goto error; goto error;
return buf; return buf;
/* ERRORS */
error: 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); gst_vaapi_object_ref (proxy->buffer);
return proxy; return proxy;
/* ERRORS */
error: 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; goto error;
return context; return context;
/* ERRORS */
error: 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; render_rect->height = height;
return overlay; return overlay;
/* ERRORS */
error: error:
overlay_rectangle_unref (overlay); {
return NULL; overlay_rectangle_unref (overlay);
return NULL;
}
} }
static void static void
@ -438,7 +441,10 @@ gst_vaapi_context_apply_composition (GstVaapiContext * context,
return FALSE; return FALSE;
return TRUE; return TRUE;
/* ERRORS */
error: 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; goto error;
return decoder; return decoder;
/* ERRORS */
error: 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; goto error;
return dpb; return dpb;
/* ERRORS */
error: error:
gst_vaapi_dpb_unref (dpb); {
return NULL; gst_vaapi_dpb_unref (dpb);
return NULL;
}
} }
static gint static gint

View file

@ -1144,12 +1144,14 @@ mvc_reset (GstVaapiDecoderH264 * decoder)
/* ERRORS */ /* ERRORS */
error_allocate: error_allocate:
g_free (priv->prev_ref_frames); {
priv->prev_ref_frames = NULL; g_free (priv->prev_ref_frames);
g_free (priv->prev_frames); priv->prev_ref_frames = NULL;
priv->prev_frames = NULL; g_free (priv->prev_frames);
priv->prev_frames_alloc = 0; priv->prev_frames = NULL;
return FALSE; priv->prev_frames_alloc = 0;
return FALSE;
}
} }
static GstVaapiDecoderStatus static GstVaapiDecoderStatus
@ -1627,15 +1629,20 @@ decode_current_picture (GstVaapiDecoderH264 * decoder)
gst_vaapi_picture_replace (&priv->current_picture, NULL); gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_SUCCESS; return GST_VAAPI_DECODER_STATUS_SUCCESS;
/* ERRORS */
error: error:
/* XXX: fix for cases where first field failed to be decoded */ {
gst_vaapi_picture_replace (&priv->current_picture, NULL); /* XXX: fix for cases where first field failed to be decoded */
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN; gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
}
drop_frame: drop_frame:
priv->decoder_state = 0; {
priv->pic_structure = GST_H264_SEI_PIC_STRUCT_FRAME; priv->decoder_state = 0;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME; priv->pic_structure = GST_H264_SEI_PIC_STRUCT_FRAME;
return (GstVaapiDecoderStatus) GST_VAAPI_DECODER_STATUS_DROP_FRAME;
}
} }
static GstVaapiDecoderStatus static GstVaapiDecoderStatus
@ -2990,8 +2997,10 @@ fill_picture_first_field_gap (GstVaapiDecoderH264 * decoder,
/* ERRORS */ /* ERRORS */
error_allocate_field: 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 static gboolean
@ -3033,11 +3042,15 @@ cleanup:
/* ERRORS */ /* ERRORS */
error_exec_ref_pic_marking: 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: 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 * static GstVaapiPictureH264 *
@ -3096,17 +3109,25 @@ fill_picture_other_field_gap (GstVaapiDecoderH264 * decoder,
/* ERRORS */ /* ERRORS */
error_find_field: 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: 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: 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: 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 static gboolean
@ -3206,14 +3227,20 @@ cleanup:
/* ERRORS */ /* ERRORS */
error_allocate_picture: 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: 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: 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 static gboolean
@ -4307,8 +4334,10 @@ gst_vaapi_decoder_h264_decode_codec_data (GstVaapiDecoder * base_decoder,
status = GST_VAAPI_DECODER_STATUS_SUCCESS; status = GST_VAAPI_DECODER_STATUS_SUCCESS;
cleanup: cleanup:
gst_vaapi_parser_info_h264_replace (&pi, NULL); {
return status; gst_vaapi_parser_info_h264_replace (&pi, NULL);
return status;
}
} }
static GstVaapiDecoderStatus static GstVaapiDecoderStatus
@ -4547,8 +4576,10 @@ gst_vaapi_decoder_h264_parse (GstVaapiDecoder * base_decoder,
return GST_VAAPI_DECODER_STATUS_SUCCESS; return GST_VAAPI_DECODER_STATUS_SUCCESS;
exit: exit:
gst_vaapi_parser_info_h264_unref (pi); {
return status; gst_vaapi_parser_info_h264_unref (pi);
return status;
}
} }
static GstVaapiDecoderStatus static GstVaapiDecoderStatus

View file

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

View file

@ -235,13 +235,18 @@ decode_current_picture (GstVaapiDecoderJpeg * decoder)
gst_vaapi_picture_replace (&priv->current_picture, NULL); gst_vaapi_picture_replace (&priv->current_picture, NULL);
return GST_VAAPI_DECODER_STATUS_SUCCESS; return GST_VAAPI_DECODER_STATUS_SUCCESS;
/* ERRORS */
error: 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: 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 static gboolean

View file

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

View file

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

View file

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

View file

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

View file

@ -1121,9 +1121,12 @@ gst_vaapi_display_new (GstVaapiDisplay * display,
goto error; goto error;
return display; return display;
/* ERRORS */
error: 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; return entry;
/* ERRORS */
error: error:
cache_entry_free (entry); {
return NULL; cache_entry_free (entry);
return NULL;
}
} }
static inline gboolean static inline gboolean

View file

@ -579,6 +579,7 @@ is_chroma_type_supported (GstVaapiEncoder * encoder)
return TRUE; return TRUE;
/* ERRORS */
unsupported: unsupported:
{ {
GST_ERROR ("We only support YUV 4:2:0 and YUV 4:2:2 for encoding. " 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; goto error;
return encoder; return encoder;
/* ERRORS */
error: error:
gst_vaapi_encoder_unref (encoder); {
return NULL; gst_vaapi_encoder_unref (encoder);
return NULL;
}
} }
/** Returns a GType for the #GstVaapiEncoderTune set */ /** Returns a GType for the #GstVaapiEncoderTune set */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -191,9 +191,12 @@ vpp_get_filters_unlocked (GstVaapiFilter * filter, guint * num_filters_ptr)
*num_filters_ptr = num_filters; *num_filters_ptr = num_filters;
return filters; return filters;
/* ERRORS */
error: error:
g_free (filters); {
return NULL; g_free (filters);
return NULL;
}
} }
static VAProcFilterType * static VAProcFilterType *
@ -238,9 +241,12 @@ vpp_get_filter_caps_unlocked (GstVaapiFilter * filter, VAProcFilterType type,
*num_caps_ptr = num_caps; *num_caps_ptr = num_caps;
return caps; return caps;
/* ERRORS */
error: error:
g_free (caps); {
return NULL; g_free (caps);
return NULL;
}
} }
static gpointer static gpointer
@ -495,9 +501,12 @@ op_data_new (GstVaapiFilterOp op, GParamSpec * pspec)
} }
return op_data; return op_data;
/* ERRORS */
error: error:
op_data_free (op_data); {
return NULL; op_data_free (op_data);
return NULL;
}
} }
static inline gpointer static inline gpointer
@ -608,9 +617,12 @@ get_operations_default (void)
} }
return ops; return ops;
/* ERRORS */
error: 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 */ /* 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); g_ptr_array_unref (default_ops);
return ops; return ops;
/* ERRORS */
error: error:
g_free (filter_caps); {
g_free (filters); g_free (filter_caps);
g_ptr_array_unref (ops); g_free (filters);
g_ptr_array_unref (default_ops); g_ptr_array_unref (ops);
return NULL; g_ptr_array_unref (default_ops);
return NULL;
}
} }
#endif #endif
@ -1027,8 +1042,11 @@ ensure_formats (GstVaapiFilter * filter)
g_free (surface_attribs); g_free (surface_attribs);
return TRUE; return TRUE;
/* ERRORS */
error: error:
g_free (surface_attribs); {
g_free (surface_attribs);
}
#endif #endif
return FALSE; return FALSE;
} }
@ -1175,9 +1193,12 @@ gst_vaapi_filter_new (GstVaapiDisplay * display)
goto error; goto error;
return filter; return filter;
/* ERRORS */
error: error:
gst_vaapi_filter_unref (filter); {
return NULL; gst_vaapi_filter_unref (filter);
return NULL;
}
#else #else
GST_WARNING ("video processing is not supported, " GST_WARNING ("video processing is not supported, "
"please consider an upgrade to VA-API >= 0.34"); "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); vaapi_destroy_buffer (filter->va_display, &pipeline_param_buf_id);
return GST_VAAPI_FILTER_STATUS_SUCCESS; return GST_VAAPI_FILTER_STATUS_SUCCESS;
/* ERRORS */
error: error:
deint_refs_clear_all (filter); {
vaapi_destroy_buffer (filter->va_display, &pipeline_param_buf_id); deint_refs_clear_all (filter);
return GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED; vaapi_destroy_buffer (filter->va_display, &pipeline_param_buf_id);
return GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED;
}
#endif #endif
return GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_OPERATION; return GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_OPERATION;
} }

View file

@ -258,9 +258,12 @@ GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiImage,
goto error; goto error;
return image; return image;
/* ERRORS */
error: 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; goto error;
return image; return image;
/* ERRORS */
error: 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; goto error;
return pool; return pool;
/* ERRORS */
error: 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; frame->output_offset = 0;
return frame; return frame;
/* ERRORS */
error: 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; goto error;
return pixmap; return pixmap;
/* ERRORS */
error: error:
gst_vaapi_pixmap_unref_internal (pixmap); {
return NULL; gst_vaapi_pixmap_unref_internal (pixmap);
return NULL;
}
} }
GstVaapiPixmap * GstVaapiPixmap *
@ -91,9 +94,12 @@ gst_vaapi_pixmap_new_from_native (const GstVaapiPixmapClass * pixmap_class,
goto error; goto error;
return pixmap; return pixmap;
/* ERRORS */
error: 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; goto error;
return subpicture; return subpicture;
/* ERRORS */
error: 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; goto error;
return surface; return surface;
/* ERRORS */
error: 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; goto error;
return surface; return surface;
/* ERRORS */
error: 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; goto error;
return surface; return surface;
/* ERRORS */
error: 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; goto error;
return pool; return pool;
/* ERRORS */
error: 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); gst_vaapi_surface_proxy_init_properties (proxy);
return proxy; return proxy;
/* ERRORS */
error: 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); gst_vaapi_surface_proxy_init_properties (proxy);
return proxy; return proxy;
/* ERRORS */
error: 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; goto error;
return texture; return texture;
/* ERRORS */
error: 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; *buf_id_ptr = buf_id;
return TRUE; return TRUE;
/* ERRORS */
error: error:
vaapi_destroy_buffer (dpy, &buf_id); {
return FALSE; vaapi_destroy_buffer (dpy, &buf_id);
return FALSE;
}
} }
/* Destroy VA buffer */ /* Destroy VA buffer */

View file

@ -472,9 +472,12 @@ egl_vtable_new (EglDisplay * display, guint gles_version)
goto error; goto error;
return vtable; return vtable;
/* ERRORS */
error: error:
egl_object_replace (&vtable, NULL); {
return NULL; egl_object_replace (&vtable, NULL);
return NULL;
}
} }
static EglVTable * static EglVTable *
@ -596,9 +599,12 @@ done:
g_cond_broadcast (&display->gl_thread_ready); g_cond_broadcast (&display->gl_thread_ready);
return NULL; return NULL;
/* ERRORS */
error: error:
display->base.is_valid = FALSE; {
goto done; display->base.is_valid = FALSE;
goto done;
}
} }
static gboolean static gboolean
@ -651,9 +657,12 @@ egl_display_new_full (gpointer handle, gboolean is_wrapped)
goto error; goto error;
return display; return display;
/* ERRORS */
error: error:
egl_object_unref (display); {
return NULL; egl_object_unref (display);
return NULL;
}
} }
EglDisplay * EglDisplay *
@ -766,9 +775,12 @@ egl_config_new_with_attribs (EglDisplay * display, const EGLint * attribs)
goto error; goto error;
return config; return config;
/* ERRORS */
error: error:
egl_object_replace (&config, NULL); {
return NULL; egl_object_replace (&config, NULL);
return NULL;
}
} }
static EglConfig * static EglConfig *
@ -1030,9 +1042,12 @@ do_egl_context_new (CreateContextArgs * args)
args->context = ctx; args->context = ctx;
return; return;
/* ERRORS */
error: error:
egl_object_replace (&ctx, NULL); {
args->context = NULL; egl_object_replace (&ctx, NULL);
args->context = NULL;
}
} }
EglContext * EglContext *
@ -1256,9 +1271,12 @@ egl_program_new (EglContext * ctx, const gchar * frag_shader_text,
goto error; goto error;
return program; return program;
/* ERRORS */
error: 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; goto error;
return window; return window;
/* ERRORS */
error: 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->visual = glXGetVisualFromFBConfig (cs->display, fbconfigs[n]);
cs->context = glXCreateNewContext (cs->display, cs->context = glXCreateNewContext (cs->display,
fbconfigs[n], GLX_RGBA_TYPE, parent ? parent->context : NULL, True); fbconfigs[n], GLX_RGBA_TYPE, parent ? parent->context : NULL, True);
if (cs->context) if (!cs->context)
goto end; goto error;
error:
gl_destroy_context (cs);
cs = NULL;
end: end:
if (fbconfigs) if (fbconfigs)
XFree (fbconfigs); XFree (fbconfigs);
return cs; 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); gl_unbind_texture (&pixo->old_texture);
return pixo; return pixo;
/* ERRORS */
error: 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; goto error;
return fbo; return fbo;
/* ERRORS */
error: 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; goto error;
return window; return window;
/* ERRORS */
error: 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; goto error;
return window; return window;
/* ERRORS */
error: 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; goto error;
return window; return window;
/* ERRORS */
error: 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; return TRUE;
/* ERRORS */
error: error:
priv->sync_failed = TRUE; {
GST_ERROR ("Error on dispatching events: %s", g_strerror (errno)); priv->sync_failed = TRUE;
return FALSE; GST_ERROR ("Error on dispatching events: %s", g_strerror (errno));
return FALSE;
}
} }
static void static void
@ -433,19 +436,25 @@ vpp_convert (GstVaapiWindow * window,
/* ERRORS */ /* ERRORS */
error_create_filter: error_create_filter:
GST_WARNING ("failed to create VPP filter. Disabling"); {
priv->use_vpp = FALSE; GST_WARNING ("failed to create VPP filter. Disabling");
return NULL; priv->use_vpp = FALSE;
return NULL;
}
error_unsupported_format: error_unsupported_format:
GST_ERROR ("unsupported render target format %s", {
gst_vaapi_video_format_to_string (priv->surface_format)); GST_ERROR ("unsupported render target format %s",
priv->use_vpp = FALSE; gst_vaapi_video_format_to_string (priv->surface_format));
return NULL; priv->use_vpp = FALSE;
return NULL;
}
error_process_filter: 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_ERROR ("failed to process surface %" GST_VAAPI_ID_FORMAT " (error %d)",
gst_vaapi_video_pool_put_object (priv->surface_pool, vpp_surface); GST_VAAPI_ID_ARGS (GST_VAAPI_OBJECT_ID (surface)), status);
return NULL; gst_vaapi_video_pool_put_object (priv->surface_pool, vpp_surface);
return NULL;
}
} }
static gboolean static gboolean