diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-01-18 21:46:58 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-01-18 21:46:58 +0000 |
commit | 07ed811a0983771c45faa2f6f76a9fff186db407 (patch) | |
tree | 1c0250da756e8b2dce0b660515d72ab1352a11d3 | |
parent | b1e81d454192223e58f3225aa44785e940a90fd7 (diff) | |
download | gst-plugins-bad-07ed811a0983771c45faa2f6f76a9fff186db407.tar.gz gst-plugins-bad-07ed811a0983771c45faa2f6f76a9fff186db407.tar.bz2 gst-plugins-bad-07ed811a0983771c45faa2f6f76a9fff186db407.zip |
use new error signal and classification
Original commit message from CVS:
use new error signal and classification
31 files changed, 345 insertions, 220 deletions
@@ -1,3 +1,144 @@ +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: diff --git a/examples/gstplay/player.c b/examples/gstplay/player.c index 5d4f2466..094cab56 100644 --- a/examples/gstplay/player.c +++ b/examples/gstplay/player.c @@ -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"); 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 <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); 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 <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); } } diff --git a/ext/divx/gstdivxdec.c b/ext/divx/gstdivxdec.c index 44134ecd..06b3dc33 100644 --- a/ext/divx/gstdivxdec.c +++ b/ext/divx/gstdivxdec.c @@ -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; } diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c index 182d094e..f84acb6f 100644 --- a/ext/faac/gstfaac.c +++ b/ext/faac/gstfaac.c @@ -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; diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c index 8db89aaf..67bcdddb 100644 --- a/ext/faad/gstfaad.c +++ b/ext/faad/gstfaad.c @@ -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; } diff --git a/ext/ivorbis/vorbisfile.c b/ext/ivorbis/vorbisfile.c index 548405a4..4f708aa0 100644 --- a/ext/ivorbis/vorbisfile.c +++ b/ext/ivorbis/vorbisfile.c @@ -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; } diff --git a/ext/lcs/gstcolorspace.c b/ext/lcs/gstcolorspace.c index bc153ac3..20edef6f 100644 --- a/ext/lcs/gstcolorspace.c +++ b/ext/lcs/gstcolorspace.c @@ -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; diff --git a/ext/mpeg2enc/gstmpeg2enc.cc b/ext/mpeg2enc/gstmpeg2enc.cc index e3af35bb..039fa227 100644 --- a/ext/mpeg2enc/gstmpeg2enc.cc +++ b/ext/mpeg2enc/gstmpeg2enc.cc @@ -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; diff --git a/ext/mpeg2enc/gstmpeg2encpicturereader.cc b/ext/mpeg2enc/gstmpeg2encpicturereader.cc index 57e4110b..10c1f4bc 100644 --- a/ext/mpeg2enc/gstmpeg2encpicturereader.cc +++ b/ext/mpeg2enc/gstmpeg2encpicturereader.cc @@ -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; } diff --git a/ext/mplex/gstmplex.cc b/ext/mplex/gstmplex.cc index 66638b84..0eb87779 100644 --- a/ext/mplex/gstmplex.cc +++ b/ext/mplex/gstmplex.cc @@ -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; } diff --git a/ext/mplex/gstmplexibitstream.cc b/ext/mplex/gstmplexibitstream.cc index 59f913a6..21e1892e 100644 --- a/ext/mplex/gstmplexibitstream.cc +++ b/ext/mplex/gstmplexibitstream.cc @@ -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))); } } diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c index a5fa4704..040d9ed1 100644 --- a/ext/sdl/sdlvideosink.c +++ b/ext/sdl/sdlvideosink.c @@ -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 diff --git a/ext/sndfile/gstsf.c b/ext/sndfile/gstsf.c index 6b185b8b..f276cfd2 100644 --- a/ext/sndfile/gstsf.c +++ b/ext/sndfile/gstsf.c @@ -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); diff --git a/ext/tarkin/gsttarkindec.c b/ext/tarkin/gsttarkindec.c index a87bb9a3..a2c27e9f 100644 --- a/ext/tarkin/gsttarkindec.c +++ b/ext/tarkin/gsttarkindec.c @@ -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; } diff --git a/ext/tarkin/gsttarkinenc.c b/ext/tarkin/gsttarkinenc.c index 5c918a4e..b58e1ab6 100644 --- a/ext/tarkin/gsttarkinenc.c +++ b/ext/tarkin/gsttarkinenc.c @@ -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 diff --git a/ext/xvid/gstxviddec.c b/ext/xvid/gstxviddec.c index e57489a6..68b21d7d 100644 --- a/ext/xvid/gstxviddec.c +++ b/ext/xvid/gstxviddec.c @@ -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; diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c index 9945f125..1b9de2f5 100644 --- a/ext/xvid/gstxvidenc.c +++ b/ext/xvid/gstxvidenc.c @@ -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 frame: %s (%d)", - gst_xvid_error(ret), ret); + gst_element_error (xvidenc, LIBRARY, ENCODE, NULL, + ("Error encoding xvid frame: %s (%d)", + gst_xvid_error(ret), ret)); gst_buffer_unref(buf); gst_buffer_unref(outbuf); return; diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am index 05560a24..bfec499e 100644 --- a/gst-libs/gst/Makefile.am +++ b/gst-libs/gst/Makefile.am @@ -65,3 +65,4 @@ libgstinterfaces_@GST_MAJORMINOR@_la_LIBADD = \ libgstinterfaces_@GST_MAJORMINOR@_la_LDFLAGS = @GST_PLUGINS_LT_LDFLAGS@ -version-info @GST_PLUGINS_LIBVERSION@ +noinst_HEADERS = gst-i18n-plugin.h diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c index ca09a526..85714000 100644 --- a/gst-libs/gst/riff/riff-read.c +++ b/gst-libs/gst/riff/riff-read.c @@ -199,7 +199,7 @@ gst_riff_peek_head (GstRiffRead *riff, gst_pad_event_default (riff->sinkpad, event); } else { gst_event_unref (event); - gst_element_error (GST_ELEMENT (riff), "Read error"); + gst_element_error (riff, RESOURCE, READ, NULL, NULL); } return FALSE; } @@ -228,7 +228,7 @@ gst_riff_read_element_data (GstRiffRead *riff, GstBuffer *buf = NULL; if (gst_bytestream_peek (riff->bs, &buf, length) != length) { - gst_element_error (GST_ELEMENT (riff), "Read error"); + gst_element_error (riff, RESOURCE, READ, NULL, NULL); if (buf) gst_buffer_unref (buf); return NULL; @@ -271,7 +271,7 @@ gst_riff_read_seek (GstRiffRead *riff, /* now seek */ if (!gst_bytestream_seek (riff->bs, offset, GST_SEEK_METHOD_SET)) { - gst_element_error (GST_ELEMENT (riff), "Seek failed"); + gst_element_error (riff, RESOURCE, SEEK, NULL, NULL); return NULL; } @@ -283,8 +283,8 @@ gst_riff_read_seek (GstRiffRead *riff, /* get the discont event and return */ gst_bytestream_get_status (riff->bs, &remaining, &event); if (!event || GST_EVENT_TYPE (event) != GST_EVENT_DISCONTINUOUS) { - gst_element_error (GST_ELEMENT (riff), - "No discontinuity event after seek"); + gst_element_error (riff, CORE, EVENT, NULL, + ("No discontinuity event after seek")); if (event) gst_event_unref (event); return NULL; @@ -327,7 +327,7 @@ gst_riff_peek_list (GstRiffRead *riff) } if (gst_bytestream_peek_bytes (riff->bs, &data, 12) != 12) { - gst_element_error (GST_ELEMENT (riff), "Read error"); + gst_element_error (riff, RESOURCE, READ, NULL, NULL); return 0; } @@ -687,7 +687,7 @@ gst_riff_read_list (GstRiffRead *riff, } gst_bytestream_flush_fast (riff->bs, 8); if (gst_bytestream_peek_bytes (riff->bs, &data, 4) != 4) { - gst_element_error (GST_ELEMENT (riff), "Read error"); + gst_element_error (riff, RESOURCE, READ, NULL, NULL); return FALSE; } gst_bytestream_flush_fast (riff->bs, 4); @@ -845,15 +845,14 @@ gst_riff_read_header (GstRiffRead *riff, if (!gst_riff_peek_head (riff, &tag, &length, NULL)) return FALSE; if (tag != GST_RIFF_TAG_RIFF) { - gst_element_error (GST_ELEMENT (riff), - "Not a RIFF file"); + gst_element_error (riff, STREAM, WRONG_TYPE, NULL, NULL); return FALSE; } gst_bytestream_flush_fast (riff->bs, 8); /* doctype */ if (gst_bytestream_peek_bytes (riff->bs, &data, 4) != 4) { - gst_element_error (GST_ELEMENT (riff), "Read error"); + gst_element_error (riff, RESOURCE, READ, NULL, NULL); return FALSE; } gst_bytestream_flush_fast (riff->bs, 4); diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c index a8269ef6..c861a1f4 100644 --- a/gst/flx/gstflxdec.c +++ b/gst/flx/gstflxdec.c @@ -463,7 +463,7 @@ gst_flxdec_loop (GstElement *element) if (flxh->type != FLX_MAGICHDR_FLI && flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) { - gst_element_error (element, "not a flx file (type %d)\n", flxh->type); + gst_element_error (element, STREAM, WRONG_TYPE, NULL, ("not a flx file (type %d)\n", flxh->type)); return; } diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc index 2659d877..02699085 100644 --- a/gst/modplug/gstmodplug.cc +++ b/gst/modplug/gstmodplug.cc @@ -575,7 +575,7 @@ gst_modplug_loop (GstElement *element) if (!GST_PAD_CAPS (modplug->srcpad) && modplug_negotiate (modplug) <= 0) { - gst_element_error (GST_ELEMENT (modplug), "could not negotiate format"); + gst_element_error (modplug, CORE, NEGOTIATION, ("test"), ("test")); return; } diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c index ea17dc8c..5cfbcc0b 100644 --- a/gst/smpte/gstsmpte.c +++ b/gst/smpte/gstsmpte.c @@ -371,7 +371,7 @@ gst_smpte_loop (GstElement *element) "framerate", G_TYPE_DOUBLE, smpte->fps, NULL); if (!gst_pad_try_set_caps (smpte->srcpad, caps)) { - gst_element_error (element, "cannot set caps"); + gst_element_error (smpte, CORE, NEGOTIATION, NULL, NULL); return; } } diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c index ec094156..6a058d48 100644 --- a/gst/speed/gstspeed.c +++ b/gst/speed/gstspeed.c @@ -245,7 +245,8 @@ speed_loop (GstElement *element) #include "filter.func" #undef _FORMAT } else { - gst_element_error (element, "capsnego was never performed, bailing..."); + gst_element_error (filter, CORE, NEGOTIATION, NULL, + ("format wasn't negotiated before chain function")); gst_element_yield (element); } } diff --git a/sys/dxr3/dxr3audiosink.c b/sys/dxr3/dxr3audiosink.c index 58709e80..847c34b7 100644 --- a/sys/dxr3/dxr3audiosink.c +++ b/sys/dxr3/dxr3audiosink.c @@ -309,10 +309,9 @@ dxr3audiosink_open (Dxr3AudioSink *sink) sink->audio_fd = open (sink->audio_filename, O_WRONLY); if (sink->audio_fd < 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error opening device file \"", - sink->audio_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, OPEN_WRITE, + (_("Could not open audio device \"%s\" for writing"), sink->audio_filename), + GST_ERROR_SYSTEM); return FALSE; } @@ -322,10 +321,9 @@ dxr3audiosink_open (Dxr3AudioSink *sink) sink->control_fd = open (sink->control_filename, O_WRONLY); if (sink->control_fd < 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error opening device file \"", - sink->control_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, OPEN_WRITE, + (_("Could not open control device \"%s\" for writing"), sink->control_filename), + GST_ERROR_SYSTEM); return FALSE; } @@ -357,10 +355,9 @@ dxr3audiosink_set_mode_pcm (Dxr3AudioSink *sink) tmp = oss_mode; if (ioctl (sink->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != oss_mode) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error configuring device mode for \"", - sink->audio_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, SETTINGS, + (_("Could not configure audio device \"%s\""), sink->audio_filename), + GST_ERROR_SYSTEM); return FALSE; } @@ -372,11 +369,9 @@ dxr3audiosink_set_mode_pcm (Dxr3AudioSink *sink) /* Set the sampling rate. */ tmp = sink->rate; if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error configuring device " - "sampling rate for \"", - sink->audio_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, SETTINGS, + (_("Could not set audio device \"%s\" to %d Hz"), sink->audio_filename, sink->rate), + GST_ERROR_SYSTEM); return FALSE; } @@ -411,11 +406,9 @@ dxr3audiosink_set_mode_ac3 (Dxr3AudioSink *sink) tmp = AC3_BYTE_RATE; if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0 || tmp != AC3_BYTE_RATE) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error configuring device " - "sampling rate for \"", - sink->audio_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, SETTINGS, + (_("Could not set audio device \"%s\" to %d Hz"), sink->audio_filename, AC3_BYTE_RATE), + GST_ERROR_SYSTEM); return FALSE; } @@ -441,18 +434,16 @@ dxr3audiosink_close (Dxr3AudioSink *sink) g_return_if_fail (GST_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN)); if (close (sink->audio_fd) != 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error closing file \"", - sink->audio_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, CLOSE, + (_("Could not close audio device \"%s\""), sink->audio_filename), + GST_ERROR_SYSTEM); return; } if (close (sink->control_fd) != 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error closing file \"", - sink->control_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, CLOSE, + (_("Could not close control device \"%s\""), sink->audio_filename), + GST_ERROR_SYSTEM); return; } diff --git a/sys/dxr3/dxr3spusink.c b/sys/dxr3/dxr3spusink.c index 0b1ba010..6ce1bf6b 100644 --- a/sys/dxr3/dxr3spusink.c +++ b/sys/dxr3/dxr3spusink.c @@ -280,10 +280,8 @@ dxr3spusink_open (Dxr3SpuSink *sink) sink->spu_fd = open (sink->spu_filename, O_WRONLY); if (sink->spu_fd < 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error opening device file \"", - sink->spu_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, OPEN_WRITE, + (_("Could not open spu device \"%s\" for writing"), sink->spu_filename), GST_ERROR_SYSTEM); return FALSE; } @@ -293,10 +291,8 @@ dxr3spusink_open (Dxr3SpuSink *sink) sink->control_fd = open (sink->control_filename, O_WRONLY); if (sink->control_fd < 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error opening device file \"", - sink->control_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, OPEN_WRITE, + (_("Could not open control device \"%s\" for writing"), sink->control_filename), GST_ERROR_SYSTEM); return FALSE; } @@ -312,19 +308,17 @@ dxr3spusink_close (Dxr3SpuSink *sink) g_return_if_fail (GST_FLAG_IS_SET (sink, DXR3SPUSINK_OPEN)); if (close (sink->spu_fd) != 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error closing file \"", - sink->spu_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, CLOSE, + (_("Could not close spu device \"%s\""), sink->spu_filename), + GST_ERROR_SYSTEM); return; } if (close (sink->control_fd) != 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error closing file \"", - sink->control_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, CLOSE, + (_("Could not close control device \"%s\""), sink->audio_filename), + GST_ERROR_SYSTEM); return; } diff --git a/sys/dxr3/dxr3videosink.c b/sys/dxr3/dxr3videosink.c index 9c4605e5..75a2d1c3 100644 --- a/sys/dxr3/dxr3videosink.c +++ b/sys/dxr3/dxr3videosink.c @@ -276,10 +276,9 @@ dxr3videosink_open (Dxr3VideoSink *sink) sink->video_fd = open (sink->video_filename, O_WRONLY); if (sink->video_fd < 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error opening device file \"", - sink->video_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, OPEN_WRITE, + (_("Could not open video device \"%s\" for writing"), sink->video_filename), + GST_ERROR_SYSTEM); return FALSE; } @@ -289,10 +288,9 @@ dxr3videosink_open (Dxr3VideoSink *sink) sink->control_fd = open (sink->control_filename, O_WRONLY); if (sink->control_fd < 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error opening device file \"", - sink->control_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, OPEN_WRITE, + (_("Could not open control device \"%s\" for writing"), sink->control_filename), + GST_ERROR_SYSTEM); return FALSE; } @@ -309,19 +307,17 @@ dxr3videosink_close (Dxr3VideoSink *sink) if (close (sink->video_fd) != 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error closing file \"", - sink->video_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, CLOSE, + (_("Could not close video device \"%s\""), sink->video_filename), + GST_ERROR_SYSTEM); return; } if (close (sink->control_fd) != 0) { - gst_element_error (GST_ELEMENT (sink), - g_strconcat ("Error closing file \"", - sink->control_filename, "\": ", - g_strerror (errno), NULL)); + gst_element_error (sink, RESOURCE, CLOSE, + (_("Could not close control device \"%s\""), sink->audio_filename), + GST_ERROR_SYSTEM); return; } @@ -467,8 +463,9 @@ dxr3videosink_write_data (Dxr3VideoSink *sink, guint cut) while (size > 0) { written = write (sink->video_fd, data, size); if (written < 0) { - gst_element_error (GST_ELEMENT (sink), "Writing to %s: %s", - sink->video_filename, strerror (errno)); + gst_element_error (sink, RESOURCE, WRITE, + (_("Could not write to device %s"), sink->video_filename), + GST_ERROR_SYSTEM); break; } size = size - written; diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index edce2091..d0b480f9 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -817,7 +817,7 @@ gst_v4l2src_get (GstPad *pad) if (v4l2src->use_fixed_fps && (fps = gst_v4l2src_get_fps(v4l2src)) == 0) { - gst_element_error (GST_ELEMENT (v4l2src), "Could not get frame rate for element."); + gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL, ("could not get frame rate for element")); return NULL; } diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 3a55a231..ec7028c2 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -72,9 +72,9 @@ gst_v4l2src_fill_format_list (GstV4l2Src *v4l2src) if (errno == EINVAL) { break; /* end of enumeration */ } else { - gst_element_error(GST_ELEMENT(v4l2src), - "Failed to get no. %d in pixelformat enumeration for %s: %s", - n, GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL, + ("failed to get number %d in pixelformat enumeration for %s: %s", + n, GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno))); g_free (format); return FALSE; } @@ -117,8 +117,9 @@ gst_v4l2src_queue_frame (GstV4l2Src *v4l2src, GST_LOG_OBJECT (v4l2src, "queueing frame %u", i); if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_QBUF, &v4l2src->pool->buffers[i].buffer) < 0) { - gst_element_error(GST_ELEMENT(v4l2src), "Error queueing buffer %u on device %s: %s", - i, GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, WRITE, + (_("Could not write to device \"%s\""), GST_V4L2ELEMENT(v4l2src)->device), + ("Error queueing buffer %u on device %s", i, g_strerror(errno))); return FALSE; } @@ -141,8 +142,8 @@ gst_v4l2src_grab_frame (GstV4l2Src *v4l2src) while (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_DQBUF, &buffer) < 0) { /* if the sync() got interrupted, we can retry */ if (errno != EINTR) { - gst_element_error(GST_ELEMENT(v4l2src), "Error syncing on a buffer on device %s: %s", - GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, SYNC, NULL, ("could not sync on a buffer on device %s: %s", + GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno))); return -1; } GST_DEBUG_OBJECT (v4l2src, "grab got interrupted"); @@ -169,9 +170,9 @@ gst_v4l2src_get_capture (GstV4l2Src *v4l2src) v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_G_FMT, &v4l2src->format) < 0) { - gst_element_error(GST_ELEMENT(v4l2src), - "Failed to get pixel format for device %s: %s", - GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL, + ("failed to get pixelformat for device %s: %s", + n, GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno))); return FALSE; } @@ -205,10 +206,9 @@ gst_v4l2src_set_capture (GstV4l2Src *v4l2src, v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_S_FMT, &v4l2src->format) < 0) { - gst_element_error(GST_ELEMENT(v4l2src), - "Failed to set pixel format to %s @ %dx%d for device %s: %s", - fmt->description, width, height, - GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL, + ("failed to set pixelformat to %s @ %dx%d for device %s: %s", + fmt->description, width, height, GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno))); return FALSE; } @@ -245,14 +245,16 @@ gst_v4l2src_capture_init (GstV4l2Src *v4l2src) v4l2src->breq.type = v4l2src->format.type; v4l2src->breq.memory = V4L2_MEMORY_MMAP; if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_REQBUFS, &v4l2src->breq) < 0) { - gst_element_error(GST_ELEMENT(v4l2src), "Error requesting buffers (%d) for %s: %s", - v4l2src->breq.count, GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, READ, + (_("Could not get buffers from device \"%s\""), GST_V4L2ELEMENT(v4l2src)->device), + ("error requesting %d buffers: %s", v4l2src->breq.count, g_strerror (errno))); return FALSE; } if (v4l2src->breq.count < GST_V4L2_MIN_BUFFERS) { - gst_element_error(GST_ELEMENT(v4l2src), "Too little buffers. We got %d, we want at least %d", - v4l2src->breq.count, GST_V4L2_MIN_BUFFERS); + gst_element_error (v4l2src, RESOURCE, READ, + (_("Could not get enough buffers from device \"%s\""), GST_V4L2ELEMENT(v4l2src)->device), + ("we received %d, we want at least %d", v4l2src->breq.count, GST_V4L2_MIN_BUFFERS)); v4l2src->breq.count = buffers; return FALSE; } @@ -278,16 +280,16 @@ gst_v4l2src_capture_init (GstV4l2Src *v4l2src) buffer->buffer.index = n; buffer->buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_QUERYBUF, &buffer->buffer) < 0) { - gst_element_error(GST_ELEMENT(v4l2src), "Failed to get buffer (%d) properties: %s", - n, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, READ, NULL, + ("Could not get buffer properties of buffer %d: %s", n, g_strerror (errno))); gst_v4l2src_capture_deinit(v4l2src); return FALSE; } buffer->start = mmap (0, buffer->buffer.length, PROT_READ|PROT_WRITE, MAP_SHARED, GST_V4L2ELEMENT(v4l2src)->video_fd, buffer->buffer.m.offset); if (buffer->start == MAP_FAILED) { - gst_element_error(GST_ELEMENT(v4l2src), "Error mapping video buffer (%d) on device %s: %s", - n, GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, READ, NULL, + ("Could not mmap video buffer %d: %s", n, g_strerror (errno))); buffer->start = 0; gst_v4l2src_capture_deinit (v4l2src); return FALSE; @@ -326,8 +328,9 @@ gst_v4l2src_capture_start (GstV4l2Src *v4l2src) v4l2src->quit = FALSE; if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_STREAMON, &type) < 0) { - gst_element_error(GST_ELEMENT(v4l2src), "Error starting streaming capture for %s: %s", - GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, OPEN_READ, NULL, + ("Error starting streaming capture from device %s: %s", + GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno))); return FALSE; } @@ -353,8 +356,9 @@ gst_v4l2src_capture_stop (GstV4l2Src *v4l2src) /* we actually need to sync on all queued buffers but not * on the non-queued ones */ if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_STREAMOFF, &type) < 0) { - gst_element_error (GST_ELEMENT(v4l2src), "Error stopping streaming capture for %s: %s", - GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)); + gst_element_error (v4l2src, RESOURCE, CLOSE, NULL, + ("Error stopping streaming capture from device %s: %s", + GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno))); return FALSE; } diff --git a/sys/vcd/vcdsrc.c b/sys/vcd/vcdsrc.c index 04db4410..3a3d13a8 100644 --- a/sys/vcd/vcdsrc.c +++ b/sys/vcd/vcdsrc.c @@ -303,8 +303,7 @@ vcdsrc_open_file(VCDSrc *src) /* open the device */ src->fd = open(src->device,O_RDONLY); if (src->fd < 0) { - perror("open()"); - gst_element_error(GST_ELEMENT(src),"opening file"); + gst_element_error (src, RESOURCE, OPEN_READ, NULL, GST_ERROR_SYSTEM); return FALSE; } |