gst-inspect: fix unused-const-variable error in windows
[platform/upstream/gstreamer.git] / gst / gsttagsetter.c
index 2ed099d..ea54c35 100644 (file)
  *
  * You should have received a copy of the GNU Library General Public
  * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
  */
 
 /**
  * SECTION:gsttagsetter
+ * @title: GstTagsetter
  * @short_description: Element interface that allows setting and retrieval
  *                     of media metadata
  *
@@ -29,7 +30,7 @@
  * Elements that support changing a stream's metadata will implement this
  * interface. Examples of such elements are 'vorbisenc', 'theoraenc' and
  * 'id3v2mux'.
- * 
+ *
  * If you just want to retrieve metadata in your application then all you
  * need to do is watch for tag messages on your pipeline's bus. This
  * interface is only for setting metadata, not for extracting it. To set tags
  * setting the #GstTagMergeMode that is used for tag events that arrive at the
  * tagsetter element (default mode is to keep existing tags).
  * The application should do that before the element goes to %GST_STATE_PAUSED.
- * 
+ *
  * Elements implementing the #GstTagSetter interface often have to merge
  * any tags received from upstream and the tags set by the application via
  * the interface. This can be done like this:
  *
- * |[
+ * |[<!-- language="C" -->
  * GstTagMergeMode merge_mode;
  * const GstTagList *application_tags;
  * const GstTagList *event_tags;
  * GstTagSetter *tagsetter;
  * GstTagList *result;
- *  
+ *
  * tagsetter = GST_TAG_SETTER (element);
- *  
+ *
  * merge_mode = gst_tag_setter_get_tag_merge_mode (tagsetter);
  * application_tags = gst_tag_setter_get_tag_list (tagsetter);
  * event_tags = (const GstTagList *) element->event_tags;
- *  
+ *
  * GST_LOG_OBJECT (tagsetter, "merging tags, merge mode = %d", merge_mode);
  * GST_LOG_OBJECT (tagsetter, "event tags: %" GST_PTR_FORMAT, event_tags);
  * GST_LOG_OBJECT (tagsetter, "set   tags: %" GST_PTR_FORMAT, application_tags);
- *  
+ *
  * result = gst_tag_list_merge (application_tags, event_tags, merge_mode);
- *  
+ *
  * GST_LOG_OBJECT (tagsetter, "final tags: %" GST_PTR_FORMAT, result);
  * ]|
- * 
- * Last reviewed on 2006-05-18 (0.10.6)
  */
 
 #ifdef HAVE_CONFIG_H
@@ -89,35 +88,14 @@ typedef struct
 #define GST_TAG_DATA_LOCK(data) g_mutex_lock(&data->lock)
 #define GST_TAG_DATA_UNLOCK(data) g_mutex_unlock(&data->lock)
 
