summaryrefslogtreecommitdiffstats
path: root/gst/rtpmux
diff options
context:
space:
mode:
authorzeeshan.ali@nokia.com <zeeshan.ali@nokia.com>2007-03-21 16:33:11 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-21 17:48:51 +0100
commit1cf3b17cb31e5087a19d5311d5f770b44886c154 (patch)
treeec046fd6760c23bb53eda05f0deef9aa917ccf98 /gst/rtpmux
parent66888a6a820e34aff80edeadc538e51105947693 (diff)
downloadgst-plugins-bad-1cf3b17cb31e5087a19d5311d5f770b44886c154.tar.gz
gst-plugins-bad-1cf3b17cb31e5087a19d5311d5f770b44886c154.tar.bz2
gst-plugins-bad-1cf3b17cb31e5087a19d5311d5f770b44886c154.zip
[MOVED FROM GST-P-FARSIGHT] Refactor the event handler function
20070321163311-65035-987e7f25d1ab5335b79f44b277abf15e4e37d317.gz
Diffstat (limited to 'gst/rtpmux')
-rw-r--r--gst/rtpmux/gstrtpdtmfmux.c83
1 files changed, 46 insertions, 37 deletions
diff --git a/gst/rtpmux/gstrtpdtmfmux.c b/gst/rtpmux/gstrtpdtmfmux.c
index 5bdd3466..0d1e0f6a 100644
--- a/gst/rtpmux/gstrtpdtmfmux.c
+++ b/gst/rtpmux/gstrtpdtmfmux.c
@@ -156,6 +156,51 @@ gst_rtp_dtmf_mux_chain (GstPad * pad, GstBuffer * buffer)
}
static gboolean
+gst_rtp_dtmf_mux_stream_lock_event_handler (GstRTPDTMFMux *mux, GstPad * pad,
+ const GstStructure * event_structure)
+{
+ gboolean lock;
+
+ if (!gst_structure_get_boolean (event_structure, "lock", &lock))
+ return FALSE;
+
+ GST_OBJECT_LOCK (mux);
+ if (lock) {
+ if (mux->special_pad != NULL) {
+ GST_WARNING_OBJECT (mux,
+ "Stream lock already acquired by pad %s",
+ GST_ELEMENT_NAME (mux->special_pad));
+ }
+
+ else
+ mux->special_pad = gst_object_ref (pad);
+ }
+
+ else {
+ if (mux->special_pad == NULL) {
+ GST_WARNING_OBJECT (mux,
+ "Stream lock not acquired, can't release it");
+ }
+
+ else if (pad != mux->special_pad) {
+ GST_WARNING_OBJECT (mux,
+ "pad %s attempted to release Stream lock"
+ " which was acquired by pad %s", GST_ELEMENT_NAME (pad),
+ GST_ELEMENT_NAME (mux->special_pad));
+ }
+
+ else {
+ gst_object_unref (mux->special_pad);
+ mux->special_pad = NULL;
+ }
+ }
+
+ GST_OBJECT_UNLOCK (mux);
+
+ return TRUE;
+}
+
+static gboolean
gst_rtp_dtmf_mux_sink_event (GstPad * pad, GstEvent * event)
{
GstRTPDTMFMux *mux;
@@ -174,43 +219,7 @@ gst_rtp_dtmf_mux_sink_event (GstPad * pad, GstEvent * event)
structure = gst_event_get_structure (event);
/* FIXME: is this event generic enough to be given a generic name? */
if (structure && gst_structure_has_name (structure, "stream-lock")) {
- gboolean lock;
-
- if (!gst_structure_get_boolean (structure, "lock", &lock))
- break;
-
- GST_OBJECT_LOCK (mux);
- if (lock) {
- if (mux->special_pad != NULL) {
- GST_WARNING_OBJECT (mux,
- "Stream lock already acquired by pad %s",
- GST_ELEMENT_NAME (mux->special_pad));
- }
-
- else
- mux->special_pad = gst_object_ref (pad);
- }
-
- else {
- if (mux->special_pad == NULL) {
- GST_WARNING_OBJECT (mux,
- "Stream lock not acquired, can't release it");
- }
-
- else if (pad != mux->special_pad) {
- GST_WARNING_OBJECT (mux,
- "pad %s attempted to release Stream lock"
- " which was acquired by pad %s", GST_ELEMENT_NAME (pad),
- GST_ELEMENT_NAME (mux->special_pad));
- }
-
- else {
- gst_object_unref (mux->special_pad);
- mux->special_pad = NULL;
- }
- }
-
- GST_OBJECT_UNLOCK (mux);
+ ret = gst_rtp_dtmf_mux_stream_lock_event_handler (mux, pad, structure);
}
ret = TRUE;