diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c
index d485783..e29ee70 100644
--- a/ext/ogg/gstoggdemux.c
+++ b/ext/ogg/gstoggdemux.c
@@ -233,19 +233,28 @@ gst_ogg_pad_src_query (GstPad * pad, GstQuery * query)
       gint64 total_time;
 
       gst_query_parse_duration (query, &format, NULL);
-      /* can only get position in time */
-      if (format != GST_FORMAT_TIME)
-        goto wrong_format;
-
-      if (ogg->pullmode) {
-        /* we must return the total length */
-        total_time = ogg->total_time;
-      } else {
-        /* in push mode we can answer the query and we must return -1 */
-        total_time = -1;
+      switch (format) {
+        case GST_FORMAT_PERCENT:
+          gst_query_set_duration (query, GST_FORMAT_PERCENT, 
+            GST_FORMAT_PERCENT_MAX);
+          break;
+        case GST_FORMAT_TIME:
+          if (ogg->pullmode) {
+            /* we must return the total length */
+            total_time = ogg->total_time;
+          } else {
+            /* in push mode we can answer the query and we must return -1 */
+            total_time = -1;
+          }
+    
+          gst_query_set_duration (query, GST_FORMAT_TIME, total_time);
+          break;
+        default:
+          GST_DEBUG_OBJECT (ogg, "unsupported duration query format: %s",
+              gst_format_get_name (format));
+          res = FALSE;
+          break;
       }
-
-      gst_query_set_duration (query, GST_FORMAT_TIME, total_time);
       break;
     }
     case GST_QUERY_SEEKING:
@@ -266,18 +275,9 @@ gst_ogg_pad_src_query (GstPad * pad, GstQuery * query)
       res = gst_pad_query_default (pad, query);
       break;
   }
-done:
   gst_object_unref (ogg);
 
   return res;
-
-  /* ERRORS */
-wrong_format:
-  {
-    GST_DEBUG_OBJECT (ogg, "only query duration on TIME is supported");
-    res = FALSE;
-    goto done;
-  }
 }
 
 static gboolean
