From d26698b5a15de537516f356e39b43859fc174400 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 15 Sep 2003 00:34:44 +0000 Subject: [PATCH] converted gst_element_error to new format in gst/ - gettext pending Original commit message from CVS: converted gst_element_error to new format in gst/ - gettext pending --- gst/adder/gstadder.c | 83 +++++++++++++++++++----------- gst/audioconvert/gstaudioconvert.c | 7 +-- 2 files changed, 56 insertions(+), 34 deletions(-) diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index 60f1741319..2597bf3a2c 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -149,29 +149,38 @@ gst_adder_parse_caps (GstAdder *adder, GstCaps *caps) /* provide an error message if we can't link */ if (adder->format != GST_ADDER_FORMAT_INT) { - gst_element_error (el, "can't link a non-int pad to an int adder"); + gst_element_gerror(el, GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf("can't link a non-int pad to an int adder")); return FALSE; } if (adder->channels != channels) { - gst_element_error (el, - "can't link %d-channel pad with %d-channel adder", - channels, adder->channels); + gst_element_gerror(el, GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf( "can't link %d-channel pad with %d-channel adder", + channels, adder->channels)); return FALSE; } if (adder->rate != rate) { - gst_element_error (el, "can't link %d Hz pad with %d Hz adder", - rate, adder->rate); + gst_element_gerror(el, GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf ("can't link %d Hz pad with %d Hz adder", + rate, adder->rate)); return FALSE; } if (adder->width != width) { - gst_element_error (el, "can't link %d-bit pad with %d-bit adder", - width, adder->width); + gst_element_gerror(el, GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf ("can't link %d-bit pad with %d-bit adder", + width, adder->width)); return FALSE; } if (adder->is_signed != is_signed) { - gst_element_error (el, "can't link %ssigned pad with %ssigned adder", + gst_element_gerror(el, GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf ("can't link %ssigned pad with %ssigned adder", adder->is_signed ? "" : "un", - is_signed ? "" : "un"); + is_signed ? "" : "un")); return FALSE; } } else if (strcmp (mimetype, "audio/x-raw-float") == 0) { @@ -182,23 +191,30 @@ gst_adder_parse_caps (GstAdder *adder, GstCaps *caps) gst_caps_get_int (caps, "rate", &rate); if (adder->format != GST_ADDER_FORMAT_FLOAT) { - gst_element_error (el, "can't link a non-float pad to a float adder"); + gst_element_gerror(el, GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf("can't link a non-float pad to a float adder")); return FALSE; } if (adder->channels != channels) { - gst_element_error (el, - "can't link %d-channel pad with %d-channel adder", - channels, adder->channels); + gst_element_gerror(el, GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf ("can't link %d-channel pad with %d-channel adder", + channels, adder->channels)); return FALSE; } if (adder->rate != rate) { - gst_element_error (el, "can't link %d Hz pad with %d Hz adder", - rate, adder->rate); + gst_element_gerror(el, GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf( "can't link %d Hz pad with %d Hz adder", + rate, adder->rate)); return FALSE; } if (adder->width != width) { - gst_element_error (el, "can't link %d bit float pad with %d bit adder", - width, adder->width); + gst_element_gerror(el, GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf( "can't link %d bit float pad with %d bit adder", + width, adder->width)); return FALSE; } } @@ -407,7 +423,9 @@ gst_adder_loop (GstElement *element) buf_out = gst_buffer_new_from_pool (adder->bufpool, 0, 0); if (buf_out == NULL) { - gst_element_error (GST_ELEMENT (adder), "could not get new output buffer"); + gst_element_gerror(GST_ELEMENT (adder), GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf("could not get new output buffer")); return; } @@ -495,9 +513,10 @@ gst_adder_loop (GstElement *element) for (i = 0; i < GST_BUFFER_SIZE (buf_out); i++) out[i] = CLAMP(out[i] + in[i], 0x80, 0x7f); } else { - gst_element_error (GST_ELEMENT (adder), - "invalid width (%u) for integer audio in gstadder", - adder->width); + gst_element_gerror(GST_ELEMENT (adder), GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf ("invalid width (%u) for integer audio in gstadder", + adder->width)); return; } } else if (adder->format == GST_ADDER_FORMAT_FLOAT) { @@ -512,15 +531,17 @@ gst_adder_loop (GstElement *element) for (i = 0; i < GST_BUFFER_SIZE (buf_out) / sizeof (gfloat); i++) out[i] = CLAMP(out[i] + in[i], -1.0, 1.0); } else { - gst_element_error (GST_ELEMENT (adder), - "invalid width (%u) for float audio in gstadder", - adder->width); + gst_element_gerror(GST_ELEMENT (adder), GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf ("invalid width (%u) for float audio in gstadder", + adder->width)); return; } } else { - gst_element_error (GST_ELEMENT (adder), - "invalid audio format (%d) in gstadder", - adder->format); + gst_element_gerror(GST_ELEMENT (adder), GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf("invalid audio format (%d) in gstadder", + adder->format)); return; } @@ -537,9 +558,9 @@ gst_adder_loop (GstElement *element) GST_AUDIO_INT_PAD_TEMPLATE_PROPS); if (gst_pad_try_set_caps (adder->srcpad, caps) < 0) { - gst_element_error (GST_ELEMENT (adder), - "Couldn't set the default caps, " - "use link_filtered instead"); + gst_element_gerror(GST_ELEMENT (adder), GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup ("Couldn't set the default caps, use link_filtered instead")); return; } diff --git a/gst/audioconvert/gstaudioconvert.c b/gst/audioconvert/gstaudioconvert.c index c249cae9c1..aae4138b5b 100644 --- a/gst/audioconvert/gstaudioconvert.c +++ b/gst/audioconvert/gstaudioconvert.c @@ -334,9 +334,10 @@ gst_audio_convert_chain (GstPad *pad, GstBuffer *buf) if (!this->caps_set[1]) { if (!gst_audio_convert_set_caps (this->src)) { - gst_element_error (GST_ELEMENT (this), - "AudioConvert: could not set caps on pad %s", - GST_PAD_NAME(this->src)); + gst_element_gerror(GST_ELEMENT (this), GST_ERROR_UNKNOWN, + g_strdup ("unconverted error, file a bug"), + g_strdup_printf("AudioConvert: could not set caps on pad %s", + GST_PAD_NAME(this->src))); return; } }