pad-monitor: make it able to initialize a segment

Do not take the initial format set to TIME too seriously when we
haven't got any newsegment event yet. If it is the first segment
received, switch our internal segment tracker to the event format
This commit is contained in:
Thiago Santos 2013-07-11 13:43:52 -03:00
parent 7de70978cf
commit 08180f3a4c
2 changed files with 5 additions and 0 deletions

View file

@ -186,8 +186,12 @@ gst_qa_pad_monitor_event_func (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:
if (ret) {
if (!pad_monitor->has_segment && pad_monitor->segment.format != format) {
gst_segment_init (&pad_monitor->segment, format);
}
gst_segment_set_newsegment_full (&pad_monitor->segment, update, rate,
applied_rate, format, start, stop, position);
pad_monitor->has_segment = TRUE;
}
break;
case GST_EVENT_FLUSH_START:

View file

@ -63,6 +63,7 @@ struct _GstQaPadMonitor {
GstPadQueryFunction query_func;
/*< private >*/
gboolean has_segment;
GstSegment segment;
gboolean pending_flush_stop;