-GType
-gst_tag_setter_get_type (void)
-{
-  static volatile gsize tag_setter_type = 0;
-
-  if (g_once_init_enter (&tag_setter_type)) {
-    GType _type;
-    static const GTypeInfo tag_setter_info = {
-      sizeof (GstTagSetterInterface),   /* class_size */
-      NULL,                     /* base_init */
-      NULL,                     /* base_finalize */
-      NULL,
-      NULL,                     /* class_finalize */
-      NULL,                     /* class_data */
-      0,
-      0,
-      NULL
-    };
-
-    _type = g_type_register_static (G_TYPE_INTERFACE, "GstTagSetter",
-        &tag_setter_info, 0);
-
-    g_type_interface_add_prerequisite (_type, GST_TYPE_ELEMENT);
-
-    gst_tag_key = g_quark_from_static_string ("GST_TAG_SETTER");
-    g_once_init_leave (&tag_setter_type, _type);
-  }
+G_DEFINE_INTERFACE_WITH_CODE (GstTagSetter, gst_tag_setter, GST_TYPE_ELEMENT,
+    gst_tag_key = g_quark_from_static_string ("gst-tag-setter-data");
+    );
 
-  return tag_setter_type;
+static void
+gst_tag_setter_default_init (GstTagSetterInterface * klass)
+{
+  /* nothing to do here, it's a dummy interface */
 }
 
 static void
@@ -126,7 +104,7 @@ gst_tag_data_free (gpointer p)
   GstTagData *data = (GstTagData *) p;
 
   if (data->list)
-    gst_tag_list_free (data->list);
+    gst_tag_list_unref (data->list);
 
   g_mutex_clear (&data->lock);
 
@@ -167,8 +145,6 @@ gst_tag_setter_get_data (GstTagSetter * setter)
  *
  * Reset the internal taglist. Elements should call this from within the
  * state-change handler.
- *
- * Since: 0.10.22
  */
 void
 gst_tag_setter_reset_tags (GstTagSetter * setter)
@@ -181,7 +157,7 @@ gst_tag_setter_reset_tags (GstTagSetter * setter)
 
   GST_TAG_DATA_LOCK (data);
   if (data->list) {
-    gst_tag_list_free (data->list);
+    gst_tag_list_unref (data->list);
     data->list = NULL;
   }
   GST_TAG_DATA_UNLOCK (data);
@@ -225,7 +201,7 @@ gst_tag_setter_merge_tags (GstTagSetter * setter, const GstTagList * list,
  * @...: more tag / value pairs to set
  *
  * Adds the given tag / value pairs on the setter using the given merge mode.
- * The list must be terminated with NULL.
+ * The list must be terminated with %NULL.
  */
 void
 gst_tag_setter_add_tags (GstTagSetter * setter, GstTagMergeMode mode,
@@ -249,7 +225,7 @@ gst_tag_setter_add_tags (GstTagSetter * setter, GstTagMergeMode mode,
  * @...: more tag / GValue pairs to set
  *
  * Adds the given tag / GValue pairs on the setter using the given merge mode.
- * The list must be terminated with NULL.
+ * The list must be terminated with %NULL.
  */
 void
 gst_tag_setter_add_tag_values (GstTagSetter * setter, GstTagMergeMode mode,
@@ -273,7 +249,7 @@ gst_tag_setter_add_tag_values (GstTagSetter * setter, GstTagMergeMode mode,
  * @var_args: tag / value pairs to set
  *
  * Adds the given tag / value pairs on the setter using the given merge mode.
- * The list must be terminated with NULL.
+ * The list must be terminated with %NULL.
  */
 void
 gst_tag_setter_add_tag_valist (GstTagSetter * setter, GstTagMergeMode mode,
@@ -303,7 +279,7 @@ gst_tag_setter_add_tag_valist (GstTagSetter * setter, GstTagMergeMode mode,
  * @var_args: tag / GValue pairs to set
  *
  * Adds the given tag / GValue pairs on the setter using the given merge mode.
- * The list must be terminated with NULL.
+ * The list must be terminated with %NULL.
  */
 void
 gst_tag_setter_add_tag_valist_values (GstTagSetter * setter,
@@ -334,8 +310,6 @@ gst_tag_setter_add_tag_valist_values (GstTagSetter * setter,
  * @value: GValue to set for the tag
  *
  * Adds the given tag / GValue pair on the setter using the given merge mode.
- *
- * Since: 0.10.24
  */
 void
 gst_tag_setter_add_tag_value (GstTagSetter * setter,
@@ -367,8 +341,8 @@ gst_tag_setter_add_tag_value (GstTagSetter * setter,
  *
  * This function is not thread-safe.
  *
- * Returns: (transfer none): a current snapshot of the taglist used in the
- *          setter or NULL if none is used.
+ * Returns: (transfer none) (nullable): a current snapshot of the
+ *          taglist used in the setter or %NULL if none is used.
  */
 const GstTagList *
 gst_tag_setter_get_tag_list (GstTagSetter * setter)