2004-01-18 21:36:20 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <2003> David A. Schleef <ds@schleef.org>
|
|
|
|
*
|
|
|
|
* 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 "gst_private.h"
|
2004-05-07 02:36:28 +00:00
|
|
|
#include <gst/gst.h>
|
2004-01-18 21:36:20 +00:00
|
|
|
#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; }
|
|
|
|
|
2004-03-09 14:44:36 +00:00
|
|
|
GType
|
|
|
|
gst_g_error_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2004-03-09 14:44:36 +00:00
|
|
|
if (!type)
|
|
|
|
type = g_boxed_type_register_static ("GstGError",
|
2004-03-15 19:27:17 +00:00
|
|
|
(GBoxedCopyFunc) g_error_copy, (GBoxedFreeFunc) g_error_free);
|
2004-03-13 15:27:01 +00:00
|
|
|
return type;
|
2004-03-09 14:44:36 +00:00
|
|
|
}
|
|
|
|
|
2004-01-18 21:36:20 +00:00
|
|
|
/* initialize the dynamic table of translated core errors */
|
2004-03-13 15:27:01 +00:00
|
|
|
static gchar **
|
gst/: Aplied part of patch #157127: Cleanup of issues reported by sparse.
Original commit message from CVS:
reviewed by: Wim Taymans, Ronald Bultje.
* gst/cothreads.c: (cothread_create):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_child_state_change_func):
* gst/gstbuffer.c: (gst_buffer_span):
* gst/gstelement.c: (gst_element_get_index),
(gst_element_get_event_masks), (gst_element_get_query_types),
(gst_element_get_formats):
* gst/gsterror.c: (_gst_core_errors_init),
(_gst_library_errors_init), (_gst_resource_errors_init),
(_gst_stream_errors_init):
* gst/gstobject.c: (gst_object_default_deep_notify):
* gst/gstpad.c: (gst_pad_get_event_masks),
(gst_pad_get_internal_links_default):
* gst/gstplugin.c: (gst_plugin_register_func),
(gst_plugin_get_module):
* gst/gststructure.c: (gst_structure_get_string),
(gst_structure_get_abbrs), (gst_structure_from_abbr),
(gst_structure_to_abbr):
* gst/gstutils.c: (gst_print_element_args):
* gst/schedulers/gstoptimalscheduler.c: (add_to_group),
(setup_group_scheduler), (gst_opt_scheduler_iterate):
Aplied part of patch #157127: Cleanup of issues reported by
sparse.
Also do not try to use cothreads when there is no cothread
context yet.
2004-11-02 15:02:12 +00:00
|
|
|
_gst_core_errors_init (void)
|
2004-01-18 21:36:20 +00:00
|
|
|
{
|
|
|
|
gchar **t = NULL;
|
|
|
|
|
|
|
|
t = g_new0 (gchar *, GST_CORE_ERROR_NUM_ERRORS);
|
|
|
|
|
|
|
|
TABLE (t, CORE, FAILED,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("GStreamer encountered a general core library error."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, TOO_LAZY,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("GStreamer developers were too lazy to assign an error code "
|
2004-03-15 19:27:17 +00:00
|
|
|
"to this error. Please file a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, NOT_IMPLEMENTED,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: code not implemented. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, STATE_CHANGE,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: state change failed. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, PAD,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: pad problem. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, THREAD,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: thread problem. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, SCHEDULER,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: scheduler problem. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, NEGOTIATION,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: negotiation problem. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, EVENT,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: event problem. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, SEEK,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: seek problem. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, CAPS,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: caps problem. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, CORE, TAG,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Internal GStreamer error: tag problem. File a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize the dynamic table of translated library errors */
|
2004-03-13 15:27:01 +00:00
|
|
|
static gchar **
|
gst/: Aplied part of patch #157127: Cleanup of issues reported by sparse.
Original commit message from CVS:
reviewed by: Wim Taymans, Ronald Bultje.
* gst/cothreads.c: (cothread_create):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_child_state_change_func):
* gst/gstbuffer.c: (gst_buffer_span):
* gst/gstelement.c: (gst_element_get_index),
(gst_element_get_event_masks), (gst_element_get_query_types),
(gst_element_get_formats):
* gst/gsterror.c: (_gst_core_errors_init),
(_gst_library_errors_init), (_gst_resource_errors_init),
(_gst_stream_errors_init):
* gst/gstobject.c: (gst_object_default_deep_notify):
* gst/gstpad.c: (gst_pad_get_event_masks),
(gst_pad_get_internal_links_default):
* gst/gstplugin.c: (gst_plugin_register_func),
(gst_plugin_get_module):
* gst/gststructure.c: (gst_structure_get_string),
(gst_structure_get_abbrs), (gst_structure_from_abbr),
(gst_structure_to_abbr):
* gst/gstutils.c: (gst_print_element_args):
* gst/schedulers/gstoptimalscheduler.c: (add_to_group),
(setup_group_scheduler), (gst_opt_scheduler_iterate):
Aplied part of patch #157127: Cleanup of issues reported by
sparse.
Also do not try to use cothreads when there is no cothread
context yet.
2004-11-02 15:02:12 +00:00
|
|
|
_gst_library_errors_init (void)
|
2004-01-18 21:36:20 +00:00
|
|
|
{
|
|
|
|
gchar **t = NULL;
|
|
|
|
|
|
|
|
t = g_new0 (gchar *, GST_LIBRARY_ERROR_NUM_ERRORS);
|
|
|
|
|
|
|
|
TABLE (t, LIBRARY, FAILED,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("GStreamer encountered a general supporting library error."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, LIBRARY, TOO_LAZY,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("GStreamer developers were too lazy to assign an error code "
|
2004-03-15 19:27:17 +00:00
|
|
|
"to this error. Please file a bug."));
|
2004-03-13 15:27:01 +00:00
|
|
|
TABLE (t, LIBRARY, INIT, N_("Could not initialize supporting library."));
|
|
|
|
TABLE (t, LIBRARY, SHUTDOWN, N_("Could not close supporting library."));
|
2005-03-12 23:25:00 +00:00
|
|
|
TABLE (t, LIBRARY, SETTINGS, N_("Could not set settings."));
|
|
|
|
TABLE (t, LIBRARY, ENCODE, N_("Failed to encode image."));
|
2004-01-18 21:36:20 +00:00
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize the dynamic table of translated resource errors */
|
2004-03-13 15:27:01 +00:00
|
|
|
static gchar **
|
gst/: Aplied part of patch #157127: Cleanup of issues reported by sparse.
Original commit message from CVS:
reviewed by: Wim Taymans, Ronald Bultje.
* gst/cothreads.c: (cothread_create):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_child_state_change_func):
* gst/gstbuffer.c: (gst_buffer_span):
* gst/gstelement.c: (gst_element_get_index),
(gst_element_get_event_masks), (gst_element_get_query_types),
(gst_element_get_formats):
* gst/gsterror.c: (_gst_core_errors_init),
(_gst_library_errors_init), (_gst_resource_errors_init),
(_gst_stream_errors_init):
* gst/gstobject.c: (gst_object_default_deep_notify):
* gst/gstpad.c: (gst_pad_get_event_masks),
(gst_pad_get_internal_links_default):
* gst/gstplugin.c: (gst_plugin_register_func),
(gst_plugin_get_module):
* gst/gststructure.c: (gst_structure_get_string),
(gst_structure_get_abbrs), (gst_structure_from_abbr),
(gst_structure_to_abbr):
* gst/gstutils.c: (gst_print_element_args):
* gst/schedulers/gstoptimalscheduler.c: (add_to_group),
(setup_group_scheduler), (gst_opt_scheduler_iterate):
Aplied part of patch #157127: Cleanup of issues reported by
sparse.
Also do not try to use cothreads when there is no cothread
context yet.
2004-11-02 15:02:12 +00:00
|
|
|
_gst_resource_errors_init (void)
|
2004-01-18 21:36:20 +00:00
|
|
|
{
|
|
|
|
gchar **t = NULL;
|
|
|
|
|
|
|
|
t = g_new0 (gchar *, GST_RESOURCE_ERROR_NUM_ERRORS);
|
|
|
|
|
|
|
|
TABLE (t, RESOURCE, FAILED,
|
2005-01-21 17:52:50 +00:00
|
|
|
N_("GStreamer encountered a general resource error."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, RESOURCE, TOO_LAZY,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("GStreamer developers were too lazy to assign an error code "
|
2004-03-15 19:27:17 +00:00
|
|
|
"to this error. Please file a bug."));
|
2004-03-13 15:27:01 +00:00
|
|
|
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."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, RESOURCE, OPEN_READ_WRITE,
|
2004-03-13 15:27:01 +00:00
|
|
|
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."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, RESOURCE, SETTINGS,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Could not get/set settings from/on resource."));
|
2004-01-18 21:36:20 +00:00
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize the dynamic table of translated stream errors */
|
2004-03-13 15:27:01 +00:00
|
|
|
static gchar **
|
gst/: Aplied part of patch #157127: Cleanup of issues reported by sparse.
Original commit message from CVS:
reviewed by: Wim Taymans, Ronald Bultje.
* gst/cothreads.c: (cothread_create):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_child_state_change_func):
* gst/gstbuffer.c: (gst_buffer_span):
* gst/gstelement.c: (gst_element_get_index),
(gst_element_get_event_masks), (gst_element_get_query_types),
(gst_element_get_formats):
* gst/gsterror.c: (_gst_core_errors_init),
(_gst_library_errors_init), (_gst_resource_errors_init),
(_gst_stream_errors_init):
* gst/gstobject.c: (gst_object_default_deep_notify):
* gst/gstpad.c: (gst_pad_get_event_masks),
(gst_pad_get_internal_links_default):
* gst/gstplugin.c: (gst_plugin_register_func),
(gst_plugin_get_module):
* gst/gststructure.c: (gst_structure_get_string),
(gst_structure_get_abbrs), (gst_structure_from_abbr),
(gst_structure_to_abbr):
* gst/gstutils.c: (gst_print_element_args):
* gst/schedulers/gstoptimalscheduler.c: (add_to_group),
(setup_group_scheduler), (gst_opt_scheduler_iterate):
Aplied part of patch #157127: Cleanup of issues reported by
sparse.
Also do not try to use cothreads when there is no cothread
context yet.
2004-11-02 15:02:12 +00:00
|
|
|
_gst_stream_errors_init (void)
|
2004-01-18 21:36:20 +00:00
|
|
|
{
|
|
|
|
gchar **t = NULL;
|
|
|
|
|
|
|
|
t = g_new0 (gchar *, GST_STREAM_ERROR_NUM_ERRORS);
|
|
|
|
|
|
|
|
TABLE (t, STREAM, FAILED,
|
2005-01-21 17:52:50 +00:00
|
|
|
N_("GStreamer encountered a general stream error."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, STREAM, TOO_LAZY,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("GStreamer developers were too lazy to assign an error code "
|
2004-03-15 19:27:17 +00:00
|
|
|
"to this error. Please file a bug."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, STREAM, NOT_IMPLEMENTED,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("Element doesn't implement handling of this stream. "
|
2004-03-15 19:27:17 +00:00
|
|
|
"Please file a bug."));
|
2004-03-13 15:27:01 +00:00
|
|
|
TABLE (t, STREAM, TYPE_NOT_FOUND, N_("Could not determine type of stream."));
|
2004-01-18 21:36:20 +00:00
|
|
|
TABLE (t, STREAM, WRONG_TYPE,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("The stream is of a different type than handled by this element."));
|
2004-02-03 11:23:59 +00:00
|
|
|
TABLE (t, STREAM, CODEC_NOT_FOUND,
|
2004-03-13 15:27:01 +00:00
|
|
|
N_("There is no codec present that can handle the stream's type."));
|
|
|
|
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."));
|
2004-01-18 21:36:20 +00:00
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
QUARK_FUNC (core)
|
2004-03-13 15:27:01 +00:00
|
|
|
QUARK_FUNC (library)
|
|
|
|
QUARK_FUNC (resource)
|
|
|
|
QUARK_FUNC (stream)
|
2004-01-18 21:36:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
gchar *gst_error_get_message (GQuark domain, gint code)
|
2004-01-18 21:36:20 +00:00
|
|
|
{
|
|
|
|
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 ();
|
|
|
|
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
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 {
|
2004-01-18 21:36:20 +00:00
|
|
|
g_warning ("No error messages for domain %s", g_quark_to_string (domain));
|
2004-03-13 15:27:01 +00:00
|
|
|
return g_strdup_printf (_("No error message for domain %s."),
|
2004-03-15 19:27:17 +00:00
|
|
|
g_quark_to_string (domain));
|
2004-01-18 21:36:20 +00:00
|
|
|
}
|
|
|
|
if (message)
|
|
|
|
return g_strdup (_(message));
|
|
|
|
else
|
2004-03-13 15:27:01 +00:00
|
|
|
return
|
2004-03-15 19:27:17 +00:00
|
|
|
g_strdup_printf (_
|
|
|
|
("No standard error message for domain %s and code %d."),
|
|
|
|
g_quark_to_string (domain), code);
|
2004-01-18 21:36:20 +00:00
|
|
|
}
|