use new error signal and classification

Original commit message from CVS:
use new error signal and classification
parent b1e81d45
2004-01-18 Thomas Vander Stichele <thomas at apestaart dot org>
* examples/gstplay/player.c: (main):
* ext/aalib/gstaasink.c: (gst_aasink_open):
* ext/alsa/gstalsa.c: (gst_alsa_link), (gst_alsa_xrun_recovery):
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
* ext/alsa/gstalsasrc.c: (gst_alsa_src_loop):
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file):
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file):
* ext/divx/gstdivxdec.c: (gst_divxdec_setup), (gst_divxdec_chain):
* ext/dv/gstdvdec.c: (gst_dvdec_loop):
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_user_op), (dvdnavsrc_get):
* ext/esd/esdmon.c: (gst_esdmon_get):
* ext/esd/esdsink.c: (gst_esdsink_chain):
* ext/faac/gstfaac.c: (gst_faac_chain):
* ext/faad/gstfaad.c: (gst_faad_chain):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_chain):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_loop):
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_loop):
* ext/flac/gstflacdec.c: (gst_flacdec_error_callback),
(gst_flacdec_loop):
* ext/flac/gstflacenc.c: (gst_flacenc_chain):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_chain):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_open_file),
(gst_gnomevfssink_close_file):
* ext/gnomevfs/gstgnomevfssrc.c: (audiocast_init),
(gst_gnomevfssrc_open_file):
* ext/ivorbis/vorbisfile.c: (gst_ivorbisfile_loop):
* ext/lame/gstlame.c: (gst_lame_sink_link), (gst_lame_chain):
* ext/lcs/gstcolorspace.c: (gst_colorspace_srcconnect_func):
* ext/mad/gstid3tag.c: (gst_id3_tag_handle_event),
(gst_id3_tag_do_typefind), (gst_id3_tag_chain):
* ext/mad/gstmad.c: (gst_mad_chain):
* ext/mikmod/gstmikmod.c: (gst_mikmod_loop):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* ext/mplex/gstmplex.cc:
* ext/mplex/gstmplexibitstream.cc:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain),
(gst_ogg_demux_push), (gst_ogg_pad_push):
* ext/raw1394/gstdv1394src.c:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create):
* ext/sidplay/gstsiddec.cc:
* ext/sndfile/gstsf.c: (gst_sf_open_file), (gst_sf_close_file),
(gst_sf_loop):
* ext/speex/gstspeexenc.c: (gst_speexenc_chain):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_chain):
* ext/tarkin/gsttarkinenc.c: (gst_tarkinenc_chain):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_chain):
* ext/vorbis/vorbisfile.c: (gst_vorbisfile_loop):
* ext/xvid/gstxviddec.c: (gst_xviddec_setup), (gst_xviddec_chain):
* ext/xvid/gstxvidenc.c: (gst_xvidenc_setup), (gst_xvidenc_chain):
* gst-libs/gst/Makefile.am:
* gst-libs/gst/riff/riff-read.c: (gst_riff_peek_head),
(gst_riff_read_element_data), (gst_riff_read_seek),
(gst_riff_peek_list), (gst_riff_read_list), (gst_riff_read_header):
* gst/adder/gstadder.c: (gst_adder_parse_caps), (gst_adder_loop):
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_process_segment),
(gst_asf_demux_process_stream), (gst_asf_demux_get_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_stream_init),
(gst_avi_demux_add_stream), (gst_avi_demux_stream_header):
* gst/avi/gstavimux.c: (gst_avimux_stop_file):
* gst/flx/gstflxdec.c: (gst_flxdec_loop):
* gst/goom/gstgoom.c: (gst_goom_chain):
* gst/id3/gstid3types.c: (gst_id3types_loop):
* gst/intfloat/gstfloat2int.c: (gst_float2int_loop):
* gst/intfloat/gstint2float.c: (gst_int2float_chain_gint16):
* gst/matroska/ebml-read.c: (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_header):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_blockgroup):
* gst/modplug/gstmodplug.cc:
* gst/monoscope/gstmonoscope.c: (gst_monoscope_chain):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_loop):
* gst/oneton/gstoneton.c: (gst_oneton_chain):
* gst/silence/gstsilence.c: (gst_silence_get):
* gst/sine/gstsinesrc.c: (gst_sinesrc_get):
* gst/smpte/gstsmpte.c: (gst_smpte_loop):
* gst/speed/gstspeed.c: (speed_loop):
* gst/tags/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
* gst/volenv/gstvolenv.c: (gst_volenv_chain):
* gst/wavenc/gstwavenc.c: (gst_wavenc_chain):
* gst/wavparse/gstwavparse.c: (gst_wavparse_parse_fmt),
(gst_wavparse_loop):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_open),
(dxr3audiosink_set_mode_pcm), (dxr3audiosink_set_mode_ac3),
(dxr3audiosink_close):
* sys/dxr3/dxr3spusink.c: (dxr3spusink_open), (dxr3spusink_close):
* sys/dxr3/dxr3videosink.c: (dxr3videosink_open),
(dxr3videosink_close), (dxr3videosink_write_data):
* sys/oss/gstosselement.c: (gst_osselement_open_audio):
* sys/oss/gstosselement.h:
* sys/oss/gstosssink.c: (gst_osssink_get_type), (gst_osssink_init),
(gst_osssink_chain):
* sys/oss/gstosssrc.c: (gst_osssrc_get):
* sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_chain):
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_buffer_free):
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_buffer_free):
* sys/v4l/v4l-overlay_calls.c: (gst_v4l_set_window),
(gst_v4l_enable_overlay):
* sys/v4l/v4l_calls.c: (gst_v4l_get_capabilities), (gst_v4l_open),
(gst_v4l_set_chan_norm), (gst_v4l_get_signal),
(gst_v4l_get_frequency), (gst_v4l_set_frequency),
(gst_v4l_get_picture), (gst_v4l_set_picture), (gst_v4l_get_audio),
(gst_v4l_set_audio):
* sys/v4l/v4l_calls.h:
* sys/v4l/v4lmjpegsink_calls.c: (gst_v4lmjpegsink_sync_thread),
(gst_v4lmjpegsink_queue_frame), (gst_v4lmjpegsink_set_playback),
(gst_v4lmjpegsink_playback_init),
(gst_v4lmjpegsink_playback_start):
* sys/v4l/v4lmjpegsrc_calls.c: (gst_v4lmjpegsrc_queue_frame),
(gst_v4lmjpegsrc_sync_next_frame), (gst_v4lmjpegsrc_set_capture),
(gst_v4lmjpegsrc_set_capture_m), (gst_v4lmjpegsrc_capture_init),
(gst_v4lmjpegsrc_requeue_frame):
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_queue_frame),
(gst_v4lsrc_sync_frame), (gst_v4lsrc_capture_init),
(gst_v4lsrc_requeue_frame), (gst_v4lsrc_try_palette):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_queue_frame), (gst_v4l2src_grab_frame),
(gst_v4l2src_get_capture), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_stop):
* sys/vcd/vcdsrc.c: (vcdsrc_open_file):
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_chain):
* sys/xvideo/xvideosink.c: (gst_xvideosink_buffer_new),
(gst_xvideosink_sinkconnect), (gst_xvideosink_chain),
(gst_xvideosink_xwindow_new):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_chain):
use new error signal, function and categories
2004-01-18 Jeremy Simon <jesimon@libertysurf.fr>
* configure.ac:
......
......@@ -115,7 +115,7 @@ main (int argc, char *argv[])
/* Getting default audio and video plugins from GConf */
audio_sink = gst_element_factory_make ("osssink", "audio_sink");
video_sink = gst_element_factory_make ("xvimagesink", "video_sink");
video_sink = gst_element_factory_make ("ximagesink", "video_sink");
vis_element = gst_element_factory_make ("goom", "vis_element");
data_src = gst_element_factory_make ("gnomevfssrc", "source");
......
......@@ -24,7 +24,13 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gst-libs/gst/gst-i18n-plugin.h"
#include <gst/gst.h>
#include <string.h>
#include <errno.h>
#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@apestaart.org>",
"Thomas Vander Stichele <thomas@apestaart.org>",
};
......@@ -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);
......
......@@ -24,8 +24,13 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gst-libs/gst/gst-i18n-plugin.h"
#include <gst/gst.h>
#include <gst/audio/audio.h>
#include <string.h>
#include <errno.h>
#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);
}
}
......
......@@ -215,9 +215,8 @@ gst_divxdec_setup (GstDivxDec *divxdec)
xinit.smooth_playback = 0;
xinit.codec_version = 500;
if ((ret = decore(&handle, DEC_OPT_INIT, &xinit, NULL)) != 0) {
gst_element_error(GST_ELEMENT(divxdec),
"Error initializing divx decoding library: %s (%d)",
gst_divxdec_error(ret), ret);
gst_element_error (divxdec, LIBRARY, INIT, NULL,
("divx library error: %s (%d)", gst_divxdec_error (ret), ret));
return FALSE;
}
......@@ -234,9 +233,8 @@ gst_divxdec_setup (GstDivxDec *divxdec)
if ((ret = decore(divxdec->handle, DEC_OPT_SETOUT,
&output, NULL)) != 0) {
gst_element_error(GST_ELEMENT(divxdec),
"Error setting output format: %s (%d)",
gst_divxdec_error(ret), ret);
gst_element_error (divxdec, LIBRARY, SETTINGS, NULL,
("error setting output: %s (%d)", gst_divxdec_error (ret)), ret);
gst_divxdec_unset(divxdec);
return FALSE;
}
......@@ -272,8 +270,8 @@ gst_divxdec_chain (GstPad *pad,
if (!divxdec->handle) {
if (gst_divxdec_negotiate(divxdec) <= 0) {
gst_element_error(GST_ELEMENT(divxdec),
"No format set - aborting");
gst_element_error (divxdec, CORE, TOO_LAZY,
("No format set - aborting"));
gst_buffer_unref(buf);
return;
}
......@@ -296,9 +294,9 @@ gst_divxdec_chain (GstPad *pad,
if ((ret = decore(divxdec->handle, DEC_OPT_FRAME,
&xframe, NULL))) {
gst_element_error(GST_ELEMENT(divxdec),
"Error decoding divx frame: %s (%d)",
gst_divxdec_error(ret), ret);
gst_element_error (divxdec, STREAM, DECODE, NULL,
("Error decoding divx frame: %s (%d)",
gst_divxdec_error(ret), ret));
gst_buffer_unref(buf);
return;
}
......
......@@ -417,7 +417,7 @@ gst_faac_chain (GstPad *pad,
NULL, 0,
GST_BUFFER_DATA (outbuf),
faac->bytes)) < 0) {
gst_element_error (GST_ELEMENT (faac), "Error during AAC encoding");
gst_element_error (faac, LIBRARY, ENCODE, NULL, NULL);
gst_event_unref (event);
gst_buffer_unref (outbuf);
return;
......@@ -445,8 +445,8 @@ gst_faac_chain (GstPad *pad,
inbuf = GST_BUFFER (data);
if (!faac->handle) {
gst_element_error (GST_ELEMENT (faac),
"No input format negotiated");
gst_element_error (faac, CORE, NEGOTIATION, NULL,
("format wasn't negotiated before chain function"));
gst_buffer_unref (inbuf);
return;
}
......@@ -454,8 +454,8 @@ gst_faac_chain (GstPad *pad,
if (!GST_PAD_CAPS (faac->srcpad)) {
if (gst_faac_srcconnect (faac->srcpad,
gst_pad_get_allowed_caps (faac->srcpad)) <= 0) {
gst_element_error (GST_ELEMENT (faac),
"Failed to negotiate MPEG/AAC format with next element");
gst_element_error (faac, CORE, NEGOTIATION, NULL,
("failed to negotiate MPEG/AAC format with next element"));
gst_buffer_unref (inbuf);
return;
}
......@@ -516,7 +516,7 @@ gst_faac_chain (GstPad *pad,
GST_BUFFER_SIZE (subbuf) / faac->bps,
GST_BUFFER_DATA (outbuf),
faac->bytes)) < 0) {
gst_element_error (GST_ELEMENT (faac), "Error during AAC encoding");
gst_element_error (faac, LIBRARY, ENCODE, NULL, NULL);
gst_buffer_unref (inbuf);
gst_buffer_unref (subbuf);
return;
......
......@@ -359,8 +359,7 @@ gst_faad_chain (GstPad *pad,
faad->channels = channels;
if (gst_faad_srcconnect (faad->srcpad,
gst_pad_get_allowed_caps (faad->srcpad)) <= 0) {
gst_element_error (GST_ELEMENT (faad),
"Failed to negotiate output format with next element");
gst_element_error (faad, CORE, NEGOTIATION, NULL, NULL);
gst_buffer_unref (buf);
return;
}
......@@ -369,9 +368,9 @@ gst_faad_chain (GstPad *pad,
out = faacDecDecode (faad->handle, &info,
GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
if (info.error) {
gst_element_error (GST_ELEMENT (faad),
"Failed to decode buffer: %s",
faacDecGetErrorMessage (info.error));
gst_element_error (faad, STREAM, DECODE, NULL,
("Failed to decode buffer: %s",
faacDecGetErrorMessage (info.error)));
gst_buffer_unref (buf);
return;
}
......@@ -382,8 +381,7 @@ gst_faad_chain (GstPad *pad,
faad->channels = info.channels;
if (gst_faad_srcconnect (faad->srcpad,
gst_pad_get_allowed_caps (faad->srcpad)) <= 0) {
gst_element_error (GST_ELEMENT (faad),
"Failed to re-negotiate format with next element");
gst_element_error (faad, CORE, NEGOTIATION, NULL, NULL);
gst_buffer_unref (buf);
return;
}
......
......@@ -561,15 +561,15 @@ gst_ivorbisfile_loop (GstElement *element)
ivorbisfile->offset = 0;
ivorbisfile->total_bytes = 0;
ivorbisfile->may_eos = FALSE;
ivorbisfile->vf.seekable = gst_bytestream_seek (ivorbisfile->bs, 0,
ivorbisfile->vf.seekable = gst_bytestream_seek (ivorbisfile->bs, 0,
GST_SEEK_METHOD_SET);
GST_DEBUG ("ivorbisfile: seekable: %s\n",
ivorbisfile->vf.seekable ? "yes" : "no");
/* open our custom ivorbisfile data object with the callbacks we provide */
if (ov_open_callbacks (ivorbisfile, &ivorbisfile->vf, NULL, 0,
if (ov_open_callbacks (ivorbisfile, &ivorbisfile->vf, NULL, 0,
ivorbisfile_ov_callbacks) < 0) {
gst_element_error (element, "this is not a vorbis file");
gst_element_error (element, STREAM, DECODE, NULL, NULL);
return;
}
ivorbisfile->need_discont = TRUE;
......@@ -633,7 +633,7 @@ gst_ivorbisfile_loop (GstElement *element)
/* we update the caps for each logical stream */
if (ivorbisfile->vf.current_link != ivorbisfile->current_link) {
if (!gst_ivorbisfile_new_link (ivorbisfile, ivorbisfile->vf.current_link)) {
gst_element_error (GST_ELEMENT (ivorbisfile), "could not negotiate format");
gst_element_error (ivorbisfile, CORE, NEGOTIATION, NULL, NULL);
}
return;
}
......
......@@ -316,7 +316,7 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps)
peercaps = peercaps->next;
}
//gst_element_error (GST_ELEMENT (space), "could not agree on caps with peer pads");
gst_element_error (space, CORE, NEGOTIATION, NULL, NULL);
/* we disable ourself here */
space->disabled = TRUE;
......
......@@ -239,8 +239,8 @@ gst_mpeg2enc_loop (GstElement *element)
gst_pad_set_element_private (enc->sinkpad, data);
if (!(caps = GST_PAD_CAPS (enc->sinkpad))) {
gst_element_error (element,
"No format given by previous element");
gst_element_error (element, CORE, NEGOTIATION, NULL,
("format wasn't negotiated before loop function"));
return;
}
......@@ -251,8 +251,7 @@ gst_mpeg2enc_loop (GstElement *element)
/* and set caps on other side */
othercaps = enc->encoder->getFormat ();
if (gst_pad_set_explicit_caps (enc->srcpad, othercaps) <= 0) {
gst_element_error (element,
"Failed to set up encoder properly");
gst_element_error (element, CORE, NEGOTIATION, NULL, NULL);
delete enc->encoder;
enc->encoder = NULL;
return;
......
......@@ -98,8 +98,7 @@ GstMpeg2EncPictureReader::LoadFrame ()
if ((data = (GstData *) gst_pad_get_element_private (pad))) {
gst_pad_set_element_private (pad, NULL);
} else if (!(data = gst_pad_pull (pad))) {
gst_element_error (gst_pad_get_parent (pad),
"Failed to read data");
gst_element_error (gst_pad_get_parent (pad), RESOURCE, READ, NULL, NULL);
return true;
}
......
......@@ -279,8 +279,8 @@ gst_mplex_loop (GstElement *element)
}
if (!mplex->job->video_tracks && !mplex->job->audio_tracks) {
gst_element_error (element,
"No input stream set-up");
gst_element_error (element, CORE, NEGOTIATION, NULL,
("no input video or audio tracks set up before loop function"));
return;
}
......
......@@ -53,9 +53,9 @@ GstMplexIBitStream::GstMplexIBitStream (GstPad *_pad,
gst_bytestream_peek_bytes (bs, &data, 1);
if (!ReadIntoBuffer () && buffered == 0) {
gst_element_error (gst_pad_get_parent (_pad),
"Failed to read from input stream %s",
gst_pad_get_name (pad));
gst_element_error (gst_pad_get_parent (_pad), RESOURCE, READ, NULL,
("Failed to read from input pad %s",
gst_pad_get_name (pad)));
}
}
......
......@@ -366,8 +366,8 @@ gst_sdlvideosink_lock (GstSDLVideoSink *sdlvideosink)
{
/* assure that we've got a screen */
if (!sdlvideosink->screen || !sdlvideosink->overlay) {
gst_element_error (GST_ELEMENT (sdlvideosink),
"Tried to lock screen without being set-up");
gst_element_error (sdlvideosink, LIBRARY, TOO_LAZY, NULL,
("Tried to lock screen without being set-up"));
return FALSE;
}
......@@ -376,15 +376,15 @@ gst_sdlvideosink_lock (GstSDLVideoSink *sdlvideosink)
{
if (SDL_LockSurface(sdlvideosink->screen) < 0)
{
gst_element_error(GST_ELEMENT(sdlvideosink),
"SDL: couldn\'t lock the SDL video window: %s", SDL_GetError());
gst_element_error (sdlvideosink, LIBRARY, TOO_LAZY, NULL,
("SDL: couldn't lock the SDL video window: %s", SDL_GetError()));
return FALSE;
}
}
if (SDL_LockYUVOverlay(sdlvideosink->overlay) < 0)
{
gst_element_error(GST_ELEMENT(sdlvideosink),
"SDL: couldn\'t lock the SDL YUV overlay: %s", SDL_GetError());
gst_element_error (sdlvideosink, LIBRARY, TOO_LAZY, NULL,
("SDL: couldn\'t lock the SDL YUV overlay: %s", SDL_GetError()));
return FALSE;
}
......@@ -427,9 +427,8 @@ gst_sdlvideosink_initsdl (GstSDLVideoSink *sdlvideosink)
/* Initialize the SDL library */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0 ) {
gst_element_error(GST_ELEMENT (sdlvideosink),
"Couldn't initialize SDL: %s",
SDL_GetError());
gst_element_error (sdlvideosink, LIBRARY, INIT, NULL,
("Couldn't initialize SDL: %s", SDL_GetError()));
return FALSE;
}
......@@ -465,9 +464,9 @@ gst_sdlvideosink_create (GstSDLVideoSink *sdlvideosink)
GST_VIDEOSINK_HEIGHT (sdlvideosink), 0, SDL_HWSURFACE | SDL_RESIZABLE);
if (sdlvideosink->screen == NULL)
{
gst_element_error(GST_ELEMENT(sdlvideosink),
"SDL: Couldn't set %dx%d: %s", GST_VIDEOSINK_WIDTH (sdlvideosink),
GST_VIDEOSINK_HEIGHT (sdlvideosink), SDL_GetError());
gst_element_error (sdlvideosink, LIBRARY, TOO_LAZY, NULL,
("SDL: Couldn't set %dx%d: %s", GST_VIDEOSINK_WIDTH (sdlvideosink),
GST_VIDEOSINK_HEIGHT (sdlvideosink), SDL_GetError()));
return FALSE;
}
......@@ -476,10 +475,10 @@ gst_sdlvideosink_create (GstSDLVideoSink *sdlvideosink)
sdlvideosink->height, sdlvideosink->format, sdlvideosink->screen);
if ( sdlvideosink->overlay == NULL )
{
gst_element_error(GST_ELEMENT(sdlvideosink),
"SDL: Couldn't create SDL YUV overlay (%dx%d \'" GST_FOURCC_FORMAT "\'): %s",
gst_element_error (sdlvideosink, LIBRARY, TOO_LAZY, NULL,
("SDL: Couldn't create SDL YUV overlay (%dx%d \'" GST_FOURCC_FORMAT "\'): %s",
sdlvideosink->width, sdlvideosink->height,
GST_FOURCC_ARGS(sdlvideosink->format), SDL_GetError());
GST_FOURCC_ARGS(sdlvideosink->format), SDL_GetError()));
return FALSE;
}
else
......
......@@ -22,6 +22,7 @@
#include "config.h"
#endif
#include "gst-libs/gst/gst-i18n-plugin.h"
#include <string.h>
#include <gst/gst.h>
......@@ -558,7 +559,9 @@ gst_sf_open_file (GstSF *this)
this->time = 0;
if (!this->filename) {
gst_element_error (GST_ELEMENT (this), "sndfile: 'location' was not set");
gst_element_error (this, RESOURCE, NOT_FOUND,
(_("No filename specified")),
NULL);
return FALSE;
}
......@@ -584,8 +587,8 @@ gst_sf_open_file (GstSF *this)
this->filename, info.samplerate, info.channels, info.format);
if (!sf_format_check (&info)) {
gst_element_error (GST_ELEMENT (this),
g_strdup_printf ("Input parameters (rate:%d, channels:%d, format:0x%x) invalid",
gst_element_error (this, STREAM, ENCODE, NULL,
("Input parameters (rate:%d, channels:%d, format:0x%x) invalid",
info.samplerate, info.channels, info.format));
return FALSE;
}
......@@ -594,9 +597,9 @@ gst_sf_open_file (GstSF *this)
this->file = sf_open (this->filename, mode, &info);
if (!this->file) {
gst_element_error (GST_ELEMENT (this),
g_strdup_printf ("could not open file \"%s\": %s",
this->filename, sf_strerror (NULL)));
gst_element_error (this, RESOURCE, OPEN_WRITE,
(_("Could not open file \"%s\" for writing"), this->filename),
("soundfile error: %s", sf_strerror (NULL)));
return FALSE;
}
......@@ -633,9 +636,9 @@ gst_sf_close_file (GstSF *this)
INFO_OBJ (this, "Closing file %s", this->filename);
if ((err = sf_close (this->file)))
gst_element_error (GST_ELEMENT (this),
g_strdup_printf ("sndfile: could not close file \"%s\": %s",
this->filename, sf_error_number (err)));
gst_element_error (this, RESOURCE, CLOSE,
("Could not close file file \"%s\"", this->filename),
("soundfile error: %s", strerror (err)));
else
GST_FLAG_UNSET (this, GST_SF_OPEN);
......@@ -654,7 +657,7 @@ gst_sf_loop (GstElement *element)
this = (GstSF*)element;
if (this->channels == NULL) {
gst_element_error (element, "You must connect at least one pad to sndfile elements.");
gst_element_error (element, CORE, PAD, NULL, ("You must connect at least one pad to sndfile elements."));
return;
}
......@@ -704,9 +707,8 @@ gst_sf_loop (GstElement *element)
"buffer-frames", G_TYPE_INT, this->buffer_frames,
NULL);
if (!gst_pad_try_set_caps (GST_SF_CHANNEL (l)->pad, caps)) {
gst_element_error (GST_ELEMENT (this),
g_strdup_printf ("Opened file with sample rate %d, but could not set caps",
this->rate));
gst_element_error (this, CORE, NEGOTIATION, NULL,
("Opened file with sample rate %d, but could not set caps", this->rate));
gst_sf_close_file (this);
return;
}
......@@ -761,7 +763,8 @@ gst_sf_loop (GstElement *element)
which then would set this->buffer_frames to a new value */
buffer_frames = this->buffer_frames;
if (buffer_frames == 0) {
gst_element_error (element, "Caps were never set, bailing...");
gst_element_error (element, CORE, NEGOTIATION, NULL,
("format wasn't negotiated before chain function"));
return;
}
buf = this->buffer;
......@@ -786,7 +789,9 @@ gst_sf_loop (GstElement *element)
if (num_to_write) {
written = sf_writef_float (this->file, buf, num_to_write);
if (written != num_to_write)
gst_element_error (element, "Error writing file: %s", sf_strerror (this->file));
gst_element_error (element, RESOURCE, WRITE,
(_("Error while writing to file \"%s\""), this->filename),
("soundfile error: %s", sf_strerror (this->file)));
}
this->time += num_to_write * (GST_SECOND / this->rate);
......
......@@ -209,7 +209,7 @@ gst_tarkindec_chain (GstPad *pad, GstData *_data)
tarkindec = GST_TARKINDEC (gst_pad_get_parent (pad));
if (!tarkindec->setup) {
gst_element_error (GST_ELEMENT (tarkindec), "decoder not initialized (input is not audio?)");
gst_element_error (tarkindec, CORE, NEGOTATION, NULL, ("decoder not initialized (input is not tarkin?)"));
if (GST_IS_BUFFER (buf))
gst_buffer_unref (buf);
else
......@@ -278,7 +278,7 @@ gst_tarkindec_chain (GstPad *pad, GstData *_data)
"framerate", GST_PROPS_FLOAT (0.) /* FIXME!!! */
)) <= 0)
{
gst_element_error (GST_ELEMENT (tarkindec), "could not output format");
gst_element_error (tarkindec, CORE, NEGOTATION, NULL, ("could not output format"));
gst_buffer_unref (buf);
return;
}
......
......@@ -319,7 +319,7 @@ gst_tarkinenc_chain (GstPad *pad, GstData *_data)
tarkinenc = GST_TARKINENC (gst_pad_get_parent (pad));
if (!tarkinenc->setup) {
gst_element_error (GST_ELEMENT (tarkinenc), "encoder not initialized (input is not audio?)");
gst_element_error (tarkinenc, CORE, NEGOTIATION, NULL, ("encoder not initialized (input is not tarkin?)"));
if (GST_IS_BUFFER (buf))
gst_buffer_unref (buf);
else
......
......@@ -201,10 +201,10 @@ gst_xviddec_setup (GstXvidDec *xviddec)
if ((ret = xvid_decore(NULL, XVID_DEC_CREATE,
&xdec, NULL)) < 0) {
gst_element_error(GST_ELEMENT(xviddec),
"Setting parameters %dx%d@%d failed: %s (%d)",
gst_element_error (xviddec, LIBRARY, SETTINGS, NULL,
("Setting parameters %dx%d@%d failed: %s (%d)",
xviddec->width, xviddec->height, xviddec->csp,
gst_xvid_error(ret), ret);
gst_xvid_error(ret), ret));
return FALSE;
}
......@@ -228,8 +228,8 @@ gst_xviddec_chain (GstPad *pad,
g_return_if_fail(GST_IS_PAD(pad));
if (!xviddec->handle) {
gst_element_error(GST_ELEMENT(xviddec),
"No format set - aborting");
gst_element_error (xviddec, CORE, NEGOTIATION, NULL,
("format wasn't negotiated before chain function"));
gst_buffer_unref(buf);
return;
}
......@@ -263,9 +263,9 @@ gst_xviddec_chain (GstPad *pad,
if ((ret = xvid_decore(xviddec->handle, XVID_DEC_DECODE,
&xframe, NULL)) < 0) {
gst_element_error(GST_ELEMENT(xviddec),
"Error decoding xvid frame: %s (%d)\n",
gst_xvid_error(ret), ret);
gst_element_error (xviddec, STREAM, DECODE, NULL,
("Error decoding xvid frame: %s (%d)\n",
gst_xvid_error(ret), ret));
gst_buffer_unref(buf);
gst_buffer_unref(outbuf);
return;
......
......@@ -299,9 +299,9 @@ gst_xvidenc_setup (GstXvidEnc *xvidenc)
if ((ret = xvid_encore(NULL, XVID_ENC_CREATE,
&xenc, NULL)) < 0) {
gst_element_error(GST_ELEMENT(xvidenc),
"Error setting up xvid encoder: %s (%d)",
gst_xvid_error(ret), ret);
gst_element_error (xvidenc, LIBRARY, INIT, NULL,
("Error setting up xvid encoder: %s (%d)",
gst_xvid_error(ret), ret));
return FALSE;
}
......@@ -355,9 +355,9 @@ gst_xvidenc_chain (GstPad *pad,
if ((ret = xvid_encore(xvidenc->handle, XVID_ENC_ENCODE,
&xframe, &xstats)) < 0) {
gst_element_error(GST_ELEMENT(xvidenc),
"Error encoding xvid f