ext/mad/: Fix mad and id3tag compilation again.
authorWim Taymans <wim.taymans@gmail.com>
Thu, 12 May 2005 19:48:45 +0000 (19:48 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 12 May 2005 19:48:45 +0000 (19:48 +0000)
Original commit message from CVS:
* ext/mad/gstid3tag.c: (gst_id3_tag_src_query):
* ext/mad/gstmad.c: (gst_mad_chain):
Fix mad and id3tag compilation again.

ChangeLog
ext/mad/gstid3tag.c
ext/mad/gstmad.c

index b9d2b82..12c6272 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-05-12  Wim Taymans  <wim@fluendo.com>
 
+       * ext/mad/gstid3tag.c: (gst_id3_tag_src_query):
+       * ext/mad/gstmad.c: (gst_mad_chain):
+       Fix mad and id3tag compilation again.
+
+2005-05-12  Wim Taymans  <wim@fluendo.com>
+
        * gst/udp/.cvsignore:
        * gst/udp/Makefile.am:
        * gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
index fdf764c..ae6a520 100644 (file)
@@ -163,8 +163,7 @@ static gboolean gst_id3_tag_src_event (GstPad * pad, GstEvent * event);
 static const GstEventMask *gst_id3_tag_get_event_masks (GstPad * pad);
 static const GstQueryType *gst_id3_tag_get_query_types (GstPad * pad);
 
-static gboolean gst_id3_tag_src_query (GstPad * pad,
-    GstQueryType type, GstFormat * format, gint64 * value);
+static gboolean gst_id3_tag_src_query (GstPad * pad, GstQuery * query);
 
 static gboolean gst_id3_tag_sink_event (GstPad * pad, GstEvent * event);
 static GstFlowReturn gst_id3_tag_chain (GstPad * pad, GstBuffer * buffer);
@@ -429,43 +428,34 @@ gst_id3_tag_get_query_types (GstPad * pad)
 }
 
 static gboolean
-gst_id3_tag_src_query (GstPad * pad, GstQueryType type,
-    GstFormat * format, gint64 * value)
+gst_id3_tag_src_query (GstPad * pad, GstQuery * query)
 {
   gboolean res = FALSE;
   GstID3Tag *tag;
 
   tag = GST_ID3_TAG (gst_pad_get_parent (pad));
 
-  switch (type) {
-    case GST_QUERY_TOTAL:{
-      switch (*format) {
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_POSITION:{
+      GstFormat format;
+      gint64 current, total;
+
+      gst_query_parse_position (query, &format, NULL, NULL);
+      switch (format) {
         case GST_FORMAT_BYTES:
           if (GST_PAD_PEER (tag->sinkpad) &&
               tag->state == GST_ID3_TAG_STATE_NORMAL &&
-              gst_pad_query (GST_PAD_PEER (tag->sinkpad), GST_QUERY_TOTAL,
-                  format, value)) {
-            *value -= tag->v2tag_size + tag->v1tag_size;
-            *value += tag->v2tag_size_new + tag->v1tag_size_new;
-            res = TRUE;
-          }
-          break;
-        default:
-          break;
-      }
-      break;
-    }
-    case GST_QUERY_POSITION:
-      switch (*format) {
-        case GST_FORMAT_BYTES:
-          if (GST_PAD_PEER (tag->sinkpad) &&
-              gst_pad_query (GST_PAD_PEER (tag->sinkpad), GST_QUERY_POSITION,
-                  format, value)) {
+              gst_pad_query_position (GST_PAD_PEER (tag->sinkpad),
+                  &format, &current, &total)) {
+            total -= tag->v2tag_size + tag->v1tag_size;
+            total += tag->v2tag_size_new + tag->v1tag_size_new;
             if (tag->state == GST_ID3_TAG_STATE_NORMAL) {
-              *value -= tag->v2tag_size + tag->v2tag_size_new;
+              current -= tag->v2tag_size + tag->v2tag_size_new;
             } else {
-              *value = 0;
+              current = 0;
             }
+            gst_query_set_position (query, format, current, total);
+
             res = TRUE;
           }
           break;
@@ -473,6 +463,7 @@ gst_id3_tag_src_query (GstPad * pad, GstQueryType type,
           break;
       }
       break;
+    }
     default:
       break;
   }
index 1f686db..246f41e 100644 (file)
@@ -1494,8 +1494,8 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
         if (GST_CLOCK_TIME_IS_VALID (mad->last_ts)) {
           GstFormat format = GST_FORMAT_DEFAULT;
 
-          gst_pad_convert (mad->srcpad, GST_FORMAT_TIME, mad->last_ts, &format,
-              &mad->total_samples);
+          gst_pad_query_convert (mad->srcpad, GST_FORMAT_TIME, mad->last_ts,
+              &format, &mad->total_samples);
           mad->last_ts = GST_CLOCK_TIME_NONE;
         }
         time_offset = mad->total_samples * GST_SECOND / mad->rate;