[farsight2/master] Add method to find the GType of stream transmitter that will be created from a specific transmitters, so the bindings can find which types the GValues should be

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


---
 gst-libs/gst/farsight/fs-session.c          |    2 +-
 gst-libs/gst/farsight/fs-session.h          |    4 +-
 gst-libs/gst/farsight/fs-transmitter.c      |   30 ++++++++++++++++++++++++++-
 gst-libs/gst/farsight/fs-transmitter.h      |    8 ++++++-
 gst/fsrtpconference/fs-rtp-session.c        |   19 +++++++++-------
 transmitters/rawudp/fs-rawudp-transmitter.c |   12 ++++++++++
 6 files changed, 62 insertions(+), 13 deletions(-)

diff --git a/gst-libs/gst/farsight/fs-session.c b/gst-libs/gst/farsight/fs-session.c
index 89c1a58..14e5ac6 100644
--- a/gst-libs/gst/farsight/fs-session.c
+++ b/gst-libs/gst/farsight/fs-session.c
@@ -398,7 +398,7 @@ _remove_stream_ptr (FsSession *session, FsStream *stream)
  */
 FsStream *
 fs_session_new_stream (FsSession *session, FsParticipant *participant,
-                       FsStreamDirection direction, gchar *transmitter,
+                       FsStreamDirection direction, const gchar *transmitter,
                        guint stream_transmitter_n_parameters,
                        GParameter *stream_transmitter_parameters,
                        GError **error)
diff --git a/gst-libs/gst/farsight/fs-session.h b/gst-libs/gst/farsight/fs-session.h
index ee5799f..8b4fb4b 100644
--- a/gst-libs/gst/farsight/fs-session.h
+++ b/gst-libs/gst/farsight/fs-session.h
@@ -119,7 +119,7 @@ struct _FsSessionClass
   FsStream *(* new_stream) (FsSession *session,
                             FsParticipant *participant,
                             FsStreamDirection direction,
-                            gchar *transmitter,
+                            const gchar *transmitter,
                             guint stream_transmitter_n_parameters,
                             GParameter *stream_transmitter_parameters,
                             GError **error);
@@ -156,7 +156,7 @@ GType fs_session_get_type (void);
 FsStream *fs_session_new_stream (FsSession *session,
                                  FsParticipant *participant,
                                  FsStreamDirection direction,
-                                 gchar *transmitter,
+                                 const gchar *transmitter,
                                  guint stream_transmitter_n_parameters,
                                  GParameter *stream_transmitter_parameters,
                                  GError **error);
diff --git a/gst-libs/gst/farsight/fs-transmitter.c b/gst-libs/gst/farsight/fs-transmitter.c
index ddc5987..cf8d538 100644
--- a/gst-libs/gst/farsight/fs-transmitter.c
+++ b/gst-libs/gst/farsight/fs-transmitter.c
@@ -275,7 +275,7 @@ fs_transmitter_new_stream_transmitter (FsTransmitter *transmitter,
  */
 
 FsTransmitter *
-fs_transmitter_new (gchar *type, guint components, GError **error)
+fs_transmitter_new (const gchar *type, guint components, GError **error)
 {
   FsTransmitter *self = NULL;
 
@@ -295,3 +295,31 @@ fs_transmitter_new (gchar *type, guint components, GError **error)
 
   return self;
 }
+
+/**
+ * fs_transmitter_get_stream_transmitter_type:
+ * @transmitter: A #FsTransmitter object
+ * @error: location of a #GError, or NULL if no error occured
+ *
+ * This function returns the GObject type for the stream transmitter.
+ * This is meant for bindings that need to introspect the type of arguments
+ * that can be passed to the _new_stream_transmitter.
+ *
+ * Returns: the #GType
+ */
+
+GType
+fs_transmitter_get_stream_transmitter_type (FsTransmitter *transmitter,
+    GError **error)
+{
+  FsTransmitterClass *klass = FS_TRANSMITTER_GET_CLASS (transmitter);
+
+  if (klass->get_stream_transmitter_type) {
+    return klass->get_stream_transmitter_type (transmitter, error);
+  } else {
+    g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED,
+      "get_stream_transmitter_type not defined in class");
+  }
+
+  return 0;
+}
diff --git a/gst-libs/gst/farsight/fs-transmitter.h b/gst-libs/gst/farsight/fs-transmitter.h
index 185a9b4..4ea1efe 100644
--- a/gst-libs/gst/farsight/fs-transmitter.h
+++ b/gst-libs/gst/farsight/fs-transmitter.h
@@ -70,6 +70,8 @@ struct _FsTransmitterClass
                                                   guint n_parameters,
                                                   GParameter *parameters,
                                                   GError **error);
+  GType (*get_stream_transmitter_type) (FsTransmitter *transmitter,
+      GError **error);
 
   /*< private >*/
   gpointer _padding[8];
