static gboolean gst_span_plc_event_sink (GstPad * pad, GstObject * parent, GstEvent * event) { GstSpanPlc *plc = GST_SPAN_PLC (parent); GST_DEBUG_OBJECT (plc, "received event %s", GST_EVENT_TYPE_NAME (event)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: { GstCaps *caps; gst_event_parse_caps (event, &caps); gst_span_plc_setcaps_sink (plc, caps); break; } case GST_EVENT_GAP: { GstClockTime timestamp; GstClockTime duration; gst_event_parse_gap (event, ×tamp, &duration); gst_span_plc_send_fillin (plc, timestamp, duration); gst_event_unref (event); return TRUE; } case GST_EVENT_FLUSH_STOP: gst_span_plc_flush (plc, TRUE); break; default: break; } return gst_pad_push_event (plc->srcpad, event); }
static gboolean gst_span_plc_event_sink (GstPad * pad, GstEvent * event) { gboolean ret = FALSE; GstSpanPlc *plc = GST_SPAN_PLC (gst_pad_get_parent (pad)); GST_DEBUG_OBJECT (plc, "received event %s", GST_EVENT_TYPE_NAME (event)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_NEWSEGMENT: { GstFormat format; gdouble rate; gint64 start, stop, time; gboolean update; gst_event_parse_new_segment (event, &update, &rate, &format, &start, &stop, &time); if (format != GST_FORMAT_TIME) goto newseg_wrong_format; if (update) { /* time progressed without data, see if we can fill the gap with * some concealment data */ if (plc->last_stop < start) gst_span_plc_send_fillin (plc, start - plc->last_stop); } plc->last_stop = start; break; } case GST_EVENT_FLUSH_START: gst_span_plc_flush (plc, TRUE); break; default: break; } ret = gst_pad_push_event (plc->srcpad, event); gst_object_unref (plc); return ret; newseg_wrong_format: { GST_DEBUG_OBJECT (plc, "received non TIME newsegment"); gst_object_unref (plc); return FALSE; } }