*
* Reads superindex (openDML-2 spec stuff) from the provided data.
* The buffer will be discarded after use.
+ * The buffer should contain a GST_RIFF_TAG_ix?? chunk.
*
* Returns: TRUE on success, FALSE otherwise. Errors are fatal, we
* throw an error, caller should bail out asap.
GList *entries_list = NULL;
guint size;
+#ifndef GST_DISABLE_GST_DEBUG
+ gulong _nr_keyframes = 0;
+#endif
+
*_entries_list = NULL;
size = buf ? GST_BUFFER_SIZE (buf) : 0;
if (!(entries = g_try_new (gst_avi_index_entry, num)))
goto out_of_mem;
+ GST_INFO_OBJECT (avi, "Parsing subindex, nr_entries = %6d", num);
+
for (i = 0; i < num; i++) {
gint64 next_ts;
entry->index_nr = i;
entry->stream_nr = stream->num;
+ if (stream->strh->type == GST_RIFF_FCC_auds) {
+ /* all audio frames are keyframes */
+ entry->flags |= GST_AVI_INDEX_ENTRY_FLAG_KEYFRAME;
+ }
+#ifndef GST_DISABLE_GST_DEBUG
+ if (entry->flags & GST_AVI_INDEX_ENTRY_FLAG_KEYFRAME)
+ _nr_keyframes++;
+#endif
+
/* stream duration unknown, now we can calculate it */
if (stream->idx_duration == -1)
stream->idx_duration = 0;
entries_list = g_list_prepend (entries_list, entry);
}
- GST_LOG_OBJECT (avi, "Read %d index entries", i);
+ GST_INFO_OBJECT (avi, "Parsed index, %6lu/%6lu entries, %5lu keyframes, "
+ "entry size = %2u, total size = %10d", i, num, _nr_keyframes,
+ (gint) sizeof (gst_avi_index_entry),
+ (gint) (i * sizeof (gst_avi_index_entry)));
gst_buffer_unref (buf);
_dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (sub);
dmlh.totalframes = GST_READ_UINT32_LE (&_dmlh->totalframes);
- GST_INFO_OBJECT (avi, "dmlh tag found:");
- GST_INFO_OBJECT (avi, " totalframes: %u", dmlh.totalframes);
+ GST_INFO_OBJECT (avi, "dmlh tag found: totalframes: %u",
+ dmlh.totalframes);
avi->avih->tot_frames = dmlh.totalframes;
goto next;
* free'ed at some point.
*
* Read index entries from the provided buffer. Takes ownership of @buf.
+ * The buffer should contain a GST_RIFF_TAG_idx1 chunk.
*/
static void
gst_avi_demux_parse_index (GstAviDemux * avi,
if (!(entries = g_try_new (gst_avi_index_entry, num)))
goto out_of_mem;
- GST_INFO ("Parsing index, nr_entries = %6d", num);
+ GST_INFO_OBJECT (avi, "Parsing index, nr_entries = %6d", num);
for (i = 0, n = 0; i < num; i++) {
gint64 next_ts;
n++;
}
- GST_INFO ("Parsed index, %6d entries, %5ld keyframes, entry size = %2d, "
- "total size = %10d", num, _nr_keyframes,
- (gint) sizeof (gst_avi_index_entry),
- (gint) (num * sizeof (gst_avi_index_entry)));
+ GST_INFO_OBJECT (avi, "Parsed index, %6u/%6u entries, %5lu keyframes, "
+ "entry size = %2u, total size = %10u", n, num, _nr_keyframes,
+ (guint) sizeof (gst_avi_index_entry),
+ (guint) (n * sizeof (gst_avi_index_entry)));
gst_buffer_unref (buf);
GstBuffer *buf;
guint32 tag;
guint32 size;
- gint i;
GST_DEBUG ("demux stream index at offset %" G_GUINT64_FORMAT, offset);
avi->sinkpad, &offset, &tag, &buf) != GST_FLOW_OK)
return;
- GST_INFO ("will parse index chunk size %u for tag %"
+ GST_DEBUG ("will parse index chunk size %u for tag %"
GST_FOURCC_FORMAT, GST_BUFFER_SIZE (buf), GST_FOURCC_ARGS (tag));
gst_avi_demux_parse_index (avi, buf, index);
if (*index)
*alloc_list = g_list_append (*alloc_list, (*index)->data);
+#ifndef GST_DISABLE_GST_DEBUG
/* debug our indexes */
- for (i = 0; i < avi->num_streams; i++) {
+ {
+ gint i;
avi_stream_context *stream;
- stream = &avi->stream[i];
- GST_DEBUG_OBJECT (avi, "stream %u: %u frames, %" G_GINT64_FORMAT " bytes",
- i, stream->total_frames, stream->total_bytes);
+ for (i = 0; i < avi->num_streams; i++) {
+ stream = &avi->stream[i];
+ GST_DEBUG_OBJECT (avi, "stream %u: %u frames, %" G_GINT64_FORMAT " bytes",
+ i, stream->total_frames, stream->total_bytes);
+ }
}
+#endif
return;
/* ERRORS */