Commit 93f61c47 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts

flxdec: improve segment handling

... to send a proper TIME segment downstream.
parent 40cfe678
...@@ -62,6 +62,8 @@ static void gst_flxdec_dispose (GstFlxDec * flxdec); ...@@ -62,6 +62,8 @@ static void gst_flxdec_dispose (GstFlxDec * flxdec);
static GstFlowReturn gst_flxdec_chain (GstPad * pad, GstObject * parent, static GstFlowReturn gst_flxdec_chain (GstPad * pad, GstObject * parent,
GstBuffer * buf); GstBuffer * buf);
static gboolean gst_flxdec_sink_event_handler (GstPad * pad,
GstObject * parent, GstEvent * event);
static GstStateChangeReturn gst_flxdec_change_state (GstElement * element, static GstStateChangeReturn gst_flxdec_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
...@@ -113,6 +115,8 @@ gst_flxdec_init (GstFlxDec * flxdec) ...@@ -113,6 +115,8 @@ gst_flxdec_init (GstFlxDec * flxdec)
gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->sinkpad); gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->sinkpad);
gst_pad_set_chain_function (flxdec->sinkpad, gst_pad_set_chain_function (flxdec->sinkpad,
GST_DEBUG_FUNCPTR (gst_flxdec_chain)); GST_DEBUG_FUNCPTR (gst_flxdec_chain));
gst_pad_set_event_function (flxdec->sinkpad,
GST_DEBUG_FUNCPTR (gst_flxdec_sink_event_handler));
flxdec->srcpad = gst_pad_new_from_static_template (&src_video_factory, "src"); flxdec->srcpad = gst_pad_new_from_static_template (&src_video_factory, "src");
gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->srcpad); gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->srcpad);
...@@ -166,6 +170,37 @@ done: ...@@ -166,6 +170,37 @@ done:
return ret; return ret;
} }
static gboolean
gst_flxdec_sink_event_handler (GstPad * pad, GstObject * parent,
GstEvent * event)
{
GstFlxDec *flxdec;
gboolean ret;
flxdec = GST_FLXDEC (parent);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEGMENT:
{
GstSegment segment;
gst_event_copy_segment (event, &segment);
if (segment.format != GST_FORMAT_TIME) {
GST_DEBUG_OBJECT (flxdec, "generating TIME segment");
gst_segment_init (&segment, GST_FORMAT_TIME);
gst_event_unref (event);
event = gst_event_new_segment (&segment);
}
/* fall-through */
}
default:
ret = gst_pad_event_default (pad, parent, event);
break;
}
return ret;
}
static void static void
flx_decode_chunks (GstFlxDec * flxdec, gulong count, guchar * data, flx_decode_chunks (GstFlxDec * flxdec, gulong count, guchar * data,
guchar * dest) guchar * dest)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment