static GstStateChangeReturn gst_teletextdec_change_state (GstElement * element, GstStateChange transition) { GstStateChangeReturn ret; GstTeletextDec *teletext; teletext = GST_TELETEXTDEC (element); switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: gst_teletextdec_zvbi_init (teletext); break; default: break; } ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); if (ret != GST_STATE_CHANGE_SUCCESS) return ret; switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: gst_teletextdec_zvbi_clear (teletext); break; default: break; } return ret; }
static gboolean gst_teletextdec_sink_event (GstPad * pad, GstEvent * event) { gboolean ret; GstTeletextDec *teletext = GST_TELETEXTDEC (gst_pad_get_parent (pad)); GST_DEBUG_OBJECT (teletext, "got event %s", gst_event_type_get_name (GST_EVENT_TYPE (event))); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_NEWSEGMENT: /* maybe save and/or update the current segment (e.g. for output * clipping) or convert the event into one in a different format * (e.g. BYTES to TIME) or drop it and set a flag to send a newsegment * event in a different format later */ ret = gst_pad_push_event (teletext->srcpad, event); break; case GST_EVENT_EOS: /* end-of-stream, we should close down all stream leftovers here */ gst_teletextdec_zvbi_clear (teletext); ret = gst_pad_push_event (teletext->srcpad, event); break; case GST_EVENT_FLUSH_STOP: gst_teletextdec_zvbi_clear (teletext); gst_teletextdec_zvbi_init (teletext); ret = gst_pad_push_event (teletext->srcpad, event); break; default: ret = gst_pad_event_default (pad, event); break; } gst_object_unref (teletext); return ret; }