From 07ed811a0983771c45faa2f6f76a9fff186db407 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 18 Jan 2004 21:46:58 +0000 Subject: use new error signal and classification Original commit message from CVS: use new error signal and classification --- ext/audiofile/gstafsink.c | 29 +++++++++++++---------------- ext/audiofile/gstafsrc.c | 21 ++++++++++++--------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'ext/audiofile') diff --git a/ext/audiofile/gstafsink.c b/ext/audiofile/gstafsink.c index 02e28f8b..4b4704cb 100644 --- a/ext/audiofile/gstafsink.c +++ b/ext/audiofile/gstafsink.c @@ -24,7 +24,13 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + +#include "gst-libs/gst/gst-i18n-plugin.h" + #include +#include +#include + #include "gstafsink.h" /* elementfactory information */ @@ -32,7 +38,7 @@ static GstElementDetails afsink_details = { "Audiofile Sink", "Sink/Audio", "Write audio streams to disk using libaudiofile", - "Thomas ", + "Thomas Vander Stichele ", }; @@ -288,16 +294,6 @@ gst_afsink_open_file (GstAFSink *sink) g_return_val_if_fail (!GST_FLAG_IS_SET (sink, GST_AFSINK_OPEN), FALSE); - /* open the file */ -/* we use audiofile now - sink->file = fopen (sink->filename, "w"); - if (sink->file == NULL) { - perror ("open"); - gst_element_error (GST_ELEMENT (sink), g_strconcat("opening file \"", sink->filename, "\"", NULL)); - return FALSE; - } -*/ - /* get the audio parameters */ g_return_val_if_fail (GST_IS_PAD (sink->sinkpad), FALSE); caps = GST_PAD_CAPS (sink->sinkpad); @@ -345,8 +341,9 @@ gst_afsink_open_file (GstAFSink *sink) sink->file = afOpenFile (sink->filename, "w", outfilesetup); if (sink->file == AF_NULL_FILEHANDLE) { - perror ("open"); - gst_element_error (GST_ELEMENT (sink), g_strconcat("opening file \"", sink->filename, "\"", NULL)); + gst_element_error (sink, RESOURCE, OPEN_WRITE, + (_("Could not open file \"%s\" for writing"), sink->filename), + ("system error: %s", strerror (errno))); return FALSE; } @@ -367,9 +364,9 @@ gst_afsink_close_file (GstAFSink *sink) /* if (fclose (sink->file) != 0) */ if (afCloseFile (sink->file) != 0) { - g_print ("WARNING: afsink: oops, error closing !\n"); - perror ("close"); - gst_element_error (GST_ELEMENT (sink), g_strconcat("closing file \"", sink->filename, "\"", NULL)); + gst_element_error (sink, RESOURCE, CLOSE, + (_("Error closing file \"%s\""), sink->filename), + GST_ERROR_SYSTEM); } else { GST_FLAG_UNSET (sink, GST_AFSINK_OPEN); diff --git a/ext/audiofile/gstafsrc.c b/ext/audiofile/gstafsrc.c index 7d477ab2..965021c0 100644 --- a/ext/audiofile/gstafsrc.c +++ b/ext/audiofile/gstafsrc.c @@ -24,8 +24,13 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + +#include "gst-libs/gst/gst-i18n-plugin.h" #include #include +#include +#include + #include "gstafsrc.h" /* elementfactory information */ @@ -305,10 +310,9 @@ gst_afsrc_open_file (GstAFSrc *src) src->file = afOpenFile (src->filename, "r", AF_NULL_FILESETUP); if (src->file == AF_NULL_FILEHANDLE) { - g_print ("ERROR: gstafsrc: Could not open file %s for reading\n", - src->filename); - gst_element_error (GST_ELEMENT (src), g_strconcat ("opening file \"", - src->filename, "\"", NULL)); + gst_element_error (src, RESOURCE, OPEN_READ, + (_("Could not open file \"%s\" for reading"), src->filename), + ("system error: %s", strerror (errno))); return FALSE; } @@ -364,11 +368,10 @@ gst_afsrc_close_file (GstAFSrc *src) /* if (fclose (src->file) != 0) */ if (afCloseFile (src->file) != 0) { - g_print ("WARNING: afsrc: oops, error closing !\n"); - perror ("close"); - gst_element_error (GST_ELEMENT (src), g_strconcat("closing file \"", src->filename, "\"", NULL)); - } - else { + gst_element_error (src, RESOURCE, CLOSE, + (_("Error closing file \"%s\""), src->filename), + GST_ERROR_SYSTEM); + } else { GST_FLAG_UNSET (src, GST_AFSRC_OPEN); } } -- cgit v1.2.1