diff --git a/gst/rtpmanager/gstrtpdtmfmux.c b/gst/rtpmanager/gstrtpdtmfmux.c index 73756343b7..792d004c92 100644 --- a/gst/rtpmanager/gstrtpdtmfmux.c +++ b/gst/rtpmanager/gstrtpdtmfmux.c @@ -80,10 +80,19 @@ enum LAST_SIGNAL }; + +static GstStaticPadTemplate priority_sink_factory = +GST_STATIC_PAD_TEMPLATE ("priority_sink_%d", + GST_PAD_SINK, + GST_PAD_REQUEST, + GST_STATIC_CAPS ("application/x-rtp")); + static guint gst_rtpdtmfmux_signals[LAST_SIGNAL] = { 0 }; static void gst_rtp_dtmf_mux_dispose (GObject * object); +static GstPad *gst_rtp_dtmf_mux_request_new_pad (GstElement * element, + GstPadTemplate * templ, const gchar * name); static void gst_rtp_dtmf_mux_release_pad (GstElement * element, GstPad * pad); static gboolean gst_rtp_dtmf_mux_sink_event (GstPad * pad, GstEvent * event); @@ -101,6 +110,9 @@ gst_rtp_dtmf_mux_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&priority_sink_factory)); + gst_element_class_set_details_simple (element_class, "RTP muxer", "Codec/Muxer", "mixes RTP DTMF streams into other RTP streams", @@ -129,6 +141,8 @@ gst_rtp_dtmf_mux_class_init (GstRTPDTMFMuxClass * klass) gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD); gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_mux_dispose); + gstelement_class->request_new_pad = + GST_DEBUG_FUNCPTR (gst_rtp_dtmf_mux_request_new_pad); gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_mux_release_pad); gstrtpmux_class->chain_func = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_mux_chain); @@ -167,9 +181,7 @@ gst_rtp_dtmf_mux_chain (GstPad * pad, GstBuffer * buffer) gst_buffer_unref (buffer); ret = GST_FLOW_OK; GST_OBJECT_UNLOCK (mux); - } - - else { + } else { GST_OBJECT_UNLOCK (mux); if (parent_class->chain_func) ret = parent_class->chain_func (pad, buffer); @@ -296,6 +308,30 @@ gst_rtp_dtmf_mux_sink_event (GstPad * pad, GstEvent * event) return ret; } +static GstPad * +gst_rtp_dtmf_mux_request_new_pad (GstElement * element, GstPadTemplate * templ, + const gchar * name) +{ + GstPad *pad; + + pad = GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, request_new_pad, + (element, templ, name), NULL); + + if (pad) { + GstRTPMuxPadPrivate *padpriv; + + GST_OBJECT_LOCK (element); + padpriv = gst_pad_get_element_private (pad); + + if (gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (element), + "priority_sink_%d") == gst_pad_get_pad_template (pad)) + padpriv->priority = TRUE; + GST_OBJECT_UNLOCK (element); + } + + return pad; +} + static void gst_rtp_dtmf_mux_release_pad (GstElement * element, GstPad * pad) { diff --git a/gst/rtpmanager/gstrtpmux.c b/gst/rtpmanager/gstrtpmux.c index 3c72497aba..5cc1adb67a 100644 --- a/gst/rtpmanager/gstrtpmux.c +++ b/gst/rtpmanager/gstrtpmux.c @@ -56,15 +56,6 @@ enum #define DEFAULT_SEQNUM_OFFSET -1 #define DEFAULT_SSRC -1 -typedef struct -{ - gboolean have_clock_base; - guint clock_base; - - GstCaps *out_caps; - GstSegment segment; -} GstRTPMuxPadPrivate; - static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, diff --git a/gst/rtpmanager/gstrtpmux.h b/gst/rtpmanager/gstrtpmux.h index 8be74ad2ab..bfc1e7dee9 100644 --- a/gst/rtpmanager/gstrtpmux.h +++ b/gst/rtpmanager/gstrtpmux.h @@ -70,6 +70,20 @@ struct _GstRTPMuxClass gboolean (*sink_event_func) (GstPad * pad, GstEvent * event); }; + +typedef struct +{ + gboolean have_clock_base; + guint clock_base; + + GstCaps *out_caps; + + GstSegment segment; + + gboolean priority; +} GstRTPMuxPadPrivate; + + GType gst_rtp_mux_get_type (void); gboolean gst_rtp_mux_plugin_init (GstPlugin * plugin);