https://bugzilla.gnome.org/show_bug.cgi?id=637519
} else if (pad->map.is_sparse) {
out_timestamp = gst_ogg_stream_granule_to_time (&pad->map,
pad->current_granule);
- out_duration = GST_CLOCK_TIME_NONE;
+ if (duration == GST_CLOCK_TIME_NONE) {
+ out_duration = GST_CLOCK_TIME_NONE;
+ } else {
+ out_duration = gst_util_uint64_scale (duration,
+ GST_SECOND * pad->map.granulerate_d, pad->map.granulerate_n);
+ }
} else {
out_timestamp = gst_ogg_stream_granule_to_time (&pad->map,
pad->current_granule - duration);
return TRUE;
}
+static gint64
+packet_duration_kate (GstOggStream * pad, ogg_packet * packet)
+{
+ gint64 duration;
+
+ if (packet->bytes < 1)
+ return 0;
+
+ switch (packet->packet[0]) {
+ case 0x00: /* text data */
+ if (packet->bytes < 1 + 8 * 2) {
+ duration = 0;
+ } else {
+ duration = GST_READ_UINT64_LE (packet->packet + 1 + 8);
+ if (duration < 0)
+ duration = 0;
+ }
+ break;
+ default:
+ duration = GST_CLOCK_TIME_NONE;
+ break;
+ }
+
+ return duration;
+}
+
/* *INDENT-OFF* */
/* indent hates our freedoms */
granule_to_granulepos_default,
NULL,
is_header_count,
- NULL,
+ packet_duration_kate,
NULL,
NULL
},