[farsight2/master] Make load_codecs() return a GError

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:19:45 PST 2008


---
 gst/fsrtpconference/fs-rtp-discover-codecs.c |   12 ++++++++----
 gst/fsrtpconference/fs-rtp-discover-codecs.h |    2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-discover-codecs.c b/gst/fsrtpconference/fs-rtp-discover-codecs.c
index 03951ba..035064f 100644
--- a/gst/fsrtpconference/fs-rtp-discover-codecs.c
+++ b/gst/fsrtpconference/fs-rtp-discover-codecs.c
@@ -32,6 +32,8 @@
 
 #include "fs-rtp-codec-cache.h"
 
+#include <gst/farsight/fs-conference-iface.h>
+
 #include <string.h>
 
 
@@ -200,7 +202,7 @@ codec_cap_list_free (GList *list)
  * Returns : TRUE if load_codecs suceeded, FALSE otherwsie
  */
 gboolean
-load_codecs (FsMediaType media_type)
+load_codecs (FsMediaType media_type, GError **error)
 {
   GstCaps *caps;
   GList *recv_list = NULL;
@@ -241,7 +243,8 @@ load_codecs (FsMediaType media_type)
   }
   else
   {
-    g_warning ("Invalid media type given to load_codecs");
+    g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
+      "Invalid media type given to load_codecs");
     codecs_lists_ref[media_type]--;
     return FALSE;
   }
@@ -254,8 +257,9 @@ load_codecs (FsMediaType media_type)
   if (!recv_list && !send_list)
   {
     codecs_lists_ref[media_type]--;
-    g_warning ("No codecs for media type %s detected",
-        fs_media_type_to_string (media_type));
+    g_set_error (error, FS_ERROR, FS_ERROR_INTERNAL,
+      "No codecs for media type %s detected",
+      fs_media_type_to_string (media_type));
 
     ret = FALSE;
     goto out;
diff --git a/gst/fsrtpconference/fs-rtp-discover-codecs.h b/gst/fsrtpconference/fs-rtp-discover-codecs.h
index e8ac978..d8e2ca2 100644
--- a/gst/fsrtpconference/fs-rtp-discover-codecs.h
+++ b/gst/fsrtpconference/fs-rtp-discover-codecs.h
@@ -47,7 +47,7 @@ typedef struct _CodecBlueprint
   GstElement *receive_unique_bin;
 } CodecBlueprint;
 
-gboolean load_codecs (FsMediaType media_type);
+gboolean load_codecs (FsMediaType media_type, GError **error);
 void unload_codecs (FsMediaType media_type);
 
 void codec_blueprint_destroy (CodecBlueprint *codec_blueprint);
-- 
1.5.6.5




More information about the farsight-commits mailing list