gst_matroska_demux_parse_info (GstMatroskaDemux * demux, GstEbmlRead * ebml)
{
GstFlowReturn ret = GST_FLOW_OK;
+ gdouble dur_f = -1.0;
guint32 id;
DEBUG_ELEMENT_START (demux, ebml, "SegmentInfo");
}
case GST_MATROSKA_ID_DURATION:{
- gdouble num;
- GstClockTime dur;
-
- if ((ret = gst_ebml_read_float (ebml, &id, &num)) != GST_FLOW_OK)
+ if ((ret = gst_ebml_read_float (ebml, &id, &dur_f)) != GST_FLOW_OK)
break;
- if (num <= 0.0) {
- GST_WARNING_OBJECT (demux, "Invalid duration %lf", num);
+ if (dur_f <= 0.0) {
+ GST_WARNING_OBJECT (demux, "Invalid duration %lf", dur_f);
break;
}
- GST_DEBUG_OBJECT (demux, "Duration: %lf", num);
-
- dur = gst_gdouble_to_guint64 (num *
- gst_guint64_to_gdouble (demux->time_scale));
- if (GST_CLOCK_TIME_IS_VALID (dur) && dur <= G_MAXINT64)
- gst_segment_set_duration (&demux->segment, GST_FORMAT_TIME, dur);
+ GST_DEBUG_OBJECT (demux, "Duration: %lf", dur_f);
break;
}
}
}
+ if (dur_f > 0.0) {
+ GstClockTime dur_u;
+
+ dur_u = gst_gdouble_to_guint64 (dur_f *
+ gst_guint64_to_gdouble (demux->time_scale));
+ if (GST_CLOCK_TIME_IS_VALID (dur_u) && dur_u <= G_MAXINT64)
+ gst_segment_set_duration (&demux->segment, GST_FORMAT_TIME, dur_u);
+ }
+
DEBUG_ELEMENT_STOP (demux, ebml, "SegmentInfo", ret);
demux->segmentinfo_parsed = TRUE;