summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorzeeshan.ali@nokia.com <zeeshan.ali@nokia.com>2007-03-22 12:41:32 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-21 17:48:52 +0100
commitc3232e2f49f5a81e850455b97fefc1f60a4f0483 (patch)
tree2e3f43af6363e0b95c3e626116b11cc21529b260 /gst
parentc9496c729486add58e918a130216205bf136072f (diff)
downloadgst-plugins-bad-c3232e2f49f5a81e850455b97fefc1f60a4f0483.tar.gz
gst-plugins-bad-c3232e2f49f5a81e850455b97fefc1f60a4f0483.tar.bz2
gst-plugins-bad-c3232e2f49f5a81e850455b97fefc1f60a4f0483.zip
[MOVED FROM GST-P-FARSIGHT] Refactorize the RTPMux code
20070322124132-65035-0a3278147546e33f687097a43b775b3f6aa99f93.gz
Diffstat (limited to 'gst')
-rw-r--r--gst/rtpmux/gstrtpmux.c65
1 files changed, 41 insertions, 24 deletions
diff --git a/gst/rtpmux/gstrtpmux.c b/gst/rtpmux/gstrtpmux.c
index 391919b0..d285c61c 100644
--- a/gst/rtpmux/gstrtpmux.c
+++ b/gst/rtpmux/gstrtpmux.c
@@ -187,27 +187,13 @@ gst_rtp_mux_finalize (GObject * object)
}
static GstPad *
-gst_rtp_mux_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * req_name)
+gst_rtp_mux_create_sinkpad (GstRTPMux * rtp_mux, GstPadTemplate * templ)
{
- GstRTPMux *rtp_mux;
- GstPad *newpad;
- GstRTPMuxClass *klass;
+ GstPad *newpad = NULL;
GstPadTemplate * class_templ;
-
- g_return_val_if_fail (templ != NULL, NULL);
- g_return_val_if_fail (GST_IS_RTP_MUX (element), NULL);
-
- rtp_mux = GST_RTP_MUX (element);
- klass = GST_RTP_MUX_GET_CLASS (rtp_mux);
-
- if (templ->direction != GST_PAD_SINK) {
- GST_WARNING_OBJECT (rtp_mux, "request pad that is not a SINK pad");
- return NULL;
- }
-
- class_templ =
- gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink_%d");
+
+ class_templ = gst_element_class_get_pad_template (
+ GST_ELEMENT_GET_CLASS (rtp_mux), "sink_%d");
if (templ == class_templ) {
gchar *name;
@@ -220,18 +206,49 @@ gst_rtp_mux_request_new_pad (GstElement * element,
rtp_mux->numpads++;
} else {
GST_WARNING_OBJECT (rtp_mux, "this is not our template!\n");
- return NULL;
}
+ return NULL;
+}
+
+static void
+gst_rtp_mux_setup_sinkpad (GstRTPMux * rtp_mux, GstPad * sinkpad)
+{
+ GstRTPMuxClass *klass;
+
+ klass = GST_RTP_MUX_GET_CLASS (rtp_mux);
+
/* setup some pad functions */
- gst_pad_set_setcaps_function (newpad, gst_rtp_mux_setcaps);
+ gst_pad_set_setcaps_function (sinkpad, gst_rtp_mux_setcaps);
if (klass->chain_func)
- gst_pad_set_chain_function (newpad, klass->chain_func);
+ gst_pad_set_chain_function (sinkpad, klass->chain_func);
if (klass->sink_event_func)
- gst_pad_set_event_function (newpad, klass->sink_event_func);
+ gst_pad_set_event_function (sinkpad, klass->sink_event_func);
/* dd the pad to the element */
- gst_element_add_pad (element, newpad);
+ gst_element_add_pad (GST_ELEMENT (rtp_mux), sinkpad);
+}
+
+static GstPad *
+gst_rtp_mux_request_new_pad (GstElement * element,
+ GstPadTemplate * templ, const gchar * req_name)
+{
+ GstRTPMux *rtp_mux;
+ GstPad *newpad;
+
+ g_return_val_if_fail (templ != NULL, NULL);
+ g_return_val_if_fail (GST_IS_RTP_MUX (element), NULL);
+
+ rtp_mux = GST_RTP_MUX (element);
+
+ if (templ->direction != GST_PAD_SINK) {
+ GST_WARNING_OBJECT (rtp_mux, "request pad that is not a SINK pad");
+ return NULL;
+ }
+
+ newpad = gst_rtp_mux_create_sinkpad (rtp_mux, templ);
+ if (newpad)
+ gst_rtp_mux_setup_sinkpad (rtp_mux, newpad);
return newpad;
}