baseparse: fix seekability querying with formats with headers like FLAC
authorTim-Philipp Müller <tim@centricular.net>
Sun, 15 Jul 2012 11:59:44 +0000 (12:59 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Sun, 15 Jul 2012 11:59:44 +0000 (12:59 +0100)
Move code that checks for upstream seekability and all that to
the right place, otherwise it will never be done for formats
that have headers such as FLAC, as handle_and_push frame will
be called the first time only after headers have been processed
(and framecount is > 0). This then makes us report that we
can't seek, which disables the seek bar in totem.

libs/gst/base/gstbaseparse.c

index b31a479..b69cac5 100644 (file)
@@ -1838,12 +1838,6 @@ gst_base_parse_handle_and_push_frame (GstBaseParse * parse,
 
   g_return_val_if_fail (frame != NULL, GST_FLOW_ERROR);
 
-  /* some one-time start-up */
-  if (G_UNLIKELY (!parse->priv->framecount)) {
-    gst_base_parse_check_seekability (parse);
-    gst_base_parse_check_upstream (parse);
-  }
-
   buffer = frame->buffer;
   offset = frame->offset;
 
@@ -2148,6 +2142,12 @@ gst_base_parse_finish_frame (GstBaseParse * parse, GstBaseParseFrame * frame,
   GST_LOG_OBJECT (parse, "finished frame at offset %" G_GUINT64_FORMAT ", "
       "flushing size %d", frame->offset, size);
 
+  /* some one-time start-up */
+  if (G_UNLIKELY (parse->priv->framecount == 0)) {
+    gst_base_parse_check_seekability (parse);
+    gst_base_parse_check_upstream (parse);
+  }
+
   if (parse->priv->scanning && frame->buffer) {
     if (!parse->priv->scanned_frame) {
       parse->priv->scanned_frame = gst_base_parse_frame_copy (frame);