Index: gstmpegparse.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins/gst/mpegstream/gstmpegparse.c,v
retrieving revision 1.67
diff -u -r1.67 gstmpegparse.c
--- gstmpegparse.c	25 Jan 2005 18:26:45 -0000	1.67
+++ gstmpegparse.c	8 Feb 2005 16:41:22 -0000
@@ -660,8 +660,6 @@
   switch (src_format) {
     case GST_FORMAT_BYTES:
       switch (*dest_format) {
-        case GST_FORMAT_DEFAULT:
-          *dest_format = GST_FORMAT_TIME;
         case GST_FORMAT_TIME:
           if (mpeg_parse->mux_rate == 0)
             res = FALSE;
@@ -674,8 +672,6 @@
       break;
     case GST_FORMAT_TIME:
       switch (*dest_format) {
-        case GST_FORMAT_DEFAULT:
-          *dest_format = GST_FORMAT_BYTES;
         case GST_FORMAT_BYTES:
           *dest_value = mpeg_parse->mux_rate * 50 * src_value / GST_SECOND;
           break;
@@ -715,15 +711,23 @@
     case GST_QUERY_TOTAL:
     {
       switch (*format) {
-        case GST_FORMAT_DEFAULT:
-          *format = GST_FORMAT_TIME;
-          /* fallthrough */
-        default:
+        case GST_FORMAT_TIME: {
+          GstFormat fmt = GST_FORMAT_BYTES;
+          gint64 tot, pos;
+
           src_format = GST_FORMAT_BYTES;
-          if (!gst_pad_query (GST_PAD_PEER (mpeg_parse->sinkpad),
-                  GST_QUERY_TOTAL, &src_format, &src_value)) {
-            res = FALSE;
-          }
+          if (gst_pad_query (GST_PAD_PEER (mpeg_parse->sinkpad),
+                  GST_QUERY_TOTAL, &fmt, &tot) &&
+              gst_pad_query (GST_PAD_PEER (mpeg_parse->sinkpad),
+                  GST_QUERY_POSITION, &fmt, &pos)) {
+            src_value = MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr) *
+                (((gdouble) tot) / pos);
+            src_format = GST_FORMAT_TIME;
+            break;
+          } /* else fall-through */
+        }
+        default:
+          res = FALSE;
           break;
       }
       break;
