[farsight2/master] Make load_codecs return the list of codecs (to isolate this module somehow)

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


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

diff --git a/gst/fsrtpconference/fs-rtp-discover-codecs.c b/gst/fsrtpconference/fs-rtp-discover-codecs.c
index 0a8776f..592e0e3 100644
--- a/gst/fsrtpconference/fs-rtp-discover-codecs.c
+++ b/gst/fsrtpconference/fs-rtp-discover-codecs.c
@@ -208,9 +208,9 @@ codec_cap_list_free (GList *list)
  * network  -> rtp depayloader -> N* -> output (soundcard)
  * media_type defines if we want audio or video codecs
  *
- * Returns : TRUE if load_codecs suceeded, FALSE otherwsie
+ * Returns : a #GList of #CodecBlueprint or NULL on error
  */
-gboolean
+GList *
 load_codecs (FsMediaType media_type, GError **error)
 {
   GstCaps *caps;
@@ -223,7 +223,7 @@ load_codecs (FsMediaType media_type, GError **error)
 
   /* if already computed just return list */
   if (codecs_lists_ref[media_type] > 1)
-    return TRUE;
+    return list_codec_blueprints[media_type];
 
 
 #if 0
@@ -236,7 +236,7 @@ load_codecs (FsMediaType media_type, GError **error)
   list_codec_blueprints[media_type] = load_codecs_cache(media_type, NULL);
   if (list_codec_blueprints[media_type]) {
     g_debug("Loaded codec blueprints from cache file");
-    return TRUE;
+    return list_codec_blueprints[media_type];
   }
 
   /* caps used to find the payloaders and depayloaders based on media type */
@@ -255,7 +255,7 @@ load_codecs (FsMediaType media_type, GError **error)
     g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
       "Invalid media type given to load_codecs");
     codecs_lists_ref[media_type]--;
-    return FALSE;
+    return NULL;
   }
 
   recv_list = detect_recv_codecs (caps);
@@ -270,7 +270,7 @@ load_codecs (FsMediaType media_type, GError **error)
       "No codecs for media type %s detected",
       fs_media_type_to_string (media_type));
 
-    ret = FALSE;
+    list_codec_blueprints[media_type] = NULL;
     goto out;
   }
 
@@ -285,7 +285,7 @@ load_codecs (FsMediaType media_type, GError **error)
   if (send_list)
     codec_cap_list_free (send_list);
 
-  return ret;
+  return list_codec_blueprints[media_type];;
 }
 
 static gboolean
diff --git a/gst/fsrtpconference/fs-rtp-discover-codecs.h b/gst/fsrtpconference/fs-rtp-discover-codecs.h
index ed22626..a1f44c2 100644
--- a/gst/fsrtpconference/fs-rtp-discover-codecs.h
+++ b/gst/fsrtpconference/fs-rtp-discover-codecs.h
@@ -50,7 +50,7 @@ typedef struct _CodecBlueprint
   GstElement *receive_unique_bin;
 } CodecBlueprint;
 
-gboolean load_codecs (FsMediaType media_type, GError **error);
+GList *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