mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
adding a helper printf function for gst_element_error
Original commit message from CVS: adding a helper printf function for gst_element_error
This commit is contained in:
parent
f26ac1474a
commit
b0a02001fa
3 changed files with 42 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
|||
2004-01-19 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/gstelement.c: (gst_element_error_printf),
|
||||
(gst_element_error_extended):
|
||||
* gst/gstelement.h:
|
||||
add a helper printf function so we can have NULL values passed.
|
||||
|
||||
2004-01-19 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/gstelement.h:
|
||||
|
|
|
@ -2349,6 +2349,29 @@ gst_element_convert (GstElement *element,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_error_printf:
|
||||
* @format: the printf-like format to use, or NULL
|
||||
*
|
||||
* This function is only used internally by the #gst_element_error macro.
|
||||
*
|
||||
* Returns: a newly allocated string, or NULL if the format was NULL or ""
|
||||
*/
|
||||
gchar *
|
||||
gst_element_error_printf (const gchar *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
gchar *buffer;
|
||||
|
||||
if (format == NULL) return NULL;
|
||||
if (format[0] == 0) return NULL;
|
||||
|
||||
va_start (args, format);
|
||||
buffer = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_error_extended:
|
||||
* @element: a #GstElement with the error.
|
||||
|
@ -2361,7 +2384,7 @@ gst_element_convert (GstElement *element,
|
|||
*
|
||||
* signals an error condition on an element.
|
||||
* This function is used internally by elements.
|
||||
* It results in the "error_2" signal.
|
||||
* It results in the "error" signal.
|
||||
*/
|
||||
void
|
||||
gst_element_error_extended
|
||||
|
@ -2378,13 +2401,20 @@ gst_element_error_extended
|
|||
/* check if we send the given message or the default error message */
|
||||
if ((message == NULL) || (message[0] == 0))
|
||||
{
|
||||
/* we got this message from g_strdup_printf (NULL); */
|
||||
/* we got this message from g_strdup_printf (""); */
|
||||
g_free (message);
|
||||
sent_message = gst_error_get_message (domain, code);
|
||||
}
|
||||
else
|
||||
sent_message = message;
|
||||
|
||||
if ((debug == NULL) || (debug[0] == 0))
|
||||
{
|
||||
/* we got this debug from g_strdup_printf (""); */
|
||||
g_free (debug);
|
||||
debug = NULL;
|
||||
}
|
||||
|
||||
/* create error message */
|
||||
GST_CAT_INFO (GST_CAT_ERROR_SYSTEM, "signaling error in %s: %s",
|
||||
GST_ELEMENT_NAME (element),
|
||||
|
|
|
@ -142,8 +142,8 @@ typedef enum {
|
|||
#define gst_element_error(el, domain, code, message, debug) G_STMT_START { \
|
||||
gst_element_error_extended (GST_ELEMENT(el), \
|
||||
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \
|
||||
g_strdup_printf message, \
|
||||
g_strdup_printf debug, \
|
||||
gst_element_error_printf message, \
|
||||
gst_element_error_printf debug, \
|
||||
__FILE__, GST_FUNCTION, __LINE__); } G_STMT_END
|
||||
|
||||
typedef struct _GstElementFactory GstElementFactory;
|
||||
|
@ -365,6 +365,7 @@ void gst_element_found_tags_for_pad (GstElement *element, GstPad *pad, GstCloc
|
|||
|
||||
void gst_element_set_eos (GstElement *element);
|
||||
|
||||
gchar * gst_element_error_printf (const gchar *format, ...);
|
||||
void gst_element_error_extended (GstElement *element, GQuark domain, gint code, gchar *message, gchar *debug, const gchar *file, const gchar *function, gint line);
|
||||
|
||||
gboolean gst_element_is_locked_state (GstElement *element);
|
||||
|
|
Loading…
Reference in a new issue