@@ -101,9 +103,13 @@ FsStreamTransmitter *fs_transmitter_new_stream_transmitter (
     FsTransmitter *transmitter, FsParticipant *participant,
     guint n_parameters, GParameter *parameters, GError **error);
 
-FsTransmitter *fs_transmitter_new (gchar *type, guint components,
+FsTransmitter *fs_transmitter_new (const gchar *type, guint components,
   GError **error);
 
+GType
+fs_transmitter_get_stream_transmitter_type (FsTransmitter *transmitter,
+    GError **error);
+
 G_END_DECLS
 
 #endif /* __FS_TRANSMITTER_H__ */
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 4a11513..83029de 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -159,7 +159,7 @@ static void fs_rtp_session_constructed (GObject *object);
 static FsStream *fs_rtp_session_new_stream (FsSession *session,
                                             FsParticipant *participant,
                                             FsStreamDirection direction,
-                                            gchar *transmitter,
+                                            const gchar *transmitter,
                                             guint n_parameters,
                                             GParameter *parameters,
                                             GError **error);
@@ -180,7 +180,7 @@ static gboolean fs_rtp_session_verify_send_codec_bin_locked (
 
 static FsStreamTransmitter *fs_rtp_session_get_new_stream_transmitter (
   FsRtpSession *self,
-  gchar *transmitter_name,
+  const gchar *transmitter_name,
   FsParticipant *participant,
   guint n_parameters,
   GParameter *parameters,
@@ -965,10 +965,13 @@ _remove_stream (gpointer user_data,
  * #FsStream when the stream is ended. If an error occured, returns NULL.
  */
 static FsStream *
-fs_rtp_session_new_stream (FsSession *session, FsParticipant *participant,
-                           FsStreamDirection direction, gchar *transmitter,
-                           guint n_parameters, GParameter *parameters,
-                           GError **error)
+fs_rtp_session_new_stream (FsSession *session,
+    FsParticipant *participant,
+    FsStreamDirection direction,
+    const gchar *transmitter,
+    guint n_parameters,
+    GParameter *parameters,
+    GError **error)
 {
   FsRtpSession *self = FS_RTP_SESSION (session);
   FsRtpParticipant *rtpparticipant = NULL;
@@ -983,7 +986,7 @@ fs_rtp_session_new_stream (FsSession *session, FsParticipant *participant,
   rtpparticipant = FS_RTP_PARTICIPANT (participant);
 
   st = fs_rtp_session_get_new_stream_transmitter (self, transmitter,
-    participant, n_parameters, parameters, error);
+      participant, n_parameters, parameters, error);
 
   if (!st)
     return NULL;
@@ -1203,7 +1206,7 @@ _get_request_pad_and_link (GstElement *tee_funnel, const gchar *tee_funnel_name,
 
 static FsStreamTransmitter *
 fs_rtp_session_get_new_stream_transmitter (FsRtpSession *self,
-  gchar *transmitter_name, FsParticipant *participant, guint n_parameters,
+  const gchar *transmitter_name, FsParticipant *participant, guint n_parameters,
   GParameter *parameters, GError **error)
 {
   FsTransmitter *transmitter;
diff --git a/transmitters/rawudp/fs-rawudp-transmitter.c b/transmitters/rawudp/fs-rawudp-transmitter.c
index ffe97a2..59eb917 100644
--- a/transmitters/rawudp/fs-rawudp-transmitter.c
+++ b/transmitters/rawudp/fs-rawudp-transmitter.c
@@ -103,6 +103,9 @@ static void fs_rawudp_transmitter_set_property (GObject *object,
 static FsStreamTransmitter *fs_rawudp_transmitter_new_stream_transmitter (
     FsTransmitter *transmitter, FsParticipant *participant,
     guint n_parameters, GParameter *parameters, GError **error);
+static GType fs_rawudp_transmitter_get_stream_transmitter_type (
+    FsTransmitter *transmitter,
+    GError **error);
 
 
 static GObjectClass *parent_class = NULL;
@@ -168,6 +171,8 @@ fs_rawudp_transmitter_class_init (FsRawUdpTransmitterClass *klass)
 
   transmitter_class->new_stream_transmitter =
     fs_rawudp_transmitter_new_stream_transmitter;
+  transmitter_class->get_stream_transmitter_type =
+    fs_rawudp_transmitter_get_stream_transmitter_type;
 
   gobject_class->dispose = fs_rawudp_transmitter_dispose;
   gobject_class->finalize = fs_rawudp_transmitter_finalize;
@@ -786,3 +791,10 @@ fs_rawudp_transmitter_udpport_get_port (UdpPort *udpport)
   return udpport->port;
 }
 
+
+static GType
+fs_rawudp_transmitter_get_stream_transmitter_type (FsTransmitter *transmitter,
+    GError **error)
+{
+  return FS_TYPE_RAWUDP_STREAM_TRANSMITTER;
+}
-- 
1.5.6.5




More information about the farsight-commits mailing list