From 6a3331cc67ac0aca6f17f764602d0fce69c021d6 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 18 Mar 2013 12:41:06 -0300 Subject: [PATCH] Start categorizing GError types in GES --- docs/libs/ges-docs.sgml | 1 + docs/libs/ges-sections.txt | 10 ++++++- ges/Makefile.am | 1 + ges/ges-asset.c | 6 ++-- ges/ges-base-xml-formatter.c | 2 +- ges/ges-gerror.h | 65 ++++++++++++++++++++++++++++++++++++++++++++ ges/ges.h | 3 +- 7 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 ges/ges-gerror.h diff --git a/docs/libs/ges-docs.sgml b/docs/libs/ges-docs.sgml index 0673ffb..0b6525e 100644 --- a/docs/libs/ges-docs.sgml +++ b/docs/libs/ges-docs.sgml @@ -30,6 +30,7 @@ platform as well as Windows. It is released under the GNU Library General Public + diff --git a/docs/libs/ges-sections.txt b/docs/libs/ges-sections.txt index 7f1e4fb..6bb60d4 100644 --- a/docs/libs/ges-sections.txt +++ b/docs/libs/ges-sections.txt @@ -11,7 +11,6 @@ GES_VERSION_MINOR GES_VERSION_NANO GES_PADDING -GES_ERROR_DOMAIN GES_PADDING_LARGE GESAssetLoadingReturn @@ -23,6 +22,15 @@ GESAssetLoadingReturn
+ges-gerror +GES GErrors +GES_ASSET_ERROR +GES_FORMATTER_ERROR +GESAssetError +GESFormatterError +
+ +
ges-enums GES Enums GESTrackType diff --git a/ges/Makefile.am b/ges/Makefile.am index ba447e9..71ccb4c 100644 --- a/ges/Makefile.am +++ b/ges/Makefile.am @@ -67,6 +67,7 @@ libges_@GST_API_VERSION@include_HEADERS = \ ges-types.h \ ges.h \ ges-enums.h \ + ges-gerror.h \ ges-custom-source-clip.h \ ges-meta-container.h \ ges-simple-timeline-layer.h \ diff --git a/ges/ges-asset.c b/ges/ges-asset.c index 3aefbbb..c66aec6 100644 --- a/ges/ges-asset.c +++ b/ges/ges-asset.c @@ -171,7 +171,7 @@ _check_and_update_parameters (GType * extractable_type, const gchar * id, g_type_name (old_type)); if (error && *error == NULL) - g_set_error (error, GES_ERROR_DOMAIN, 0, + g_set_error (error, GES_ASSET_ERROR, GES_ASSET_WRONG_ID, "Wrong ID, can not find any extractable_type"); return NULL; } @@ -182,7 +182,7 @@ _check_and_update_parameters (GType * extractable_type, const gchar * id, g_free (real_id); if (error && *error == NULL) - g_set_error (error, GES_ERROR_DOMAIN, 0, "Wrong ID"); + g_set_error (error, GES_ASSET_ERROR, GES_ASSET_WRONG_ID, "Wrong ID"); return NULL; } @@ -224,7 +224,7 @@ async_initable_init_async (GAsyncInitable * initable, gint io_priority, case GES_ASSET_LOADING_ERROR: { if (error == NULL) - g_set_error (&error, GES_ERROR_DOMAIN, 1, + g_set_error (&error, GES_ASSET_ERROR, GES_ASSET_ERROR_LOADING, "Could not start loading asset"); /* FIXME Define error code */ diff --git a/ges/ges-base-xml-formatter.c b/ges/ges-base-xml-formatter.c index c692b78..a821bd2 100644 --- a/ges/ges-base-xml-formatter.c +++ b/ges/ges-base-xml-formatter.c @@ -688,7 +688,7 @@ ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self, entry = g_hash_table_lookup (priv->layers, GINT_TO_POINTER (layer_prio)); if (entry == NULL) { - g_set_error (error, GES_ERROR_DOMAIN, 0, + g_set_error (error, GES_FORMATTER_ERROR, GES_FORMATTER_WRONG_INPUT_FILE, "We got a Clip in a layer" " that does not exist, something is wrong either in the project file or" " in %s", g_type_name (G_OBJECT_TYPE (self))); diff --git a/ges/ges-gerror.h b/ges/ges-gerror.h new file mode 100644 index 0000000..4052a53 --- /dev/null +++ b/ges/ges-gerror.h @@ -0,0 +1,65 @@ +/* GStreamer Editing Services + * Copyright (C) 2013 Thibault Saunier + * + * 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., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +/** + * SECTION: ges-gerror + * @short_description: GError — Categorized error messages + */ + +#ifndef __GES_ERROR_H__ +#define __GES_ERROR_H__ + +G_BEGIN_DECLS + +/** + * GES_ASSET_ERROR: + * + * An error happend using an asset + */ +#define GES_ASSET_ERROR g_quark_from_static_string("GES_ASSET_ERROR") + +/** + * GES_FORMATTER_ERROR: + * + * An error happend using a formatter + */ +#define GES_FORMATTER_ERROR g_quark_from_static_string("GES_FORMATTER_ERROR") + +/** + * GESAssetError: + * @GES_ASSET_WRONG_ID: The ID passed is malformed + * @GES_ASSET_ERROR_LOADING: An error happened while loading the asset + */ +typedef enum +{ + GES_ASSET_WRONG_ID, + GES_ASSET_ERROR_LOADING +} GESAssetError; + +/** + * GESFormatterError: + * @GES_FORMATTER_WRONG_INPUT_FILE: The formatted files was malformed + */ +typedef enum +{ + GES_FORMATTER_WRONG_INPUT_FILE, +} GESFormatterError; + +G_END_DECLS +#endif /* __GES_ERROR_H__ */ diff --git a/ges/ges.h b/ges/ges.h index 0a6b1b4..88399a4 100644 --- a/ges/ges.h +++ b/ges/ges.h @@ -75,6 +75,7 @@ #include #include #include +#include G_BEGIN_DECLS @@ -88,8 +89,6 @@ gboolean ges_init (void); void ges_version (guint * major, guint * minor, guint * micro, guint * nano); -#define GES_ERROR_DOMAIN g_quark_from_static_string("GES") - G_END_DECLS #endif /* __GES_H__ */ -- 2.7.4