[farsight2/master] Dont have the substream call the stream function directly but have it emit it own src-pad-added signal instead
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:21:46 PST 2008
---
.gitignore | 2 +
gst/fsrtpconference/Makefile.am | 16 ++++++++++++-
gst/fsrtpconference/fs-rtp-marshal.list | 1 +
gst/fsrtpconference/fs-rtp-stream.c | 12 +++++++++++
gst/fsrtpconference/fs-rtp-stream.h | 2 +
gst/fsrtpconference/fs-rtp-substream.c | 34 ++++++++++++++++++++++++++++--
6 files changed, 62 insertions(+), 5 deletions(-)
create mode 100644 gst/fsrtpconference/fs-rtp-marshal.list
diff --git a/.gitignore b/.gitignore
index 0818709..e7781bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@ Makefile.in
.#*
*.stamp
+gst/fsrtpconference/fs-rtp-marshal.[ch]
+
gst-libs/gst/farsight/fs-marshal.[ch]
gst-libs/gst/farsight/fs-enum-types.[ch]
diff --git a/gst/fsrtpconference/Makefile.am b/gst/fsrtpconference/Makefile.am
index 8d24bed..f0f7dcc 100644
--- a/gst/fsrtpconference/Makefile.am
+++ b/gst/fsrtpconference/Makefile.am
@@ -12,7 +12,8 @@ libfsrtpconference_la_SOURCES = gstfsrtpconference.c \
fs-rtp-specific-nego.c \
fs-rtp-special-source.c \
fs-rtp-dtmf-event-source.c \
- fs-rtp-dtmf-sound-source.c
+ fs-rtp-dtmf-sound-source.c \
+ fs-rtp-marshal.c
libfsrtpconference_la_CFLAGS = $(FS2_INTERNAL_CFLAGS) $(FS2_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libfsrtpconference_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
@@ -33,4 +34,15 @@ noinst_HEADERS = \
fs-rtp-specific-nego.h \
fs-rtp-special-source.h \
fs-rtp-dtmf-event-source.h \
- fs-rtp-dtmf-sound-source.h
+ fs-rtp-dtmf-sound-source.h \
+ fs-rtp-marshal.h
+
+fs-rtp-marshal.h: fs-rtp-marshal.list Makefile
+ glib-genmarshal --header --prefix=_fs_rtp_marshal $(srcdir)/$< > $@.tmp
+ mv $@.tmp $@
+
+fs-rtp-marshal.c: fs-rtp-marshal.list Makefile
+ echo "#include \"glib-object.h\"" >> $@.tmp
+ echo "#include \"fs-rtp-marshal.h\"" >> $@.tmp
+ glib-genmarshal --body --prefix=_fs_rtp_marshal $(srcdir)/$< >> $@.tmp
+ mv $@.tmp $@
diff --git a/gst/fsrtpconference/fs-rtp-marshal.list b/gst/fsrtpconference/fs-rtp-marshal.list
new file mode 100644
index 0000000..73ccad0
--- /dev/null
+++ b/gst/fsrtpconference/fs-rtp-marshal.list
@@ -0,0 +1 @@
+VOID:BOXED,BOXED
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index afcab9e..f56c719 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -619,6 +619,15 @@ _transmitter_error (
}
+static void
+_substream_src_pad_added (FsRtpSubStream *substream, GstPad *pad,
+ FsCodec *codec, gpointer user_data)
+{
+ FsStream *stream = FS_STREAM (user_data);
+
+ fs_stream_emit_src_pad_added (stream, pad, codec);
+}
+
/**
* fs_rtp_stream_add_substream:
* @stream: a #FsRtpStream
@@ -644,6 +653,9 @@ fs_rtp_stream_add_substream (FsRtpStream *stream,
"receiving", ((stream->priv->direction & FS_DIRECTION_RECV) != 0),
NULL);
+ g_signal_connect (substream, "src-pad-added",
+ G_CALLBACK (_substream_src_pad_added), stream);
+
g_object_get (substream, "codec", &codec, NULL);
/* Only announce a pad if it has a codec attached to it */
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index 17c06d8..5c989c9 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -32,6 +32,8 @@
#include "fs-rtp-session.h"
#include "fs-rtp-substream.h"
+#include "fs-rtp-marshal.h"
+
G_BEGIN_DECLS
/* TYPE MACROS */
diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index bde1434..2e0a2c7 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -49,6 +49,7 @@
enum
{
NO_RTCP_TIMEDOUT,
+ SRC_PAD_ADDED,
LAST_SIGNAL
};
@@ -252,6 +253,34 @@ fs_rtp_sub_stream_class_init (FsRtpSubStreamClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ /**
+ * FsRtpSubStream::src-pad-added:
+ * @self: #FsRtpSubStream that emitted the signal
+ * @pad: #GstPad of the new source pad
+ * @codec: #FsCodec of the codec being received on the new source pad
+ *
+ * This signal is emitted when a new gst source pad has been created for a
+ * specific codec being received. There will be a different source pad for
+ * each codec that is received. The user must ref the #GstPad if he wants to
+ * keep it. The user should not modify the #FsCodec and must copy it if he
+ * wants to use it outside the callback scope.
+ *
+ * This signal is not emitted on the main thread, but on GStreamer's streaming
+ * thread!
+ *
+ * This is probably re-emited by the FsStream
+ *
+ */
+ signals[SRC_PAD_ADDED] = g_signal_new ("src-pad-added",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ _fs_rtp_marshal_VOID__BOXED_BOXED,
+ G_TYPE_NONE, 2, GST_TYPE_PAD, FS_TYPE_CODEC);
+
+
g_type_class_add_private (klass, sizeof (FsRtpSubStreamPrivate));
}
@@ -780,9 +809,8 @@ fs_rtp_sub_stream_add_output_ghostpad_locked (FsRtpSubStream *substream,
substream->priv->output_ghostpad = ghostpad;
- fs_stream_emit_src_pad_added (FS_STREAM (substream->priv->stream),
- ghostpad,
- substream->priv->codec);
+ g_signal_emit (substream, signals[SRC_PAD_ADDED], 0,
+ ghostpad, substream->priv->codec);
if (substream->priv->receiving)
g_object_set (substream->priv->valve, "drop", FALSE, NULL);
--
1.5.6.5
More information about the farsight-commits
mailing list