Make GstCaps parameter const. Copy caps parameter. Use _POINTER to marshal caps...
authorColin Walters <walters@verbum.org>
Wed, 24 Dec 2003 07:42:43 +0000 (07:42 +0000)
committerColin Walters <walters@verbum.org>
Wed, 24 Dec 2003 07:42:43 +0000 (07:42 +0000)
Original commit message from CVS:
Make GstCaps parameter const.  Copy caps parameter. Use _POINTER to
marshal caps instead of _BOXED.  Don't double-free caps.Use
GST_PAD_LINK_SUCCESSFUL.

ChangeLog
gst/elements/gsttypefind.c
gst/elements/gsttypefind.h
gst/elements/gsttypefindelement.c
gst/elements/gsttypefindelement.h
gst/gstmarshal.list
plugins/elements/gsttypefind.c
plugins/elements/gsttypefind.h
plugins/elements/gsttypefindelement.c
plugins/elements/gsttypefindelement.h

index a2cd27d..cb844d5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-12-24  Colin Walters  <walters@verbum.org>
+
+       * gst/elements/gsttypefindelement.c:
+         gst/elements/gsttypefindelement.h: Make GstCaps parameter const.
+         Copy caps parameter. Use _POINTER to marshal caps instead of _BOXED.
+         Don't double-free caps.
+
 2003-12-23  David Schleef  <ds@schleef.org>
 
        * gst/gstelement.c, gst/gstpad.c, gst/parse/grammar.y,
index c38099a..8162084 100644 (file)
@@ -141,7 +141,7 @@ gst_type_find_element_get_type (void)
   return typefind_type;
 }
 static void
-gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, GstCaps *caps)
+gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
 {
   gchar *caps_str;
   
@@ -151,7 +151,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   caps_str = gst_caps_to_string (caps);
   GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
   g_free (caps_str);
-  gst_caps_replace (&typefind->caps, caps);
+  typefind->caps = gst_caps_copy (caps);
   if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
     gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
   }
@@ -195,8 +195,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
   gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type", 
          G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
-          gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
-          G_TYPE_UINT, gst_caps_get_type());
+          gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
+          G_TYPE_UINT, G_TYPE_POINTER);
 
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
 }
@@ -669,7 +669,8 @@ gst_type_find_element_change_state (GstElement *element)
       break;
     case GST_STATE_PAUSED_TO_READY:
       stop_typefinding (typefind);
-      gst_caps_replace (&typefind->caps, NULL);
+      if (typefind->caps)
+       gst_caps_free (typefind->caps);
       break;
     default:
       break;
index 7f508ba..03eeccd 100644 (file)
@@ -66,7 +66,7 @@ struct _GstTypeFindElementClass {
   /* signals */
   void                         (*have_type)    (GstTypeFindElement *element,
                                         guint          probability,
-                                        GstCaps *      caps);
+                                        const GstCaps *        caps);
 };
 
 GType gst_type_find_element_get_type (void);
index c38099a..8162084 100644 (file)
@@ -141,7 +141,7 @@ gst_type_find_element_get_type (void)
   return typefind_type;
 }
 static void
-gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, GstCaps *caps)
+gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
 {
   gchar *caps_str;
   
@@ -151,7 +151,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   caps_str = gst_caps_to_string (caps);
   GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
   g_free (caps_str);
-  gst_caps_replace (&typefind->caps, caps);
+  typefind->caps = gst_caps_copy (caps);
   if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
     gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
   }
@@ -195,8 +195,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
   gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type", 
          G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
-          gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
-          G_TYPE_UINT, gst_caps_get_type());
+          gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
+          G_TYPE_UINT, G_TYPE_POINTER);
 
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
 }
@@ -669,7 +669,8 @@ gst_type_find_element_change_state (GstElement *element)
       break;
     case GST_STATE_PAUSED_TO_READY:
       stop_typefinding (typefind);
-      gst_caps_replace (&typefind->caps, NULL);
+      if (typefind->caps)
+       gst_caps_free (typefind->caps);
       break;
     default:
       break;
index 7f508ba..03eeccd 100644 (file)
@@ -66,7 +66,7 @@ struct _GstTypeFindElementClass {
   /* signals */
   void                         (*have_type)    (GstTypeFindElement *element,
                                         guint          probability,
-                                        GstCaps *      caps);
+                                        const GstCaps *        caps);
 };
 
 GType gst_type_find_element_get_type (void);
index fabedd9..f136fbb 100644 (file)
@@ -11,5 +11,6 @@ VOID:OBJECT,STRING
 VOID:INT,INT
 VOID:INT64
 VOID:UINT,BOXED
+VOID:UINT,POINTER
 BOOLEAN:VOID
 BOOLEAN:POINTER
index c38099a..8162084 100644 (file)
@@ -141,7 +141,7 @@ gst_type_find_element_get_type (void)
   return typefind_type;
 }
 static void
-gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, GstCaps *caps)
+gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
 {
   gchar *caps_str;
   
@@ -151,7 +151,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   caps_str = gst_caps_to_string (caps);
   GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
   g_free (caps_str);
-  gst_caps_replace (&typefind->caps, caps);
+  typefind->caps = gst_caps_copy (caps);
   if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
     gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
   }
@@ -195,8 +195,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
   gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type", 
          G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
-          gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
-          G_TYPE_UINT, gst_caps_get_type());
+          gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
+          G_TYPE_UINT, G_TYPE_POINTER);
 
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
 }
@@ -669,7 +669,8 @@ gst_type_find_element_change_state (GstElement *element)
       break;
     case GST_STATE_PAUSED_TO_READY:
       stop_typefinding (typefind);
-      gst_caps_replace (&typefind->caps, NULL);
+      if (typefind->caps)
+       gst_caps_free (typefind->caps);
       break;
     default:
       break;
index 7f508ba..03eeccd 100644 (file)
@@ -66,7 +66,7 @@ struct _GstTypeFindElementClass {
   /* signals */
   void                         (*have_type)    (GstTypeFindElement *element,
                                         guint          probability,
-                                        GstCaps *      caps);
+                                        const GstCaps *        caps);
 };
 
 GType gst_type_find_element_get_type (void);
index c38099a..8162084 100644 (file)
@@ -141,7 +141,7 @@ gst_type_find_element_get_type (void)
   return typefind_type;
 }
 static void
-gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, GstCaps *caps)
+gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
 {
   gchar *caps_str;
   
@@ -151,7 +151,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   caps_str = gst_caps_to_string (caps);
   GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
   g_free (caps_str);
-  gst_caps_replace (&typefind->caps, caps);
+  typefind->caps = gst_caps_copy (caps);
   if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
     gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
   }
@@ -195,8 +195,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
   gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type", 
          G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
-          gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
-          G_TYPE_UINT, gst_caps_get_type());
+          gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
+          G_TYPE_UINT, G_TYPE_POINTER);
 
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
 }
@@ -669,7 +669,8 @@ gst_type_find_element_change_state (GstElement *element)
       break;
     case GST_STATE_PAUSED_TO_READY:
       stop_typefinding (typefind);
-      gst_caps_replace (&typefind->caps, NULL);
+      if (typefind->caps)
+       gst_caps_free (typefind->caps);
       break;
     default:
       break;
index 7f508ba..03eeccd 100644 (file)
@@ -66,7 +66,7 @@ struct _GstTypeFindElementClass {
   /* signals */
   void                         (*have_type)    (GstTypeFindElement *element,
                                         guint          probability,
-                                        GstCaps *      caps);
+                                        const GstCaps *        caps);
 };
 
 GType gst_type_find_element_get_type (void);