[farsight2/master] Allow returning an error when constructing a transmitter
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:19:18 PST 2008
---
gst-libs/gst/farsight/fs-transmitter.c | 16 ++++++++++++++--
gst-libs/gst/farsight/fs-transmitter.h | 9 +++++++--
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/gst-libs/gst/farsight/fs-transmitter.c b/gst-libs/gst/farsight/fs-transmitter.c
index b58a993..1694925 100644
--- a/gst-libs/gst/farsight/fs-transmitter.c
+++ b/gst-libs/gst/farsight/fs-transmitter.c
@@ -260,6 +260,7 @@ fs_transmitter_new_stream_transmitter (FsTransmitter *transmitter,
/**
* fs_transmitter_new:
* @type: The type of transmitter to create
+ * @error: location of a #GError, or NULL if no error occured
*
* This function creates a new transmitter of the requested type.
* It will load the appropriate plugin as required.
@@ -268,10 +269,21 @@ fs_transmitter_new_stream_transmitter (FsTransmitter *transmitter,
* (or NULL if there is an error)
*/
-FsTransmitter *fs_transmitter_new (gchar *type)
+FsTransmitter *
+fs_transmitter_new (gchar *type, GError **error)
{
+ FsTransmitter *self = NULL;
+
g_return_val_if_fail (type != NULL, NULL);
- return FS_TRANSMITTER(fs_plugin_create_valist(type, "transmitter",
+ self = FS_TRANSMITTER(fs_plugin_create_valist(type, "transmitter",
NULL, NULL));
+
+ if (self->construction_error) {
+ *error = self->construction_error;
+ g_object_unref (self);
+ self = NULL;
+ }
+
+ return self;
}
diff --git a/gst-libs/gst/farsight/fs-transmitter.h b/gst-libs/gst/farsight/fs-transmitter.h
index c42ff67..5779cb3 100644
--- a/gst-libs/gst/farsight/fs-transmitter.h
+++ b/gst-libs/gst/farsight/fs-transmitter.h
@@ -83,6 +83,12 @@ struct _FsTransmitter
/*< private >*/
FsTransmitterPrivate *priv;
+
+ /* This parameter should only be set by the construction methods
+ * of the subclasses
+ */
+ GError *construction_error;
+
gpointer _padding[8];
};
@@ -92,8 +98,7 @@ FsStreamTransmitter *fs_transmitter_new_stream_transmitter (
FsTransmitter *transmitter,
FsParticipant *participant);
-
-FsTransmitter *fs_transmitter_new (gchar *type);
+FsTransmitter *fs_transmitter_new (gchar *type, GError **error);
G_END_DECLS
--
1.5.6.5
More information about the farsight-commits
mailing list