mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 19:55:32 +00:00
rtpmux: Refactorize the RTPMux code
20070322124132-65035-0a3278147546e33f687097a43b775b3f6aa99f93.gz
This commit is contained in:
parent
21e6e951f6
commit
23d3ed5c5f
1 changed files with 44 additions and 27 deletions
|
@ -187,27 +187,13 @@ gst_rtp_mux_finalize (GObject * object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPad *
|
static GstPad *
|
||||||
gst_rtp_mux_request_new_pad (GstElement * element,
|
gst_rtp_mux_create_sinkpad (GstRTPMux * rtp_mux, GstPadTemplate * templ)
|
||||||
GstPadTemplate * templ, const gchar * req_name)
|
|
||||||
{
|
{
|
||||||
GstRTPMux *rtp_mux;
|
GstPad *newpad = NULL;
|
||||||
GstPad *newpad;
|
|
||||||
GstRTPMuxClass *klass;
|
|
||||||
GstPadTemplate * class_templ;
|
GstPadTemplate * class_templ;
|
||||||
|
|
||||||
g_return_val_if_fail (templ != NULL, NULL);
|
class_templ = gst_element_class_get_pad_template (
|
||||||
g_return_val_if_fail (GST_IS_RTP_MUX (element), NULL);
|
GST_ELEMENT_GET_CLASS (rtp_mux), "sink_%d");
|
||||||
|
|
||||||
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");
|
|
||||||
|
|
||||||
if (templ == class_templ) {
|
if (templ == class_templ) {
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
@ -220,18 +206,49 @@ gst_rtp_mux_request_new_pad (GstElement * element,
|
||||||
rtp_mux->numpads++;
|
rtp_mux->numpads++;
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (rtp_mux, "this is not our template!\n");
|
GST_WARNING_OBJECT (rtp_mux, "this is not our template!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (sinkpad, gst_rtp_mux_setcaps);
|
||||||
|
if (klass->chain_func)
|
||||||
|
gst_pad_set_chain_function (sinkpad, klass->chain_func);
|
||||||
|
if (klass->sink_event_func)
|
||||||
|
gst_pad_set_event_function (sinkpad, klass->sink_event_func);
|
||||||
|
|
||||||
|
/* dd the pad to the element */
|
||||||
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup some pad functions */
|
newpad = gst_rtp_mux_create_sinkpad (rtp_mux, templ);
|
||||||
gst_pad_set_setcaps_function (newpad, gst_rtp_mux_setcaps);
|
if (newpad)
|
||||||
if (klass->chain_func)
|
gst_rtp_mux_setup_sinkpad (rtp_mux, newpad);
|
||||||
gst_pad_set_chain_function (newpad, klass->chain_func);
|
|
||||||
if (klass->sink_event_func)
|
|
||||||
gst_pad_set_event_function (newpad, klass->sink_event_func);
|
|
||||||
|
|
||||||
/* dd the pad to the element */
|
|
||||||
gst_element_add_pad (element, newpad);
|
|
||||||
|
|
||||||
return newpad;
|
return newpad;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue