static gboolean gst_rtp_dtmf_src_handle_dtmf_event (GstRTPDTMFSrc * dtmfsrc, const GstStructure * event_structure) { gint event_type; gboolean start; gint method; GstClockTime last_stop; gint event_number; gint event_volume; gboolean correct_order; if (!gst_structure_get_int (event_structure, "type", &event_type) || !gst_structure_get_boolean (event_structure, "start", &start) || event_type != GST_RTP_DTMF_TYPE_EVENT) goto failure; if (gst_structure_get_int (event_structure, "method", &method)) { if (method != 1) { goto failure; } } if (start) if (!gst_structure_get_int (event_structure, "number", &event_number) || !gst_structure_get_int (event_structure, "volume", &event_volume)) goto failure; GST_OBJECT_LOCK (dtmfsrc); if (gst_structure_get_clock_time (event_structure, "last-stop", &last_stop)) dtmfsrc->last_stop = last_stop; else dtmfsrc->last_stop = GST_CLOCK_TIME_NONE; correct_order = (start != dtmfsrc->last_event_was_start); dtmfsrc->last_event_was_start = start; GST_OBJECT_UNLOCK (dtmfsrc); if (!correct_order) goto failure; if (start) { if (!gst_structure_get_int (event_structure, "number", &event_number) || !gst_structure_get_int (event_structure, "volume", &event_volume)) goto failure; GST_DEBUG_OBJECT (dtmfsrc, "Received start event %d with volume %d", event_number, event_volume); gst_rtp_dtmf_src_add_start_event (dtmfsrc, event_number, event_volume); } else { GST_DEBUG_OBJECT (dtmfsrc, "Received stop event"); gst_rtp_dtmf_src_add_stop_event (dtmfsrc); } return TRUE; failure: return FALSE; }
static gboolean gst_rtp_dtmf_src_handle_dtmf_event (GstRTPDTMFSrc * dtmfsrc, const GstStructure * event_structure) { gint event_type; gboolean start; gint method; if (!gst_structure_get_int (event_structure, "type", &event_type) || !gst_structure_get_boolean (event_structure, "start", &start) || event_type != GST_RTP_DTMF_TYPE_EVENT) goto failure; if (gst_structure_get_int (event_structure, "method", &method)) { if (method != 1) { goto failure; } } if (start) { gint event_number; gint event_volume; if (!gst_structure_get_int (event_structure, "number", &event_number) || !gst_structure_get_int (event_structure, "volume", &event_volume)) goto failure; GST_DEBUG_OBJECT (dtmfsrc, "Received start event %d with volume %d", event_number, event_volume); gst_rtp_dtmf_src_add_start_event (dtmfsrc, event_number, event_volume); } else { GST_DEBUG_OBJECT (dtmfsrc, "Received stop event"); gst_rtp_dtmf_src_add_stop_event (dtmfsrc); } return TRUE; failure: return FALSE; }