From 4efc300279bbda8f0d3dc06ca4a78a7d98238b7c Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 18 Jan 2004 21:36:20 +0000 Subject: [PATCH] changing error signal add error codes and domains Original commit message from CVS: changing error signal add error codes and domains --- ChangeLog | 42 +++++++ gst/Makefile.am | 2 + gst/autoplug/gstspideridentity.c | 2 +- gst/elements/gstfakesink.c | 3 +- gst/elements/gstfilesink.c | 42 ++++--- gst/elements/gstfilesrc.c | 59 ++++++++-- gst/elements/gstidentity.c | 5 +- gst/elements/gstmultidisksrc.c | 14 ++- gst/elements/gstmultifilesrc.c | 14 ++- gst/elements/gstpipefilter.c | 22 ++-- gst/elements/gsttypefind.c | 4 +- gst/elements/gsttypefindelement.c | 4 +- gst/gst.h | 1 + gst/gst_private.h | 1 + gst/gstelement.c | 135 +++++++++++++-------- gst/gstelement.h | 13 ++- gst/gsterror.c | 214 ++++++++++++++++++++++++++++++++++ gst/gsterror.h | 128 ++++++++++++++++++++ gst/gstinfo.c | 5 + gst/gstmarshal.list | 1 + gst/gstpad.c | 37 +++--- gst/gstqueue.c | 11 +- gst/schedulers/gstbasicscheduler.c | 17 ++- plugins/elements/gstfakesink.c | 3 +- plugins/elements/gstfilesink.c | 42 ++++--- plugins/elements/gstfilesrc.c | 59 ++++++++-- plugins/elements/gstidentity.c | 5 +- plugins/elements/gstmultidisksrc.c | 14 ++- plugins/elements/gstmultifilesrc.c | 14 ++- plugins/elements/gstpipefilter.c | 22 ++-- plugins/elements/gstqueue.c | 11 +- plugins/elements/gsttypefind.c | 4 +- plugins/elements/gsttypefindelement.c | 4 +- po/POTFILES.in | 7 ++ po/fr.po | 138 ++++++++++++++++------ po/nl.po | 148 +++++++++++++++++------ 36 files changed, 985 insertions(+), 262 deletions(-) create mode 100644 gst/gsterror.c create mode 100644 gst/gsterror.h diff --git a/ChangeLog b/ChangeLog index bdf1263..c537dc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +2004-01-18 Thomas Vander Stichele + + * gst/Makefile.am: + * gst/autoplug/gstspideridentity.c: + (gst_spider_identity_sink_loop_type_finding): + * gst/elements/gstfakesink.c: (gst_fakesink_change_state): + * gst/elements/gstfilesink.c: (gst_filesink_open_file), + (gst_filesink_close_file), (gst_filesink_handle_event), + (gst_filesink_chain): + * gst/elements/gstfilesrc.c: (gst_filesrc_set_property), + (gst_filesrc_map_region), (gst_filesrc_get_read), + (gst_filesrc_open_file): + * gst/elements/gstidentity.c: (gst_identity_chain): + * gst/elements/gstmultidisksrc.c: (gst_multidisksrc_open_file): + * gst/elements/gstpipefilter.c: (gst_pipefilter_get), + (gst_pipefilter_chain), (gst_pipefilter_open_file): + * gst/elements/gsttypefindelement.c: (gst_type_find_element_chain): + * gst/gst.h: + * gst/gst_private.h: + * gst/gstelement.c: (gst_element_class_init), + (gst_element_default_error), (gst_element_error_func), + (gst_element_error_extended): + * gst/gstelement.h: + * gst/gsterror.c: (_gst_core_errors_init), + (_gst_library_errors_init), (_gst_resource_errors_init), + (_gst_stream_errors_init), (gst_error_get_message): + * gst/gsterror.h: + * gst/gstinfo.c: (_gst_debug_init): + * gst/gstmarshal.list: + * gst/gstpad.c: (gst_pad_set_explicit_caps), + (gst_pad_recover_caps_error), (gst_pad_pull): + * gst/gstqueue.c: (gst_queue_chain), (gst_queue_get): + * gst/schedulers/gstbasicscheduler.c: + (gst_basic_scheduler_chainhandler_proxy), + (gst_basic_scheduler_gethandler_proxy), + (gst_basic_scheduler_cothreaded_chain): + * po/POTFILES.in: + * po/fr.po: + * po/nl.po: + change error signal + add error categories + 2004-01-18 Jeremy Simon * gst/gsttag.c: (_gst_tag_initialize): diff --git a/gst/Makefile.am b/gst/Makefile.am index 096c944..3fab2eb 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -86,6 +86,7 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \ gstdata.c \ gstelement.c \ gstelementfactory.c \ + gsterror.c \ gstevent.c \ gstfilter.c \ gstformat.c \ @@ -147,6 +148,7 @@ gst_headers = \ gstcpu.h \ gstdata.h \ gstelement.h \ + gsterror.h \ gstevent.h \ gstfilter.h \ gstformat.h \ diff --git a/gst/autoplug/gstspideridentity.c b/gst/autoplug/gstspideridentity.c index 71e5ee3..ea23791 100644 --- a/gst/autoplug/gstspideridentity.c +++ b/gst/autoplug/gstspideridentity.c @@ -501,7 +501,7 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident) } if (find.best_probability > 0) goto plug; - gst_element_error(GST_ELEMENT(ident), "Could not find media type", NULL); + gst_element_error (ident, STREAM, TYPE_NOT_FOUND, NULL, NULL); find.buffer = GST_BUFFER (gst_event_new (GST_EVENT_EOS)); end: diff --git a/gst/elements/gstfakesink.c b/gst/elements/gstfakesink.c index 61621d9..ece69de 100644 --- a/gst/elements/gstfakesink.c +++ b/gst/elements/gstfakesink.c @@ -391,7 +391,8 @@ gst_fakesink_change_state (GstElement *element) return GST_STATE_SUCCESS; error: - gst_element_error (element, "failed state change as requested"); + gst_element_error (element, CORE, STATE_CHANGE, + NULL, NULL); return GST_STATE_FAILURE; } diff --git a/gst/elements/gstfilesink.c b/gst/elements/gstfilesink.c index 97a04f3..d726073 100644 --- a/gst/elements/gstfilesink.c +++ b/gst/elements/gstfilesink.c @@ -25,6 +25,8 @@ # include "config.h" #endif +#include "../gst-i18n-lib.h" + #include #include #include "gstfilesink.h" @@ -33,6 +35,7 @@ #include #include + GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug); #define GST_CAT_DEFAULT gst_filesink_debug @@ -230,18 +233,18 @@ gst_filesink_open_file (GstFileSink *sink) /* open the file */ if (!sink->filename) { - gst_element_error (GST_ELEMENT (sink), - "Error opening file: no file given"); + gst_element_error (sink, RESOURCE, NOT_FOUND, + (_("No filename specified")), NULL); return FALSE; } sink->file = fopen (sink->filename, "w"); if (sink->file == NULL) { - gst_element_error (GST_ELEMENT (sink), - "Error opening file %s: %s", - sink->filename, g_strerror(errno)); + gst_element_error (sink, RESOURCE, OPEN_WRITE, + (_("Could not open file \"%s\" for writing"), sink->filename), + ("system error: %s", strerror (errno))); return FALSE; - } + } GST_FLAG_SET (sink, GST_FILESINK_OPEN); @@ -257,9 +260,9 @@ gst_filesink_close_file (GstFileSink *sink) if (fclose (sink->file) != 0) { - gst_element_error (GST_ELEMENT (sink), - "Error closing file %s: %s", - sink->filename, g_strerror(errno)); + gst_element_error (sink, RESOURCE, CLOSE, + (_("Error closing file \"%s\""), sink->filename), + GST_ERROR_SYSTEM); } else { GST_FLAG_UNSET (sink, GST_FILESINK_OPEN); @@ -324,9 +327,9 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event) if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) if (fflush (filesink->file)) - gst_element_error (GST_ELEMENT (filesink), - "Error flushing file %s: %s", - filesink->filename, g_strerror(errno)); + gst_element_error (filesink, RESOURCE, WRITE, + (_("Error while writing to file \"%s\""), filesink->filename), + GST_ERROR_SYSTEM); switch (GST_EVENT_SEEK_METHOD(event)) { @@ -356,9 +359,9 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event) } case GST_EVENT_FLUSH: if (fflush (filesink->file)) { - gst_element_error (GST_ELEMENT (filesink), - "Error flushing file %s: %s", - filesink->filename, g_strerror(errno)); + gst_element_error (filesink, RESOURCE, WRITE, + (_("Error while writing to file \"%s\""), filesink->filename), + GST_ERROR_SYSTEM); } break; case GST_EVENT_EOS: @@ -408,10 +411,11 @@ gst_filesink_chain (GstPad *pad, GstData *_data) GST_BUFFER_SIZE (buf) - bytes_written, filesink->file); if (wrote <= 0) { - gst_element_error (GST_ELEMENT (filesink), - "Only %d of %d bytes written: %s", - bytes_written, GST_BUFFER_SIZE (buf), - strerror (errno)); + gst_element_error (filesink, RESOURCE, WRITE, + (_("Error while writing to file \"%s\""), filesink->filename), + ("Only %d of %d bytes written: %s", + bytes_written, GST_BUFFER_SIZE (buf), + strerror (errno))); break; } bytes_written += wrote; diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index 452acf9..6e14f42 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -35,6 +35,8 @@ #include #include +#include "../gst-i18n-lib.h" + /********************************************************************** * GStreamer Default File Source @@ -297,7 +299,7 @@ gst_filesrc_set_property (GObject *object, guint prop_id, const GValue *value, G src->mapsize = g_value_get_ulong (value); g_object_notify (G_OBJECT (src), "mmapsize"); } else { - GST_INFO_OBJECT (src, "invalid mapsize, must a multiple of pagesize, which is %d", + GST_INFO_OBJECT (src, "invalid mapsize, must be a multiple of pagesize, which is %d", src->pagesize); } break; @@ -391,7 +393,9 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size) mmapregion = mmap (NULL, size, PROT_READ, MAP_SHARED, src->fd, offset); if (mmapregion == NULL) { - gst_element_error (GST_ELEMENT (src), "couldn't map file"); + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, + ("mmap call failed")); return NULL; } else if (mmapregion == MAP_FAILED) { @@ -636,12 +640,15 @@ gst_filesrc_get_read (GstFileSrc *src) ret = read (src->fd, GST_BUFFER_DATA (buf), readsize); if (ret < 0){ - gst_element_error (GST_ELEMENT (src), "reading file (%s)", - strerror (errno), NULL); + gst_element_error (src, RESOURCE, READ, + NULL, + ("system error: %s", strerror (errno))); return NULL; } if (ret < readsize) { - gst_element_error (GST_ELEMENT (src), "unexpected end of file", NULL); + gst_element_error (src, RESOURCE, READ, + NULL, + ("unexpected end of file")); return NULL; } @@ -711,18 +718,47 @@ gst_filesrc_check_filesize (GstFileSrc *src) return TRUE; } /* open the file and mmap it, necessary to go to READY state */ -static gboolean +static gboolean gst_filesrc_open_file (GstFileSrc *src) { g_return_val_if_fail (!GST_FLAG_IS_SET (src ,GST_FILESRC_OPEN), FALSE); + if (src->filename == NULL) + { + gst_element_error (src, RESOURCE, NOT_FOUND, + (_("No filename specified")), + NULL); + return FALSE; + } + + if (src->filename == NULL) + { + gst_element_error (src, RESOURCE, NOT_FOUND, + (_("No file specified for reading")), + NULL); + return FALSE; + } + + GST_INFO_OBJECT (src, "opening file %s",src->filename); /* open the file */ src->fd = open (src->filename, O_RDONLY); - if (src->fd < 0) { - gst_element_error (GST_ELEMENT (src), "opening file \"%s\" (%s)", - src->filename, strerror (errno), NULL); + if (src->fd < 0) + { + if (errno == ENOENT) + gst_element_error (src, RESOURCE, NOT_FOUND, + NULL, + NULL); +/* thomas + gst_element_error (src, RESOURCE, NOT_FOUND, + (_("File \"%s\" does not exist"), src->filename), + NULL); +*/ + else + gst_element_error (src, RESOURCE, OPEN_READ, + (_("Could not open file \"%s\" for reading"), src->filename), + GST_ERROR_SYSTEM); return FALSE; } else { /* check if it is a regular file, otherwise bail out */ @@ -731,8 +767,9 @@ gst_filesrc_open_file (GstFileSrc *src) fstat(src->fd, &stat_results); if (!S_ISREG(stat_results.st_mode)) { - gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file", - src->filename, NULL); + gst_element_error (src, RESOURCE, OPEN_READ, + (_("File \"%s\" isn't a regular file"), src->filename), + NULL); close(src->fd); return FALSE; } diff --git a/gst/elements/gstidentity.c b/gst/elements/gstidentity.c index f9bfdeb..b73d32d 100644 --- a/gst/elements/gstidentity.c +++ b/gst/elements/gstidentity.c @@ -27,6 +27,7 @@ # include "config.h" #endif +#include "../gst-i18n-lib.h" #include "gstidentity.h" GST_DEBUG_CATEGORY_STATIC (gst_identity_debug); @@ -165,7 +166,9 @@ gst_identity_chain (GstPad *pad, GstData *_data) identity->error_after--; if (identity->error_after == 0) { gst_buffer_unref (buf); - gst_element_error (GST_ELEMENT (identity), "errored after iterations as requested"); + gst_element_error (identity, CORE, FAILED, + (_("Failed after iterations as requested")), + NULL); return; } } diff --git a/gst/elements/gstmultidisksrc.c b/gst/elements/gstmultidisksrc.c index df9a241..9d5f1e5 100644 --- a/gst/elements/gstmultidisksrc.c +++ b/gst/elements/gstmultidisksrc.c @@ -26,11 +26,15 @@ #include #include #include +#include +#include #ifdef HAVE_CONFIG_H # include "config.h" #endif +#include "../gst-i18n-lib.h" + #include "gstmultidisksrc.h" GST_DEBUG_CATEGORY_STATIC (gst_multidisksrc_debug); @@ -236,9 +240,11 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad) src->fd = open ((const char *) src->currentfilename, O_RDONLY); if (src->fd < 0) { - perror ("open"); - gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL)); + gst_element_error (src, RESOURCE, OPEN_READ, + (_("Could not open file \"%s\" for reading"), src->currentfilename), + ("system error: %s", strerror (errno))); return FALSE; + } else { /* find the file length */ src->size = lseek (src->fd, 0, SEEK_END); @@ -249,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad) /* collapse state if that failed */ if (src->map == NULL) { close (src->fd); - gst_element_error (GST_ELEMENT (src),"mmapping file"); + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, + ("mmap call failed")); return FALSE; } GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN); diff --git a/gst/elements/gstmultifilesrc.c b/gst/elements/gstmultifilesrc.c index df9a241..9d5f1e5 100644 --- a/gst/elements/gstmultifilesrc.c +++ b/gst/elements/gstmultifilesrc.c @@ -26,11 +26,15 @@ #include #include #include +#include +#include #ifdef HAVE_CONFIG_H # include "config.h" #endif +#include "../gst-i18n-lib.h" + #include "gstmultidisksrc.h" GST_DEBUG_CATEGORY_STATIC (gst_multidisksrc_debug); @@ -236,9 +240,11 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad) src->fd = open ((const char *) src->currentfilename, O_RDONLY); if (src->fd < 0) { - perror ("open"); - gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL)); + gst_element_error (src, RESOURCE, OPEN_READ, + (_("Could not open file \"%s\" for reading"), src->currentfilename), + ("system error: %s", strerror (errno))); return FALSE; + } else { /* find the file length */ src->size = lseek (src->fd, 0, SEEK_END); @@ -249,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad) /* collapse state if that failed */ if (src->map == NULL) { close (src->fd); - gst_element_error (GST_ELEMENT (src),"mmapping file"); + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, + ("mmap call failed")); return FALSE; } GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN); diff --git a/gst/elements/gstpipefilter.c b/gst/elements/gstpipefilter.c index 8d43417..1f5d1b6 100644 --- a/gst/elements/gstpipefilter.c +++ b/gst/elements/gstpipefilter.c @@ -2,7 +2,7 @@ * Copyright (C) 1999,2000 Erik Walthinsen * 2000 Wim Taymans * - * gstpipefilter.c: + * gstpipefilter.c: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -33,6 +34,7 @@ # include "config.h" #endif +#include "../gst-i18n-lib.h" #include "gstpipefilter.h" GST_DEBUG_CATEGORY_STATIC (gst_pipefilter_debug); @@ -167,8 +169,8 @@ gst_pipefilter_get (GstPad *pad) readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read); GST_DEBUG ("read %ld bytes", readbytes); if (readbytes < 0) { - perror("read"); - gst_element_error(GST_ELEMENT(pipefilter),"reading"); + gst_element_error (pipefilter, RESOURCE, READ, + NULL, ("system error: %s", strerror (errno))); return NULL; } /* if we didn't get as many bytes as we asked for, we're at EOF */ @@ -211,8 +213,8 @@ gst_pipefilter_chain (GstPad *pad,GstData *_data) writebytes = write(pipefilter->fdin[1],data,size); GST_DEBUG ("written %ld bytes", writebytes); if (writebytes < 0) { - perror("write"); - gst_element_error(GST_ELEMENT(pipefilter),"writing"); + gst_element_error (pipefilter, RESOURCE, WRITE, + NULL, ("system error: %s", strerror (errno))); return; } gst_buffer_unref(buf); @@ -267,8 +269,8 @@ gst_pipefilter_open_file (GstPipefilter *src) if((src->childpid = fork()) == -1) { - perror("fork"); - gst_element_error(GST_ELEMENT(src),"forking"); + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, ("system error: %s", strerror (errno))); return FALSE; } @@ -280,9 +282,9 @@ gst_pipefilter_open_file (GstPipefilter *src) dup2(src->fdin[0], STDIN_FILENO); /* set the childs input stream */ dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */ execvp(src->command[0], &src->command[0]); - /* will only reach if error */ - perror("exec"); - gst_element_error(GST_ELEMENT(src),"starting child process"); + /* will only be reached if execvp has an error */ + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, ("system error: %s", strerror (errno))); return FALSE; } diff --git a/gst/elements/gsttypefind.c b/gst/elements/gsttypefind.c index 1d92c99..eb7647a 100644 --- a/gst/elements/gsttypefind.c +++ b/gst/elements/gsttypefind.c @@ -44,6 +44,7 @@ #include #include +#include GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug); #define GST_CAT_DEFAULT gst_type_find_element_debug @@ -556,7 +557,8 @@ gst_type_find_element_chain (GstPad *pad, GstData *data) if (typefind->caps) { stop_typefinding (typefind); } else if (typefind->possibilities == NULL) { - gst_element_error (GST_ELEMENT (typefind), "media type could not be detected"); + gst_element_error (typefind, STREAM, TYPE_NOT_FOUND, + NULL, NULL); } else { /* set up typefind element for next iteration */ typefind->possibilities = g_list_sort (typefind->possibilities, compare_type_find_entry); diff --git a/gst/elements/gsttypefindelement.c b/gst/elements/gsttypefindelement.c index 1d92c99..eb7647a 100644 --- a/gst/elements/gsttypefindelement.c +++ b/gst/elements/gsttypefindelement.c @@ -44,6 +44,7 @@ #include #include +#include GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug); #define GST_CAT_DEFAULT gst_type_find_element_debug @@ -556,7 +557,8 @@ gst_type_find_element_chain (GstPad *pad, GstData *data) if (typefind->caps) { stop_typefinding (typefind); } else if (typefind->possibilities == NULL) { - gst_element_error (GST_ELEMENT (typefind), "media type could not be detected"); + gst_element_error (typefind, STREAM, TYPE_NOT_FOUND, + NULL, NULL); } else { /* set up typefind element for next iteration */ typefind->possibilities = g_list_sort (typefind->possibilities, compare_type_find_entry); diff --git a/gst/gst.h b/gst/gst.h index 8463f2d..c36b088 100644 --- a/gst/gst.h +++ b/gst/gst.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include diff --git a/gst/gst_private.h b/gst/gst_private.h index 3a98aeb..f6e3f33 100644 --- a/gst/gst_private.h +++ b/gst/gst_private.h @@ -60,6 +60,7 @@ extern GstDebugCategory *GST_CAT_THREAD; extern GstDebugCategory *GST_CAT_XML; extern GstDebugCategory *GST_CAT_NEGOTIATION; extern GstDebugCategory *GST_CAT_REFCOUNTING; +extern GstDebugCategory *GST_CAT_ERROR_SYSTEM; extern GstDebugCategory *GST_CAT_EVENT; extern GstDebugCategory *GST_CAT_PARAMS; extern GstDebugCategory *GST_CAT_CALL_TRACE; diff --git a/gst/gstelement.c b/gst/gstelement.c index 99a6db2..9e81a39 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -27,10 +27,12 @@ #include "gstelement.h" #include "gstbin.h" +#include "gsterror.h" #include "gstscheduler.h" #include "gstevent.h" #include "gstutils.h" #include "gstinfo.h" +#include "gst-i18n-lib.h" /* Element signals and args */ enum { @@ -66,7 +68,7 @@ static void gst_element_real_get_property (GObject *object, guint prop_id, GVa static void gst_element_dispose (GObject *object); static GstElementStateReturn gst_element_change_state (GstElement *element); -static void gst_element_error_func (GstElement* element, GstElement *source, gchar *errormsg); +static void gst_element_error_func (GstElement* element, GstElement *source, GError *error, gchar *debug); static void gst_element_found_tag_func (GstElement* element, GstElement *source, GstTagList *tag_list); #ifndef GST_DISABLE_LOADSAVE @@ -129,9 +131,9 @@ gst_element_class_init (GstElementClass *klass) gst_element_signals[ERROR] = g_signal_new ("error", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstElementClass, error), NULL, NULL, - gst_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2, - GST_TYPE_ELEMENT, G_TYPE_STRING); - gst_element_signals[EOS] = + gst_marshal_VOID__OBJECT_POINTER_STRING, G_TYPE_NONE, 3, + GST_TYPE_ELEMENT, G_TYPE_POINTER, G_TYPE_STRING); + gst_element_signals[EOS] = g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstElementClass, eos), NULL, NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -152,7 +154,7 @@ gst_element_class_init (GstElementClass *klass) #endif klass->change_state = GST_DEBUG_FUNCPTR (gst_element_change_state); - klass->error = GST_DEBUG_FUNCPTR (gst_element_error_func); + klass->error = GST_DEBUG_FUNCPTR (gst_element_error_func); klass->found_tag = GST_DEBUG_FUNCPTR (gst_element_found_tag_func); klass->numpadtemplates = 0; @@ -221,21 +223,25 @@ gst_element_real_get_property (GObject *object, guint prop_id, GValue *value, GP * gst_element_default_error: * @object: a #GObject that signalled the error. * @orig: the #GstObject that initiated the error. - * @error: the error message. + * @error: the GError. + * @debug: an additional debug information string, or NULL. * - * Adds a default error signal callback to an - * element. The user data passed to the g_signal_connect is - * ignored. - * The default handler will simply print the error string - * using g_print. + * A default error signal callback to attach to an element. + * The user data passed to the g_signal_connect is ignored. + * + * The default handler will simply print the error string using g_print. */ void -gst_element_default_error (GObject *object, GstObject *orig, gchar *error) -{ - gchar *name = gst_object_get_path_string (orig); - g_print ("ERROR: %s: %s\n", name, error); +gst_element_default_error (GObject *object, GstObject *source, GError *error, gchar *debug) +{ + gchar *name = gst_object_get_path_string (source); + + g_print (_("ERROR: from element %s: %s.\n"), name, error->message); + if (debug) + g_print (_("Additional debug info:\n%s\n"), debug); + g_free (name); -} +} typedef struct { const GParamSpec *pspec; @@ -2056,19 +2062,22 @@ gst_element_unlink (GstElement *src, GstElement *dest) } static void -gst_element_error_func (GstElement* element, GstElement *source, - gchar *errormsg) +gst_element_error_func (GstElement* element, GstElement *source, + GError *error, gchar *debug) { /* tell the parent */ if (GST_OBJECT_PARENT (element)) { - GST_CAT_DEBUG (GST_CAT_EVENT, "forwarding error \"%s\" from %s to %s", - errormsg, GST_ELEMENT_NAME (element), - GST_OBJECT_NAME (GST_OBJECT_PARENT (element))); + GST_CAT_DEBUG (GST_CAT_ERROR_SYSTEM, "forwarding error \"%s\" from %s to %s", + error->message, GST_ELEMENT_NAME (element), + GST_OBJECT_NAME (GST_OBJECT_PARENT (element))); gst_object_ref (GST_OBJECT (element)); - g_signal_emit (G_OBJECT (GST_OBJECT_PARENT (element)), - gst_element_signals[ERROR], 0, source, errormsg); + g_signal_emit (G_OBJECT (GST_OBJECT_PARENT (element)), + gst_element_signals[ERROR], 0, source, error, debug); gst_object_unref (GST_OBJECT (element)); + GST_CAT_DEBUG (GST_CAT_ERROR_SYSTEM, "forwarded error \"%s\" from %s to %s", + error->message, GST_ELEMENT_NAME (element), + GST_OBJECT_NAME (GST_OBJECT_PARENT (element))); } } @@ -2341,55 +2350,85 @@ gst_element_convert (GstElement *element, } /** - * gst_element_error: + * gst_element_error_extended: * @element: a #GstElement with the error. - * @error: the printf-style string describing the error. - * @...: the optional arguments for the string. + * @domain: the GStreamer error domain this error belongs to. + * @code: the error code belonging to the domain + * @message: an allocated message to be used as a replacement for the default + * message connected to code, or NULL + * debug: an allocated debug message to be used as a replacement for the + * default debugging information, or NULL * * signals an error condition on an element. * This function is used internally by elements. - * It results in the "error" signal. + * It results in the "error_2" signal. */ void -gst_element_error (GstElement *element, const gchar *error, ...) +gst_element_error_extended +(GstElement *element, GQuark domain, gint code, gchar *message, gchar *debug, + const gchar *file, const gchar *function, gint line) { - va_list var_args; - gchar *string; - + GError *error = NULL; + gchar *sent_message; + gchar *sent_debug; + /* checks */ g_return_if_fail (GST_IS_ELEMENT (element)); - g_return_if_fail (error != NULL); + + /* 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); */ + g_free (message); + sent_message = gst_error_get_message (domain, code); + } + else + sent_message = message; /* create error message */ - va_start (var_args, error); - string = g_strdup_vprintf (error, var_args); - va_end (var_args); - GST_CAT_INFO (GST_CAT_EVENT, "ERROR in %s: %s", GST_ELEMENT_NAME (element), string); + GST_CAT_INFO (GST_CAT_ERROR_SYSTEM, "signaling error in %s: %s", + GST_ELEMENT_NAME (element), + sent_message); + error = g_error_new (domain, code, sent_message); /* if the element was already in error, stop now */ if (GST_FLAG_IS_SET (element, GST_ELEMENT_ERROR)) { - GST_CAT_INFO (GST_CAT_EVENT, "recursive ERROR detected in %s", GST_ELEMENT_NAME (element)); - g_free (string); + GST_CAT_INFO (GST_CAT_ERROR_SYSTEM, "recursive ERROR detected in %s", + GST_ELEMENT_NAME (element)); + g_free (sent_message); + if (debug) g_free (debug); return; } - + GST_FLAG_SET (element, GST_ELEMENT_ERROR); /* emit the signal, make sure the element stays available */ gst_object_ref (GST_OBJECT (element)); - g_signal_emit (G_OBJECT (element), gst_element_signals[ERROR], 0, element, string); - + if (debug) + sent_debug = g_strdup_printf ("%s(%d):%s:\n%s", + file, line, function, + debug ? debug : ""); + else + sent_debug = NULL; + g_free (debug); + g_signal_emit (G_OBJECT (element), gst_element_signals[ERROR], 0, element, + error, sent_debug); + GST_CAT_INFO (GST_CAT_ERROR_SYSTEM, "signalled error in %s: %s", + GST_ELEMENT_NAME (element), + sent_message); + /* tell the scheduler */ if (element->sched) { - gst_scheduler_error (element->sched, element); - } + gst_scheduler_error (element->sched, element); + } - if (GST_STATE (element) == GST_STATE_PLAYING) { + if (GST_STATE (element) == GST_STATE_PLAYING) { GstElementStateReturn ret; - + ret = gst_element_set_state (element, GST_STATE_PAUSED); if (ret != GST_STATE_SUCCESS) { - g_warning ("could not PAUSE element \"%s\" after error, help!", GST_ELEMENT_NAME (element)); + g_warning ("could not PAUSE element \"%s\" after error, help!", + GST_ELEMENT_NAME (element)); } } @@ -2397,7 +2436,9 @@ gst_element_error (GstElement *element, const gchar *error, ...) /* cleanup */ gst_object_unref (GST_OBJECT (element)); - g_free (string); + g_free (sent_message); + g_free (sent_debug); + g_error_free (error); } /** diff --git a/gst/gstelement.h b/gst/gstelement.h index 9108f9d..2537eba 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -139,6 +139,13 @@ typedef enum { #define GST_ELEMENT_CLOCK(obj) (((GstElement*)(obj))->clock) #define GST_ELEMENT_PADS(obj) ((obj)->pads) +#define gst_element_error(el, domain, code, message, debug) \ + gst_element_error_extended (GST_ELEMENT(el), \ + GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \ + g_strdup_printf message, \ + g_strdup_printf debug, \ + __FILE__, GST_FUNCTION, __LINE__) + typedef struct _GstElementFactory GstElementFactory; typedef struct _GstElementFactoryClass GstElementFactoryClass; @@ -195,7 +202,7 @@ struct _GstElementClass { void (*state_change) (GstElement *element, GstElementState old, GstElementState state); void (*new_pad) (GstElement *element, GstPad *pad); void (*pad_removed) (GstElement *element, GstPad *pad); - void (*error) (GstElement *element, GstElement *source, gchar *error); + void (*error) (GstElement *element, GstElement *source, GError *error, gchar *debug); void (*eos) (GstElement *element); void (*found_tag) (GstElement *element, GstElement *source, GstTagList *tag_list); @@ -244,7 +251,7 @@ void gst_element_class_set_details (GstElementClass *klass, #define gst_element_default_deep_notify gst_object_default_deep_notify -void gst_element_default_error (GObject *object, GstObject *orig, gchar *error); +void gst_element_default_error (GObject *object, GstObject *orig, GError *error, gchar *debug); GType gst_element_get_type (void); void gst_element_set_loop_function (GstElement *element, @@ -358,7 +365,7 @@ void gst_element_found_tags_for_pad (GstElement *element, GstPad *pad, GstCloc void gst_element_set_eos (GstElement *element); -void gst_element_error (GstElement *element, const gchar *error, ...); +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); void gst_element_set_locked_state (GstElement *element, gboolean locked_state); diff --git a/gst/gsterror.c b/gst/gsterror.c new file mode 100644 index 0000000..9bf2a5b --- /dev/null +++ b/gst/gsterror.c @@ -0,0 +1,214 @@ +/* GStreamer + * Copyright (C) <2003> David A. Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "gst_private.h" +#include "gst-i18n-lib.h" + +#define TABLE(t, d, a, b) t[GST_ ## d ## _ERROR_ ## a] = g_strdup (b) +#define QUARK_FUNC(string) \ +GQuark gst_ ## string ## _error_quark (void) { \ + static GQuark quark; \ + if (!quark) \ + quark = g_quark_from_static_string ("gst-" # string "-error-quark"); \ + return quark; } + +/* initialize the dynamic table of translated core errors */ +static gchar ** _gst_core_errors_init () +{ + gchar **t = NULL; + + t = g_new0 (gchar *, GST_CORE_ERROR_NUM_ERRORS); + + TABLE (t, CORE, FAILED, + N_("GStreamer encountered a general core library error.")); + TABLE (t, CORE, TOO_LAZY, + N_("GStreamer developers were too lazy to assign an error code " + "to this error. Please file a bug.")); + TABLE (t, CORE, NOT_IMPLEMENTED, + N_("Internal GStreamer error: code not implemented. File a bug.")); + TABLE (t, CORE, STATE_CHANGE, + N_("Internal GStreamer error: state change failed. File a bug.")); + TABLE (t, CORE, PAD, + N_("Internal GStreamer error: pad problem. File a bug.")); + TABLE (t, CORE, THREAD, + N_("Internal GStreamer error: thread problem. File a bug.")); + TABLE (t, CORE, SCHEDULER, + N_("Internal GStreamer error: scheduler problem. File a bug.")); + TABLE (t, CORE, NEGOTIATION, + N_("Internal GStreamer error: negotiation problem. File a bug.")); + TABLE (t, CORE, EVENT, + N_("Internal GStreamer error: event problem. File a bug.")); + TABLE (t, CORE, SEEK, + N_("Internal GStreamer error: seek problem. File a bug.")); + TABLE (t, CORE, CAPS, + N_("Internal GStreamer error: caps problem. File a bug.")); + TABLE (t, CORE, TAG, + N_("Internal GStreamer error: tag problem. File a bug.")); + + return t; +} + +/* initialize the dynamic table of translated library errors */ +static gchar ** _gst_library_errors_init () +{ + gchar **t = NULL; + + t = g_new0 (gchar *, GST_LIBRARY_ERROR_NUM_ERRORS); + + TABLE (t, LIBRARY, FAILED, + N_("GStreamer encountered a general supporting library error.")); + TABLE (t, LIBRARY, TOO_LAZY, + N_("GStreamer developers were too lazy to assign an error code " + "to this error. Please file a bug.")); + TABLE (t, LIBRARY, INIT, + N_("Could not initialize supporting library.")); + TABLE (t, LIBRARY, SHUTDOWN, + N_("Could not close supporting library.")); + TABLE (t, LIBRARY, SETTINGS, + N_("Could not close supporting library.")); + + return t; +} + +/* initialize the dynamic table of translated resource errors */ +static gchar ** _gst_resource_errors_init () +{ + gchar **t = NULL; + + t = g_new0 (gchar *, GST_RESOURCE_ERROR_NUM_ERRORS); + + TABLE (t, RESOURCE, FAILED, + N_("GStreamer encountered a general supporting library error.")); + TABLE (t, RESOURCE, TOO_LAZY, + N_("GStreamer developers were too lazy to assign an error code " + "to this error. Please file a bug.")); + TABLE (t, RESOURCE, NOT_FOUND, + N_("Resource not found.")); + TABLE (t, RESOURCE, BUSY, + N_("Resource busy or not available.")); + TABLE (t, RESOURCE, OPEN_READ, + N_("Could not open resource for reading.")); + TABLE (t, RESOURCE, OPEN_WRITE, + N_("Could not open resource for writing.")); + TABLE (t, RESOURCE, OPEN_READ_WRITE, + N_("Could not open resource for reading and writing.")); + TABLE (t, RESOURCE, CLOSE, + N_("Could not close resource.")); + TABLE (t, RESOURCE, READ, + N_("Could not read from resource.")); + TABLE (t, RESOURCE, WRITE, + N_("Could not write to resource.")); + TABLE (t, RESOURCE, SEEK, + N_("Could not perform seek on resource.")); + TABLE (t, RESOURCE, SYNC, + N_("Could not synchronize on resource.")); + TABLE (t, RESOURCE, SETTINGS, + N_("Could not get/set settings from/on resource.")); + + return t; +} + +/* initialize the dynamic table of translated stream errors */ +static gchar ** _gst_stream_errors_init () +{ + gchar **t = NULL; + + t = g_new0 (gchar *, GST_STREAM_ERROR_NUM_ERRORS); + + TABLE (t, STREAM, FAILED, + N_("GStreamer encountered a general supporting library error.")); + TABLE (t, STREAM, TOO_LAZY, + N_("GStreamer developers were too lazy to assign an error code " + "to this error. Please file a bug.")); + TABLE (t, STREAM, NOT_IMPLEMENTED, + N_("Element doesn't implement handling of this stream. " + "Please file a bug.")); + TABLE (t, STREAM, TYPE_NOT_FOUND, + N_("Could not determine type of stream.")); + TABLE (t, STREAM, WRONG_TYPE, + N_("The stream is of a different type than handled by this element.")); + TABLE (t, STREAM, DECODE, + N_("Could not decode stream.")); + TABLE (t, STREAM, ENCODE, + N_("Could not encode stream.")); + TABLE (t, STREAM, DEMUX, + N_("Could not demultiplex stream.")); + TABLE (t, STREAM, MUX, + N_("Could not multiplex stream.")); + TABLE (t, STREAM, FORMAT, + N_("Stream is of the wrong format.")); + + return t; +} + +QUARK_FUNC (core) +QUARK_FUNC (library) +QUARK_FUNC (resource) +QUARK_FUNC (stream) + +/** + * gst_error_get_message: + * @domain: the GStreamer error domain this error belongs to. + * @code: the error code belonging to the domain. + * + * Returns: a newly allocated string describing the error message in the + * current locale. + */ + +gchar * +gst_error_get_message (GQuark domain, gint code) +{ + static gchar **gst_core_errors = NULL; + static gchar **gst_library_errors = NULL; + static gchar **gst_resource_errors = NULL; + static gchar **gst_stream_errors = NULL; + + gchar *message = NULL; + + /* initialize error message tables if necessary */ + if (gst_core_errors == NULL) + gst_core_errors = _gst_core_errors_init (); + if (gst_library_errors == NULL) + gst_library_errors = _gst_library_errors_init (); + if (gst_resource_errors == NULL) + gst_resource_errors = _gst_resource_errors_init (); + if (gst_stream_errors == NULL) + gst_stream_errors = _gst_stream_errors_init (); + + + if (domain == GST_CORE_ERROR) message = gst_core_errors [code]; + else if (domain == GST_LIBRARY_ERROR) message = gst_library_errors [code]; + else if (domain == GST_RESOURCE_ERROR) message = gst_resource_errors[code]; + else if (domain == GST_STREAM_ERROR) message = gst_stream_errors [code]; + else + { + g_warning ("No error messages for domain %s", g_quark_to_string (domain)); + return g_strdup_printf (_("No error message for domain %s"), g_quark_to_string (domain)); + } + if (message) + return g_strdup (_(message)); + else + return g_strdup_printf (_("No standard error message for domain %s and code %d"), + g_quark_to_string (domain), code); +} diff --git a/gst/gsterror.h b/gst/gsterror.h new file mode 100644 index 0000000..d82ac3c --- /dev/null +++ b/gst/gsterror.h @@ -0,0 +1,128 @@ +/* GStreamer + * Copyright (C) 2004 Thomas Vander Stichele + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_ERROR_H__ +#define __GST_ERROR_H__ + +G_BEGIN_DECLS + +/* + * we define FIXME error domains: + * GST_CORE_ERROR + * GST_LIBRARY_ERROR + * GST_RESOURCE_ERROR + * GST_STREAM_ERROR + * + * Check GError API docs for rationale for naming. + */ + +/* Core errors are anything that can go wrong in or using + * the core GStreamer library */ +/* FIXME: should we divide in numerical blocks so we can easily add + for example PAD errors later ? */ +typedef enum { + GST_CORE_ERROR_FAILED = 1, + GST_CORE_ERROR_TOO_LAZY, + GST_CORE_ERROR_NOT_IMPLEMENTED, + GST_CORE_ERROR_STATE_CHANGE, + GST_CORE_ERROR_PAD, + GST_CORE_ERROR_THREAD, + GST_CORE_ERROR_SCHEDULER, + GST_CORE_ERROR_NEGOTIATION, + GST_CORE_ERROR_EVENT, + GST_CORE_ERROR_SEEK, + GST_CORE_ERROR_CAPS, + GST_CORE_ERROR_TAG, + GST_CORE_ERROR_NUM_ERRORS +} +GstCoreError; + +#define GST_CORE_ERROR gst_core_error_quark () +GQuark gst_core_error_quark (void); + +/* Library errors are for errors from the library being used by elements + initializing, closing, ... */ +typedef enum { + GST_LIBRARY_ERROR_FAILED = 1, + GST_LIBRARY_ERROR_TOO_LAZY, + GST_LIBRARY_ERROR_INIT, + GST_LIBRARY_ERROR_SHUTDOWN, + GST_LIBRARY_ERROR_SETTINGS, + GST_LIBRARY_ERROR_NUM_ERRORS +} +GstLibraryError; + +#define GST_LIBRARY_ERROR gst_library_error_quark () +GQuark gst_library_error_quark (void); + + +/* Resource errors are for anything external used by an element: + memory, files, network connections, process space, ... + They're typically used by source and sink elements */ +typedef enum { + GST_RESOURCE_ERROR_FAILED = 1, + GST_RESOURCE_ERROR_TOO_LAZY, + GST_RESOURCE_ERROR_NOT_FOUND, + GST_RESOURCE_ERROR_BUSY, + GST_RESOURCE_ERROR_OPEN_READ, + GST_RESOURCE_ERROR_OPEN_WRITE, + GST_RESOURCE_ERROR_OPEN_READ_WRITE, + GST_RESOURCE_ERROR_CLOSE, + GST_RESOURCE_ERROR_READ, + GST_RESOURCE_ERROR_WRITE, + GST_RESOURCE_ERROR_SEEK, + GST_RESOURCE_ERROR_SYNC, + GST_RESOURCE_ERROR_SETTINGS, + GST_RESOURCE_ERROR_NUM_ERRORS +} +GstResourceError; + +#define GST_RESOURCE_ERROR gst_resource_error_quark () +GQuark gst_resource_error_quark (void); + +/* Stream errors are for anything related to the stream being processed: + format errors, media type errors, ... + They're typically used by decoders, demuxers, converters, ... */ +typedef enum { + GST_STREAM_ERROR_FAILED = 1, + GST_STREAM_ERROR_TOO_LAZY, + GST_STREAM_ERROR_NOT_IMPLEMENTED, + GST_STREAM_ERROR_TYPE_NOT_FOUND, + GST_STREAM_ERROR_WRONG_TYPE, + GST_STREAM_ERROR_DECODE, + GST_STREAM_ERROR_ENCODE, + GST_STREAM_ERROR_DEMUX, + GST_STREAM_ERROR_MUX, + GST_STREAM_ERROR_FORMAT, + GST_STREAM_ERROR_NUM_ERRORS +} +GstStreamError; + +#define GST_STREAM_ERROR gst_stream_error_quark () +GQuark gst_stream_error_quark (void); + + +#define GST_ERROR_SYSTEM ("system error: %s", g_strerror (errno)) +gchar * gst_error_get_message (GQuark domain, gint code); + +G_END_DECLS + +#endif /* __GST_ERROR_H__ */ + + diff --git a/gst/gstinfo.c b/gst/gstinfo.c index e763f7b..210ff94 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -129,6 +129,7 @@ GstDebugCategory *GST_CAT_TYPES = NULL; GstDebugCategory *GST_CAT_XML = NULL; GstDebugCategory *GST_CAT_NEGOTIATION = NULL; GstDebugCategory *GST_CAT_REFCOUNTING = NULL; +GstDebugCategory *GST_CAT_ERROR_SYSTEM = NULL; GstDebugCategory *GST_CAT_EVENT = NULL; GstDebugCategory *GST_CAT_PARAMS = NULL; GstDebugCategory *GST_CAT_CALL_TRACE = NULL; @@ -228,6 +229,10 @@ void _gst_debug_init (void) GST_CAT_REFCOUNTING = _gst_debug_category_new ("GST_REFCOUNTING", GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE | GST_DEBUG_BG_GREEN, NULL); + GST_CAT_ERROR_SYSTEM = _gst_debug_category_new ("GST_ERROR_SYSTEM", + GST_DEBUG_BOLD | GST_DEBUG_FG_RED | GST_DEBUG_BG_WHITE, + NULL); + GST_CAT_EVENT = _gst_debug_category_new ("GST_EVENT", GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL); diff --git a/gst/gstmarshal.list b/gst/gstmarshal.list index 261e1ed..48fff87 100644 --- a/gst/gstmarshal.list +++ b/gst/gstmarshal.list @@ -7,6 +7,7 @@ VOID:POINTER,OBJECT VOID:OBJECT VOID:OBJECT,PARAM VOID:OBJECT,POINTER +VOID:OBJECT,POINTER,STRING VOID:OBJECT,STRING VOID:INT,INT VOID:INT64 diff --git a/gst/gstpad.c b/gst/gstpad.c index 2f62813..db6d0d7 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -29,6 +29,7 @@ #include "gstscheduler.h" #include "gstevent.h" #include "gstinfo.h" +#include "gsterror.h" #include "gstvalue.h" #define GST_CAT_DEFAULT GST_CAT_PADS @@ -1226,7 +1227,7 @@ gst_pad_link_negotiate (GstPadLink *link) /** * gst_pad_link_try: - * @link link to try + * @link: link to try * * Tries to (re)link the pads with the given link. The function takes ownership * of the supplied link. If the function returns FALSE and an old link existed, @@ -2173,7 +2174,7 @@ gst_pad_proxy_fixate (GstPad *pad, const GstCaps *caps) * unset. * * This function calls gst_pad_try_set_caps() on the pad. If that - * call fails, gst_element_error() is called to indicate a negotiation + * call fails, GST_ELEMENT_ERROR() is called to indicate a negotiation * failure. * * Returns: TRUE if the caps were set correctly, otherwise FALSE @@ -2202,7 +2203,9 @@ gst_pad_set_explicit_caps (GstPad *pad, const GstCaps *caps) } link_ret = gst_pad_try_set_caps (pad, caps); if (link_ret == GST_PAD_LINK_REFUSED) { - gst_element_error (gst_pad_get_parent (pad), "negotiation failed"); + gst_element_error (gst_pad_get_parent (pad), CORE, PAD, + NULL, + ("failed to negotiate (try_set_caps returned REFUSED)")); return FALSE; } @@ -2578,8 +2581,9 @@ gst_pad_recover_caps_error (GstPad *pad, const GstCaps *allowed) /* report error */ parent = gst_pad_get_parent (pad); - gst_element_error (parent, "negotiation failed on pad %s:%s", - GST_DEBUG_PAD_NAME (pad)); + gst_element_error (parent, CORE, PAD, + NULL, + ("negotiation failed on pad %s:%s", GST_DEBUG_PAD_NAME (pad))); #endif return FALSE; } @@ -2877,23 +2881,21 @@ gst_pad_pull (GstPad *pad) GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad, "pulling"); - g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SINK, + g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SINK, GST_DATA (gst_event_new (GST_EVENT_INTERRUPT))); peer = GST_RPAD_PEER (pad); if (!peer) { - gst_element_error (GST_PAD_PARENT (pad), - "pull on pad %s:%s but it was unlinked", - GST_ELEMENT_NAME (GST_PAD_PARENT (pad)), - GST_PAD_NAME (pad), NULL); + gst_element_error (GST_PAD_PARENT (pad), CORE, PAD, NULL, + ("pull on pad %s:%s but it was unlinked", GST_DEBUG_PAD_NAME (pad))); } else { restart: if (peer->gethandler) { GstData *data; - GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad, + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad, "calling gethandler %s of peer pad %s:%s", GST_DEBUG_FUNCPTR_NAME (peer->gethandler), GST_DEBUG_PAD_NAME (peer)); @@ -2907,15 +2909,12 @@ restart: } /* no null buffers allowed */ - gst_element_error (GST_PAD_PARENT (pad), - "NULL buffer during pull on %s:%s", - GST_DEBUG_PAD_NAME (pad)); - + gst_element_error (GST_PAD_PARENT (pad), CORE, PAD, NULL, + ("NULL buffer during pull on %s:%s", GST_DEBUG_PAD_NAME (pad))); } else { - gst_element_error (GST_PAD_PARENT (pad), - "internal error: pull on pad %s:%s " - "but the peer pad %s:%s has no gethandler", - GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer)); + gst_element_error (GST_PAD_PARENT (pad), CORE, PAD, NULL, + ("pull on pad %s:%s but the peer pad %s:%s has no gethandler", + GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer))); } } return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)); diff --git a/gst/gstqueue.c b/gst/gstqueue.c index efd4616..d9a2155 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -28,6 +28,7 @@ #include "gstscheduler.h" #include "gstevent.h" #include "gstinfo.h" +#include "gsterror.h" static GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS ( "Queue", @@ -561,10 +562,10 @@ restart: if (!queue->may_deadlock) { g_mutex_unlock (queue->qlock); gst_data_unref (data); - gst_element_error (GST_ELEMENT (queue), - "deadlock found, source pad elements are shut down"); + gst_element_error (queue, CORE, THREAD, NULL, + ("deadlock found, shutting down source pad elements")); /* we don't go to out_unref here, since we want to - * unref the buffer *before* calling gst_element_error */ + * unref the buffer *before* calling GST_ELEMENT_ERROR */ return; } else { GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue, @@ -677,8 +678,8 @@ restart: /* this means the other end is shut down */ if (!queue->may_deadlock) { g_mutex_unlock (queue->qlock); - gst_element_error (GST_ELEMENT (queue), - "deadlock found, sink pad elements are shut down"); + gst_element_error (queue, CORE, THREAD, NULL, + ("deadlock found, shutting down sink pad elements")); goto restart; } else { GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue, diff --git a/gst/schedulers/gstbasicscheduler.c b/gst/schedulers/gstbasicscheduler.c index bf4337e..e988f1c 100644 --- a/gst/schedulers/gstbasicscheduler.c +++ b/gst/schedulers/gstbasicscheduler.c @@ -460,8 +460,8 @@ gst_basic_scheduler_chainhandler_proxy (GstPad * pad, GstData * data) } if (loop_count == 0) { - gst_element_error (parent, - "(internal error) basic: maximum number of switches exceeded"); + gst_element_error (parent, CORE, SCHEDULER, NULL, + ("(internal error) basic: maximum number of switches exceeded")); return; } @@ -528,7 +528,7 @@ gst_basic_scheduler_gethandler_proxy (GstPad * pad) GST_CAT_DEBUG (debug_dataflow, "new pad in mid-switch!"); pad = (GstPad *) GST_RPAD_PEER (peer); if (!pad) { - gst_element_error (parent, "pad unlinked"); + gst_element_error (parent, CORE, PAD, NULL, ("pad unlinked")); } parent = GST_PAD_PARENT (pad); peer = GST_RPAD_PEER (pad); @@ -659,10 +659,9 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) * either, we have an error */ if (different_sched && !peer_decoupled) { - gst_element_error (element, - "element \"%s\" is not decoupled but has pads " - "in different schedulers", - GST_ELEMENT_NAME (element), NULL); + gst_element_error (element, CORE, SCHEDULER, NULL, + ("element \"%s\" is not decoupled but has pads in different schedulers", + GST_ELEMENT_NAME (element))); return FALSE; } /* ok, the peer is in a different scheduler and is decoupled, @@ -728,8 +727,8 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) chain->sched->context, wrapper_function, 0, (char **) element); if (GST_ELEMENT_THREADSTATE (element) == NULL) { - gst_element_error (element, "could not create cothread for \"%s\"", - GST_ELEMENT_NAME (element), NULL); + gst_element_error (element, RESOURCE, TOO_LAZY, NULL, ("could not create cothread for \"%s\"", + GST_ELEMENT_NAME (element))); return FALSE; } GST_DEBUG ("created cothread %p for '%s'", diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index 61621d9..ece69de 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -391,7 +391,8 @@ gst_fakesink_change_state (GstElement *element) return GST_STATE_SUCCESS; error: - gst_element_error (element, "failed state change as requested"); + gst_element_error (element, CORE, STATE_CHANGE, + NULL, NULL); return GST_STATE_FAILURE; } diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 97a04f3..d726073 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -25,6 +25,8 @@ # include "config.h" #endif +#include "../gst-i18n-lib.h" + #include #include #include "gstfilesink.h" @@ -33,6 +35,7 @@ #include #include + GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug); #define GST_CAT_DEFAULT gst_filesink_debug @@ -230,18 +233,18 @@ gst_filesink_open_file (GstFileSink *sink) /* open the file */ if (!sink->filename) { - gst_element_error (GST_ELEMENT (sink), - "Error opening file: no file given"); + gst_element_error (sink, RESOURCE, NOT_FOUND, + (_("No filename specified")), NULL); return FALSE; } sink->file = fopen (sink->filename, "w"); if (sink->file == NULL) { - gst_element_error (GST_ELEMENT (sink), - "Error opening file %s: %s", - sink->filename, g_strerror(errno)); + gst_element_error (sink, RESOURCE, OPEN_WRITE, + (_("Could not open file \"%s\" for writing"), sink->filename), + ("system error: %s", strerror (errno))); return FALSE; - } + } GST_FLAG_SET (sink, GST_FILESINK_OPEN); @@ -257,9 +260,9 @@ gst_filesink_close_file (GstFileSink *sink) if (fclose (sink->file) != 0) { - gst_element_error (GST_ELEMENT (sink), - "Error closing file %s: %s", - sink->filename, g_strerror(errno)); + gst_element_error (sink, RESOURCE, CLOSE, + (_("Error closing file \"%s\""), sink->filename), + GST_ERROR_SYSTEM); } else { GST_FLAG_UNSET (sink, GST_FILESINK_OPEN); @@ -324,9 +327,9 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event) if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) if (fflush (filesink->file)) - gst_element_error (GST_ELEMENT (filesink), - "Error flushing file %s: %s", - filesink->filename, g_strerror(errno)); + gst_element_error (filesink, RESOURCE, WRITE, + (_("Error while writing to file \"%s\""), filesink->filename), + GST_ERROR_SYSTEM); switch (GST_EVENT_SEEK_METHOD(event)) { @@ -356,9 +359,9 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event) } case GST_EVENT_FLUSH: if (fflush (filesink->file)) { - gst_element_error (GST_ELEMENT (filesink), - "Error flushing file %s: %s", - filesink->filename, g_strerror(errno)); + gst_element_error (filesink, RESOURCE, WRITE, + (_("Error while writing to file \"%s\""), filesink->filename), + GST_ERROR_SYSTEM); } break; case GST_EVENT_EOS: @@ -408,10 +411,11 @@ gst_filesink_chain (GstPad *pad, GstData *_data) GST_BUFFER_SIZE (buf) - bytes_written, filesink->file); if (wrote <= 0) { - gst_element_error (GST_ELEMENT (filesink), - "Only %d of %d bytes written: %s", - bytes_written, GST_BUFFER_SIZE (buf), - strerror (errno)); + gst_element_error (filesink, RESOURCE, WRITE, + (_("Error while writing to file \"%s\""), filesink->filename), + ("Only %d of %d bytes written: %s", + bytes_written, GST_BUFFER_SIZE (buf), + strerror (errno))); break; } bytes_written += wrote; diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 452acf9..6e14f42 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -35,6 +35,8 @@ #include #include +#include "../gst-i18n-lib.h" + /********************************************************************** * GStreamer Default File Source @@ -297,7 +299,7 @@ gst_filesrc_set_property (GObject *object, guint prop_id, const GValue *value, G src->mapsize = g_value_get_ulong (value); g_object_notify (G_OBJECT (src), "mmapsize"); } else { - GST_INFO_OBJECT (src, "invalid mapsize, must a multiple of pagesize, which is %d", + GST_INFO_OBJECT (src, "invalid mapsize, must be a multiple of pagesize, which is %d", src->pagesize); } break; @@ -391,7 +393,9 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size) mmapregion = mmap (NULL, size, PROT_READ, MAP_SHARED, src->fd, offset); if (mmapregion == NULL) { - gst_element_error (GST_ELEMENT (src), "couldn't map file"); + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, + ("mmap call failed")); return NULL; } else if (mmapregion == MAP_FAILED) { @@ -636,12 +640,15 @@ gst_filesrc_get_read (GstFileSrc *src) ret = read (src->fd, GST_BUFFER_DATA (buf), readsize); if (ret < 0){ - gst_element_error (GST_ELEMENT (src), "reading file (%s)", - strerror (errno), NULL); + gst_element_error (src, RESOURCE, READ, + NULL, + ("system error: %s", strerror (errno))); return NULL; } if (ret < readsize) { - gst_element_error (GST_ELEMENT (src), "unexpected end of file", NULL); + gst_element_error (src, RESOURCE, READ, + NULL, + ("unexpected end of file")); return NULL; } @@ -711,18 +718,47 @@ gst_filesrc_check_filesize (GstFileSrc *src) return TRUE; } /* open the file and mmap it, necessary to go to READY state */ -static gboolean +static gboolean gst_filesrc_open_file (GstFileSrc *src) { g_return_val_if_fail (!GST_FLAG_IS_SET (src ,GST_FILESRC_OPEN), FALSE); + if (src->filename == NULL) + { + gst_element_error (src, RESOURCE, NOT_FOUND, + (_("No filename specified")), + NULL); + return FALSE; + } + + if (src->filename == NULL) + { + gst_element_error (src, RESOURCE, NOT_FOUND, + (_("No file specified for reading")), + NULL); + return FALSE; + } + + GST_INFO_OBJECT (src, "opening file %s",src->filename); /* open the file */ src->fd = open (src->filename, O_RDONLY); - if (src->fd < 0) { - gst_element_error (GST_ELEMENT (src), "opening file \"%s\" (%s)", - src->filename, strerror (errno), NULL); + if (src->fd < 0) + { + if (errno == ENOENT) + gst_element_error (src, RESOURCE, NOT_FOUND, + NULL, + NULL); +/* thomas + gst_element_error (src, RESOURCE, NOT_FOUND, + (_("File \"%s\" does not exist"), src->filename), + NULL); +*/ + else + gst_element_error (src, RESOURCE, OPEN_READ, + (_("Could not open file \"%s\" for reading"), src->filename), + GST_ERROR_SYSTEM); return FALSE; } else { /* check if it is a regular file, otherwise bail out */ @@ -731,8 +767,9 @@ gst_filesrc_open_file (GstFileSrc *src) fstat(src->fd, &stat_results); if (!S_ISREG(stat_results.st_mode)) { - gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file", - src->filename, NULL); + gst_element_error (src, RESOURCE, OPEN_READ, + (_("File \"%s\" isn't a regular file"), src->filename), + NULL); close(src->fd); return FALSE; } diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index f9bfdeb..b73d32d 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -27,6 +27,7 @@ # include "config.h" #endif +#include "../gst-i18n-lib.h" #include "gstidentity.h" GST_DEBUG_CATEGORY_STATIC (gst_identity_debug); @@ -165,7 +166,9 @@ gst_identity_chain (GstPad *pad, GstData *_data) identity->error_after--; if (identity->error_after == 0) { gst_buffer_unref (buf); - gst_element_error (GST_ELEMENT (identity), "errored after iterations as requested"); + gst_element_error (identity, CORE, FAILED, + (_("Failed after iterations as requested")), + NULL); return; } } diff --git a/plugins/elements/gstmultidisksrc.c b/plugins/elements/gstmultidisksrc.c index df9a241..9d5f1e5 100644 --- a/plugins/elements/gstmultidisksrc.c +++ b/plugins/elements/gstmultidisksrc.c @@ -26,11 +26,15 @@ #include #include #include +#include +#include #ifdef HAVE_CONFIG_H # include "config.h" #endif +#include "../gst-i18n-lib.h" + #include "gstmultidisksrc.h" GST_DEBUG_CATEGORY_STATIC (gst_multidisksrc_debug); @@ -236,9 +240,11 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad) src->fd = open ((const char *) src->currentfilename, O_RDONLY); if (src->fd < 0) { - perror ("open"); - gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL)); + gst_element_error (src, RESOURCE, OPEN_READ, + (_("Could not open file \"%s\" for reading"), src->currentfilename), + ("system error: %s", strerror (errno))); return FALSE; + } else { /* find the file length */ src->size = lseek (src->fd, 0, SEEK_END); @@ -249,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad) /* collapse state if that failed */ if (src->map == NULL) { close (src->fd); - gst_element_error (GST_ELEMENT (src),"mmapping file"); + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, + ("mmap call failed")); return FALSE; } GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN); diff --git a/plugins/elements/gstmultifilesrc.c b/plugins/elements/gstmultifilesrc.c index df9a241..9d5f1e5 100644 --- a/plugins/elements/gstmultifilesrc.c +++ b/plugins/elements/gstmultifilesrc.c @@ -26,11 +26,15 @@ #include #include #include +#include +#include #ifdef HAVE_CONFIG_H # include "config.h" #endif +#include "../gst-i18n-lib.h" + #include "gstmultidisksrc.h" GST_DEBUG_CATEGORY_STATIC (gst_multidisksrc_debug); @@ -236,9 +240,11 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad) src->fd = open ((const char *) src->currentfilename, O_RDONLY); if (src->fd < 0) { - perror ("open"); - gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL)); + gst_element_error (src, RESOURCE, OPEN_READ, + (_("Could not open file \"%s\" for reading"), src->currentfilename), + ("system error: %s", strerror (errno))); return FALSE; + } else { /* find the file length */ src->size = lseek (src->fd, 0, SEEK_END); @@ -249,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad) /* collapse state if that failed */ if (src->map == NULL) { close (src->fd); - gst_element_error (GST_ELEMENT (src),"mmapping file"); + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, + ("mmap call failed")); return FALSE; } GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN); diff --git a/plugins/elements/gstpipefilter.c b/plugins/elements/gstpipefilter.c index 8d43417..1f5d1b6 100644 --- a/plugins/elements/gstpipefilter.c +++ b/plugins/elements/gstpipefilter.c @@ -2,7 +2,7 @@ * Copyright (C) 1999,2000 Erik Walthinsen * 2000 Wim Taymans * - * gstpipefilter.c: + * gstpipefilter.c: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -33,6 +34,7 @@ # include "config.h" #endif +#include "../gst-i18n-lib.h" #include "gstpipefilter.h" GST_DEBUG_CATEGORY_STATIC (gst_pipefilter_debug); @@ -167,8 +169,8 @@ gst_pipefilter_get (GstPad *pad) readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read); GST_DEBUG ("read %ld bytes", readbytes); if (readbytes < 0) { - perror("read"); - gst_element_error(GST_ELEMENT(pipefilter),"reading"); + gst_element_error (pipefilter, RESOURCE, READ, + NULL, ("system error: %s", strerror (errno))); return NULL; } /* if we didn't get as many bytes as we asked for, we're at EOF */ @@ -211,8 +213,8 @@ gst_pipefilter_chain (GstPad *pad,GstData *_data) writebytes = write(pipefilter->fdin[1],data,size); GST_DEBUG ("written %ld bytes", writebytes); if (writebytes < 0) { - perror("write"); - gst_element_error(GST_ELEMENT(pipefilter),"writing"); + gst_element_error (pipefilter, RESOURCE, WRITE, + NULL, ("system error: %s", strerror (errno))); return; } gst_buffer_unref(buf); @@ -267,8 +269,8 @@ gst_pipefilter_open_file (GstPipefilter *src) if((src->childpid = fork()) == -1) { - perror("fork"); - gst_element_error(GST_ELEMENT(src),"forking"); + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, ("system error: %s", strerror (errno))); return FALSE; } @@ -280,9 +282,9 @@ gst_pipefilter_open_file (GstPipefilter *src) dup2(src->fdin[0], STDIN_FILENO); /* set the childs input stream */ dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */ execvp(src->command[0], &src->command[0]); - /* will only reach if error */ - perror("exec"); - gst_element_error(GST_ELEMENT(src),"starting child process"); + /* will only be reached if execvp has an error */ + gst_element_error (src, RESOURCE, TOO_LAZY, + NULL, ("system error: %s", strerror (errno))); return FALSE; } diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index efd4616..d9a2155 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -28,6 +28,7 @@ #include "gstscheduler.h" #include "gstevent.h" #include "gstinfo.h" +#include "gsterror.h" static GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS ( "Queue", @@ -561,10 +562,10 @@ restart: if (!queue->may_deadlock) { g_mutex_unlock (queue->qlock); gst_data_unref (data); - gst_element_error (GST_ELEMENT (queue), - "deadlock found, source pad elements are shut down"); + gst_element_error (queue, CORE, THREAD, NULL, + ("deadlock found, shutting down source pad elements")); /* we don't go to out_unref here, since we want to - * unref the buffer *before* calling gst_element_error */ + * unref the buffer *before* calling GST_ELEMENT_ERROR */ return; } else { GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue, @@ -677,8 +678,8 @@ restart: /* this means the other end is shut down */ if (!queue->may_deadlock) { g_mutex_unlock (queue->qlock); - gst_element_error (GST_ELEMENT (queue), - "deadlock found, sink pad elements are shut down"); + gst_element_error (queue, CORE, THREAD, NULL, + ("deadlock found, shutting down sink pad elements")); goto restart; } else { GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue, diff --git a/plugins/elements/gsttypefind.c b/plugins/elements/gsttypefind.c index 1d92c99..eb7647a 100644 --- a/plugins/elements/gsttypefind.c +++ b/plugins/elements/gsttypefind.c @@ -44,6 +44,7 @@ #include #include +#include GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug); #define GST_CAT_DEFAULT gst_type_find_element_debug @@ -556,7 +557,8 @@ gst_type_find_element_chain (GstPad *pad, GstData *data) if (typefind->caps) { stop_typefinding (typefind); } else if (typefind->possibilities == NULL) { - gst_element_error (GST_ELEMENT (typefind), "media type could not be detected"); + gst_element_error (typefind, STREAM, TYPE_NOT_FOUND, + NULL, NULL); } else { /* set up typefind element for next iteration */ typefind->possibilities = g_list_sort (typefind->possibilities, compare_type_find_entry); diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 1d92c99..eb7647a 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -44,6 +44,7 @@ #include #include +#include GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug); #define GST_CAT_DEFAULT gst_type_find_element_debug @@ -556,7 +557,8 @@ gst_type_find_element_chain (GstPad *pad, GstData *data) if (typefind->caps) { stop_typefinding (typefind); } else if (typefind->possibilities == NULL) { - gst_element_error (GST_ELEMENT (typefind), "media type could not be detected"); + gst_element_error (typefind, STREAM, TYPE_NOT_FOUND, + NULL, NULL); } else { /* set up typefind element for next iteration */ typefind->possibilities = g_list_sort (typefind->possibilities, compare_type_find_entry); diff --git a/po/POTFILES.in b/po/POTFILES.in index 1637f6b..a32f742 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,7 +1,14 @@ # Files from the GStreamer distribution which have already been # marked to allow runtime translations of messages gst/gst.c +gst/gsterror.c gst/gsttag.c +gst/elements/gstfakesink.c +gst/elements/gstfilesink.c +gst/elements/gstfilesrc.c +gst/elements/gstidentity.c +gst/elements/gstmultidisksrc.c +gst/elements/gstpipefilter.c gst/elements/gsttypefindelement.c gst/parse/grammar.y tools/gst-launch.c diff --git a/po/fr.po b/po/fr.po index 6e410ee..f104e7d 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: GStreamer\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2004-01-13 17:56+0100\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" +"POT-Creation-Date: 2004-01-14 12:48+0100\n" "PO-Revision-Date: 2004-01-13 16:52+0100\n" "Last-Translator: Julien Moutte \n" "Language-Team: French \n" @@ -27,8 +27,8 @@ msgstr "Rendre tout les avertissements bloquants" msgid "" "Default debug level from 1 (only error) to 5 (anything) or 0 for no output" msgstr "" -"Niveau de deboguage par defaut de 1 (que les erreurs) a 5 (tout) ou 0 " -"pour n'avoir aucun affichage" +"Niveau de deboguage par defaut de 1 (que les erreurs) a 5 (tout) ou 0 pour " +"n'avoir aucun affichage" #: gst/gst.c:121 msgid "LEVEL" @@ -40,8 +40,8 @@ msgid "" "the individual categories.\n" "Example: GST_AUTOPLUG:5,GST_ELEMENT_*:3" msgstr "" -"Liste séparée par des virgules de paires nom_catégorie:niveau definissant des " -"niveaux spécifiques pour chaque catégorie.\n" +"Liste séparée par des virgules de paires nom_catégorie:niveau definissant " +"des niveaux spécifiques pour chaque catégorie.\n" "Exemple: GST_AUTOPLUG:5,GST_ELEMENT_*:3" #: gst/gst.c:122 @@ -85,8 +85,8 @@ msgid "" "Comma-separated list of plugins to preload in addition to the list stored in " "env variable GST_PLUGIN_PATH" msgstr "" -"Liste séparée par des virgules de plugins a precharger en plus de la " -"liste contenue dans la variable d'environnement GST_PLUGIN_PATH" +"Liste séparée par des virgules de plugins a precharger en plus de la liste " +"contenue dans la variable d'environnement GST_PLUGIN_PATH" #: gst/gst.c:130 msgid "PLUGINS" @@ -118,6 +118,24 @@ msgstr "Registre a utiliser" msgid "REGISTRY" msgstr "REGISTRE" +#: gst/gsterror.c:43 +msgid "Resource not found." +msgstr "" + +#: gst/gsterror.c:44 +msgid "" +"GStreamer developers were too lazy to assign an error code to this error. " +"Please kick them." +msgstr "" + +#: gst/gsterror.c:56 +msgid "Failed to change state" +msgstr "Echoué a changer d'état" + +#: gst/gsterror.c:68 +msgid "Could not determine type of stream" +msgstr "Echoué a déterminer le type du flux" + #: gst/gsttag.c:61 msgid "title" msgstr "titre" @@ -294,19 +312,58 @@ msgstr "bitrate maximum en bits par seconde" msgid ", " msgstr ", " -#: gst/elements/gsttypefindelement.c:152 +#: gst/elements/gstfilesink.c:237 gst/elements/gstfilesrc.c:729 +msgid "No filename specified" +msgstr "" + +#: gst/elements/gstfilesink.c:244 +#, c-format +msgid "Could not open file \"%s\" for writing" +msgstr "" + +#: gst/elements/gstfilesink.c:264 +#, c-format +msgid "Error closing file \"%s\"" +msgstr "" + +#: gst/elements/gstfilesink.c:331 gst/elements/gstfilesink.c:363 +#: gst/elements/gstfilesink.c:415 +#, c-format +msgid "Error while writing to file \"%s\"" +msgstr "" + +#: gst/elements/gstfilesrc.c:737 gst/elements/gstfilesrc.c:752 +#, c-format +msgid "File \"%s\" does not exist" +msgstr "" + +#: gst/elements/gstfilesrc.c:755 gst/elements/gstmultidisksrc.c:244 +#, c-format +msgid "Could not open file \"%s\" for reading" +msgstr "" + +#: gst/elements/gstfilesrc.c:766 +#, c-format +msgid "File \"%s\" isn't a regular file" +msgstr "" + +#: gst/elements/gstidentity.c:170 +msgid "Failed after iterations as requested" +msgstr "" + +#: gst/elements/gsttypefindelement.c:153 msgid "caps" msgstr "capacités" -#: gst/elements/gsttypefindelement.c:152 +#: gst/elements/gsttypefindelement.c:153 msgid "detected capabilities in stream" msgstr "capacités detectées dans le flux" -#: gst/elements/gsttypefindelement.c:155 +#: gst/elements/gsttypefindelement.c:156 msgid "minimum" msgstr "minimum" -#: gst/elements/gsttypefindelement.c:158 +#: gst/elements/gsttypefindelement.c:159 msgid "maximum" msgstr "maximum" @@ -427,7 +484,6 @@ msgid "ERROR: no toplevel pipeline element in file '%s'.\n" msgstr "ERREUR: pas d'element tube de plus haut niveau dans le fichier '%s'.\n" #: tools/gst-launch.c:99 -#, c-format msgid "WARNING: only one toplevel element is supported at this time." msgstr "" "AVERTISSEMENT: actuellement seul un element tube de plus haut niveau est " @@ -436,8 +492,9 @@ msgstr "" #: tools/gst-launch.c:109 #, c-format msgid "ERROR: could not parse command line argument %d: %s.\n" -msgstr "ERREUR: impossible d'interpreter l'argument de la ligne de" -" commande numero %d: %s.\n" +msgstr "" +"ERREUR: impossible d'interpreter l'argument de la ligne de commande numero %" +"d: %s.\n" #: tools/gst-launch.c:119 #, c-format @@ -449,74 +506,83 @@ msgstr "AVERTISSEMENT: l'element nommé '%s' est introuvable.\n" msgid "FOUND TAG : found by element \"%s\".\n" msgstr "TAG DECOUVERT : decouvert par l'element \"%s\".\n" -#: tools/gst-launch.c:331 +#: tools/gst-launch.c:263 +#, fuzzy, c-format +msgid "ERROR: from element %s: %s.\n" +msgstr "" +"ERREUR: impossible d'interpreter l'argument de la ligne de commande numero %" +"d: %s.\n" + +#: tools/gst-launch.c:265 +#, c-format +msgid "" +"Additional debug info:\n" +"%s\n" +msgstr "" + +#: tools/gst-launch.c:340 msgid "Output tags (also known as metadata)" msgstr "tags de sortie (aussi connus sous le nom de metadata)" -#: tools/gst-launch.c:333 +#: tools/gst-launch.c:342 msgid "Output status information and property notifications" msgstr "" "Afficher des informations sur le status et les notifications de proprietés" -#: tools/gst-launch.c:335 +#: tools/gst-launch.c:344 msgid "Do not output status information of TYPE" msgstr "Ne pas afficher d'informations sur les status de TYPE" -#: tools/gst-launch.c:335 +#: tools/gst-launch.c:344 msgid "TYPE1,TYPE2,..." msgstr "TYPE1,TYPE2,..." -#: tools/gst-launch.c:338 +#: tools/gst-launch.c:347 msgid "Save xml representation of pipeline to FILE and exit" msgstr "Sauvegarder la representation xml du tube dans FICHIER et quitter" -#: tools/gst-launch.c:338 +#: tools/gst-launch.c:347 msgid "FILE" msgstr "FICHIER" -#: tools/gst-launch.c:341 +#: tools/gst-launch.c:350 msgid "Do not install a fault handler" msgstr "Ne pas installer un gestionaire de dysfonctionement" -#: tools/gst-launch.c:343 +#: tools/gst-launch.c:352 msgid "Print alloc trace (if enabled at compile time)" msgstr "Imprimer les traces d'allocations (si activées lors de la compilation)" -#: tools/gst-launch.c:345 +#: tools/gst-launch.c:354 msgid "Number of times to iterate pipeline" msgstr "Nombres d'iterations du tube a accomplir" -#: tools/gst-launch.c:410 +#: tools/gst-launch.c:419 #, c-format msgid "ERROR: pipeline could not be constructed: %s.\n" msgstr "ERREUR: le tube n'a pas pu etre construit: %s.\n" -#: tools/gst-launch.c:414 -#, c-format +#: tools/gst-launch.c:423 msgid "ERROR: pipeline could not be constructed.\n" msgstr "ERREUR: le tube n'a pas pu etre construit.\n" -#: tools/gst-launch.c:418 +#: tools/gst-launch.c:427 #, c-format msgid "WARNING: erroneous pipeline: %s\n" msgstr "AVERTISSEMENT: tube erroné: %s\n" -#: tools/gst-launch.c:419 -#, c-format +#: tools/gst-launch.c:428 msgid " Trying to run anyway.\n" msgstr " Tentative d'execution malgrè tout.\n" -#: tools/gst-launch.c:443 -#, c-format +#: tools/gst-launch.c:453 msgid "ERROR: the 'pipeline' element wasn't found.\n" msgstr "ERREUR: l'element 'tube' est introuvable.\n" -#: tools/gst-launch.c:450 -#, c-format +#: tools/gst-launch.c:460 msgid "RUNNING pipeline ...\n" msgstr "EXECUTION du tube en cours ...\n" -#: tools/gst-launch.c:452 -#, c-format +#: tools/gst-launch.c:462 msgid "ERROR: pipeline doesn't want to play.\n" msgstr "ERREUR: le tube refuse de s'executer.\n" diff --git a/po/nl.po b/po/nl.po index 383ef78..3e5c612 100644 --- a/po/nl.po +++ b/po/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: GStreamer\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2004-01-13 15:14+0100\n" +"POT-Creation-Date: 2004-01-14 12:48+0100\n" "PO-Revision-Date: 2004-01-13 12:03+0100\n" "Last-Translator: Thomas Vander Stichele \n" "Language-Team: Dutch \n" @@ -117,6 +117,26 @@ msgstr "Register om te gebruiken" msgid "REGISTRY" msgstr "REGISTER" +#: gst/gsterror.c:43 +msgid "Resource not found." +msgstr "Bron niet gevonden." + +#: gst/gsterror.c:44 +msgid "" +"GStreamer developers were too lazy to assign an error code to this error. " +"Please kick them." +msgstr "" +"GStreamer ontwikkelaars waren te lui om een foutcode te geven aan deze fout. " +"Gelieve hen te schoppen." + +#: gst/gsterror.c:56 +msgid "Failed to change state" +msgstr "" + +#: gst/gsterror.c:68 +msgid "Could not determine type of stream" +msgstr "" + #: gst/gsttag.c:61 msgid "title" msgstr "titel" @@ -294,43 +314,82 @@ msgstr "maximum bitsnelheid in bits per seconde" msgid ", " msgstr ", " -#: gst/elements/gsttypefindelement.c:152 +#: gst/elements/gstfilesink.c:237 gst/elements/gstfilesrc.c:729 +msgid "No filename specified" +msgstr "Geen bestandsnaam gegeven" + +#: gst/elements/gstfilesink.c:244 +#, c-format +msgid "Could not open file \"%s\" for writing" +msgstr "Kon bestand \"%s\" niet openen om te schrijven" + +#: gst/elements/gstfilesink.c:264 +#, c-format +msgid "Error closing file \"%s\"" +msgstr "Fout bij het sluiten van bestand \"%s\"" + +#: gst/elements/gstfilesink.c:331 gst/elements/gstfilesink.c:363 +#: gst/elements/gstfilesink.c:415 +#, c-format +msgid "Error while writing to file \"%s\"" +msgstr "Fout bij het schrijven naar bestand \"%s\"" + +#: gst/elements/gstfilesrc.c:737 gst/elements/gstfilesrc.c:752 +#, c-format +msgid "File \"%s\" does not exist" +msgstr "Bestand \"%s\" bestaat niet" + +#: gst/elements/gstfilesrc.c:755 gst/elements/gstmultidisksrc.c:244 +#, c-format +msgid "Could not open file \"%s\" for reading" +msgstr "Kon bestand \"%s\" niet openen om te lezen lezen" + +#: gst/elements/gstfilesrc.c:766 +#, c-format +msgid "File \"%s\" isn't a regular file" +msgstr "Bestand \"%s\" is geen gewoon bestand" + +#: gst/elements/gstidentity.c:170 +msgid "Failed after iterations as requested" +msgstr "" + +#: gst/elements/gsttypefindelement.c:153 msgid "caps" msgstr "mogelijkheden" -#: gst/elements/gsttypefindelement.c:152 +#: gst/elements/gsttypefindelement.c:153 msgid "detected capabilities in stream" msgstr "gedetecteerde mogelijkheden in stroom" -#: gst/elements/gsttypefindelement.c:155 +#: gst/elements/gsttypefindelement.c:156 msgid "minimum" msgstr "minimum" -#: gst/elements/gsttypefindelement.c:158 +#: gst/elements/gsttypefindelement.c:159 msgid "maximum" msgstr "maximum" -#: gst/parse/grammar.y:164 +#: gst/parse/grammar.y:169 #, c-format msgid "specified empty bin \"%s\", not allowed" msgstr "lege ton \"%s\", niet toegelaten" -#: gst/parse/grammar.y:169 +#: gst/parse/grammar.y:174 #, c-format msgid "no bin \"%s\", skipping" msgstr "geen ton \"%s\", overgeslagen" -#: gst/parse/grammar.y:313 +#: gst/parse/grammar.y:318 #, c-format msgid "no property \"%s\" in element \"%s\"" msgstr "geen eigenschap \"%s\" in element \"%s\"" -#: gst/parse/grammar.y:322 +#: gst/parse/grammar.y:327 #, c-format msgid "could not set property \"%s\" in element \"%s\" to \"%s\"" msgstr "kon eigenschap \"%s\" in element \"%s\" niet op \"%s\" instellen" -#: gst/parse/grammar.y:327 +#: gst/parse/grammar.y:332 #, c-format msgid "" "could not convert \"%s\" so that it fits property \"%s\" in element \"%s\"" @@ -338,51 +397,51 @@ msgstr "" "kon \"%s\" niet omzetten zodat het in eigenschap \"%s\" in element \"%s\" " "past" -#: gst/parse/grammar.y:506 +#: gst/parse/grammar.y:511 #, c-format msgid "could not link %s to %s" msgstr "kon %s niet verbinden met %s" -#: gst/parse/grammar.y:551 +#: gst/parse/grammar.y:556 #, c-format msgid "no element \"%s\"" msgstr "geen element \"%s\"" -#: gst/parse/grammar.y:602 +#: gst/parse/grammar.y:607 #, c-format msgid "could not parse caps \"%s\"" msgstr "kon mogelijkheden \"%s\" niet verwerken" -#: gst/parse/grammar.y:624 gst/parse/grammar.y:678 gst/parse/grammar.y:694 -#: gst/parse/grammar.y:752 +#: gst/parse/grammar.y:629 gst/parse/grammar.y:683 gst/parse/grammar.y:699 +#: gst/parse/grammar.y:757 msgid "link without source element" msgstr "verbinding zonder bronelement" -#: gst/parse/grammar.y:630 gst/parse/grammar.y:675 gst/parse/grammar.y:761 +#: gst/parse/grammar.y:635 gst/parse/grammar.y:680 gst/parse/grammar.y:766 msgid "link without sink element" msgstr "verbinding zonder doelelement" -#: gst/parse/grammar.y:712 +#: gst/parse/grammar.y:717 #, c-format msgid "no source element for URI \"%s\"" msgstr "geen bronelement voor URI \"%s\"" -#: gst/parse/grammar.y:722 +#: gst/parse/grammar.y:727 #, c-format msgid "no element to link URI \"%s\" to" msgstr "geen element om URI \"%s\" mee te verbinden" -#: gst/parse/grammar.y:730 +#: gst/parse/grammar.y:735 #, c-format msgid "no sink element for URI \"%s\"" msgstr "geen doelelement voor URI \"%s\"" -#: gst/parse/grammar.y:734 +#: gst/parse/grammar.y:739 #, c-format msgid "could not link sink element for URI \"%s\"" msgstr "kon doelelement niet verbinden voor URI \"%s\"" -#: gst/parse/grammar.y:746 +#: gst/parse/grammar.y:751 msgid "empty pipeline not allowed" msgstr "lege pijplijn niet toegelaten" @@ -432,6 +491,7 @@ msgstr "" "moment." #: tools/gst-launch.c:109 +#, c-format msgid "ERROR: could not parse command line argument %d: %s.\n" msgstr "FOUT: versta argument %d op commandoregel niet: %s.\n" @@ -445,68 +505,82 @@ msgstr "WAARSCHUWING: element met naam '%s' niet gevonden.\n" msgid "FOUND TAG : found by element \"%s\".\n" msgstr "TAG GEVONDEN : gevonden door element \"%s\".\n" -#: tools/gst-launch.c:331 +#: tools/gst-launch.c:263 +#, c-format +msgid "ERROR: from element %s: %s.\n" +msgstr "FOUT: van element %s: %s.\n" + +#: tools/gst-launch.c:265 +#, c-format +msgid "" +"Additional debug info:\n" +"%s\n" +msgstr "" +"Extra debug-informatie:\n" +"%s\n" + +#: tools/gst-launch.c:340 msgid "Output tags (also known as metadata)" msgstr "Druk tags (ofte metadata) af" -#: tools/gst-launch.c:333 +#: tools/gst-launch.c:342 msgid "Output status information and property notifications" msgstr "Druk statusinformatie en eigenschapsnotificatie af" -#: tools/gst-launch.c:335 +#: tools/gst-launch.c:344 msgid "Do not output status information of TYPE" msgstr "Druk statusinformatie van type TYPE niet af" -#: tools/gst-launch.c:335 +#: tools/gst-launch.c:344 msgid "TYPE1,TYPE2,..." msgstr "TYPE1,TYPE2,..." -#: tools/gst-launch.c:338 +#: tools/gst-launch.c:347 msgid "Save xml representation of pipeline to FILE and exit" msgstr "Bewaar xml-representatie van pijplijn in BESTAND en stop" -#: tools/gst-launch.c:338 +#: tools/gst-launch.c:347 msgid "FILE" msgstr "BESTAND" -#: tools/gst-launch.c:341 +#: tools/gst-launch.c:350 msgid "Do not install a fault handler" msgstr "Installeer geen foutafhandelaar" -#: tools/gst-launch.c:343 +#: tools/gst-launch.c:352 msgid "Print alloc trace (if enabled at compile time)" msgstr "Druk allocatiespoor af indien aangezet tijdens compileren" -#: tools/gst-launch.c:345 +#: tools/gst-launch.c:354 msgid "Number of times to iterate pipeline" msgstr "Aantal keren om de pijplijn te herhalen" -#: tools/gst-launch.c:410 +#: tools/gst-launch.c:419 #, c-format msgid "ERROR: pipeline could not be constructed: %s.\n" msgstr "FOUT: pijplijn kon niet gemaakt worden: %s.\n" -#: tools/gst-launch.c:414 +#: tools/gst-launch.c:423 msgid "ERROR: pipeline could not be constructed.\n" msgstr "FOUT: pijplijn kon niet gemaakt worden.\n" -#: tools/gst-launch.c:418 +#: tools/gst-launch.c:427 #, c-format msgid "WARNING: erroneous pipeline: %s\n" msgstr "WAARSCHUWING: foutieve pijplijn: %s\n" -#: tools/gst-launch.c:419 +#: tools/gst-launch.c:428 msgid " Trying to run anyway.\n" msgstr " Probeer toch uit te voeren.\n" -#: tools/gst-launch.c:443 +#: tools/gst-launch.c:453 msgid "ERROR: the 'pipeline' element wasn't found.\n" msgstr "FOUT: het 'pijplijn' element werd niet gevonden.\n" -#: tools/gst-launch.c:450 +#: tools/gst-launch.c:460 msgid "RUNNING pipeline ...\n" msgstr "BEZIG met pijplijn ...\n" -#: tools/gst-launch.c:452 +#: tools/gst-launch.c:462 msgid "ERROR: pipeline doesn't want to play.\n" msgstr "FOUT: pijplijn wil niet spelen.\n" -- 2.7.4