ext/mad/gstmad.*: Fix compilation with --disable-index. Fixes bug #554142.
authorSameer Naik <sameer.subscriptions@damagehead.com>
Sun, 28 Sep 2008 17:31:37 +0000 (17:31 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Sun, 28 Sep 2008 17:31:37 +0000 (17:31 +0000)
Original commit message from CVS:
Patch by: Sameer Naik <sameer dot subscriptions at damagehead dot com>
* ext/mad/gstmad.c: (gst_mad_class_init), (gst_mad_dispose),
(gst_mad_src_event), (gst_mad_chain):
* ext/mad/gstmad.h:
Fix compilation with --disable-index. Fixes bug #554142.

ChangeLog
ext/mad/gstmad.c
ext/mad/gstmad.h

index feeef98..312e7aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-09-28  Sebastian Dröge  <sebastian.droege@collabora.co.uk>
+
+       Patch by: Sameer Naik <sameer dot subscriptions at damagehead dot com>
+
+       * ext/mad/gstmad.c: (gst_mad_class_init), (gst_mad_dispose),
+       (gst_mad_src_event), (gst_mad_chain):
+       * ext/mad/gstmad.h:
+       Fix compilation with --disable-index. Fixes bug #554142.
+
 2008-09-27  Jan Schmidt  <jan.schmidt@sun.com>
 
        * ext/a52dec/gsta52dec.c:
index e9bb077..4b4c9fd 100644 (file)
@@ -109,8 +109,10 @@ static GstFlowReturn gst_mad_chain (GstPad * pad, GstBuffer * buffer);
 static GstStateChangeReturn gst_mad_change_state (GstElement * element,
     GstStateChange transition);
 
+#ifndef GST_DISABLE_INDEX
 static void gst_mad_set_index (GstElement * element, GstIndex * index);
 static GstIndex *gst_mad_get_index (GstElement * element);
+#endif
 
 static void
 _do_init (GType type)
@@ -192,6 +194,7 @@ gst_mad_base_init (gpointer g_class)
       gst_static_pad_template_get (&mad_src_template_factory));
   gst_element_class_set_details (element_class, &gst_mad_details);
 }
+
 static void
 gst_mad_class_init (GstMadClass * klass)
 {
@@ -208,8 +211,10 @@ gst_mad_class_init (GstMadClass * klass)
   gobject_class->dispose = gst_mad_dispose;
 
   gstelement_class->change_state = gst_mad_change_state;
+#ifndef GST_DISABLE_INDEX
   gstelement_class->set_index = gst_mad_set_index;
   gstelement_class->get_index = gst_mad_get_index;
+#endif
 
   /* init properties */
   /* currently, string representations are used, we might want to change that */
@@ -293,7 +298,9 @@ gst_mad_dispose (GObject * object)
 {
   GstMad *mad = GST_MAD (object);
 
+#ifndef GST_DISABLE_INDEX
   gst_mad_set_index (GST_ELEMENT (object), NULL);
+#endif
 
   g_free (mad->tempbuffer);
   mad->tempbuffer = NULL;
@@ -305,6 +312,7 @@ gst_mad_dispose (GObject * object)
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
+#ifndef GST_DISABLE_INDEX
 static void
 gst_mad_set_index (GstElement * element, GstIndex * index)
 {
@@ -323,6 +331,7 @@ gst_mad_get_index (GstElement * element)
 
   return mad->index;
 }
+#endif
 
 static gboolean
 gst_mad_convert_sink (GstPad * pad, GstFormat src_format, gint64 src_value,
@@ -606,6 +615,7 @@ error:
   return FALSE;
 }
 
+#ifndef GST_DISABLE_INDEX
 static gboolean
 index_seek (GstMad * mad, GstPad * pad, GstEvent * event)
 {
@@ -679,6 +689,7 @@ index_seek (GstMad * mad, GstPad * pad, GstEvent * event)
 
   return FALSE;
 }
+#endif
 
 static gboolean
 normal_seek (GstMad * mad, GstPad * pad, GstEvent * event)
@@ -804,9 +815,11 @@ gst_mad_src_event (GstPad * pad, GstEvent * event)
     case GST_EVENT_SEEK:
       gst_event_ref (event);
       if (!(res = gst_pad_event_default (pad, event))) {
+#ifndef GST_DISABLE_INDEX
         if (mad->index)
           res = index_seek (mad, pad, event);
         else
+#endif
           res = normal_seek (mad, pad, event);
       }
       break;
@@ -864,6 +877,7 @@ gst_mad_set_property (GObject * object, guint prop_id,
       break;
   }
 }
+
 static void
 gst_mad_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec)
@@ -1544,12 +1558,14 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
             GST_SECOND, mad->rate) - time_offset;
       }
 
+#ifndef GST_DISABLE_INDEX
       if (mad->index) {
         guint64 x_bytes = mad->base_byte_offset + mad->bytes_consumed;
 
         gst_index_add_association (mad->index, mad->index_id, 0,
             GST_FORMAT_BYTES, x_bytes, GST_FORMAT_TIME, time_offset, NULL);
       }
+#endif
 
       if (mad->segment_start <= (time_offset ==
               GST_CLOCK_TIME_NONE ? 0 : time_offset)) {
index 3f0177f..b652ac2 100644 (file)
@@ -85,8 +85,10 @@ struct _GstMad
   gint times_pending;
 
   gboolean caps_set;            /* used to keep track of whether to change/update caps */
+#ifndef GST_DISABLE_INDEX
   GstIndex *index;
   gint index_id;
+#endif
 
   gboolean check_for_xing;
   gboolean xing_found;