From 2e25b024cc55c099f162e96c3fd9ac96865ab42a Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 16 Dec 2008 14:05:40 +0000 Subject: [PATCH] Add function to reset tagsetter for element reuse. Original commit message from CVS: * docs/gst/gstreamer-sections.txt: * gst/gsttagsetter.c: * gst/gsttagsetter.h: Add function to reset tagsetter for element reuse. API: gst_tag_setter_flush() --- ChangeLog | 8 ++++++++ docs/gst/gstreamer-sections.txt | 1 + gst/gsttagsetter.c | 26 ++++++++++++++++++++++++-- gst/gsttagsetter.h | 2 ++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 899321a7b2..8436b711b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-12-16 Stefan Kost + + * docs/gst/gstreamer-sections.txt: + * gst/gsttagsetter.c: + * gst/gsttagsetter.h: + Add function to reset tagsetter for element reuse. + API: gst_tag_setter_flush() + 2008-12-16 Stefan Kost * gst/gsttaglist.c: diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 27bc89c0dd..53edf8701a 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -2107,6 +2107,7 @@ gst_tag_merge_mode_get_type GstTagSetter GstTagSetter GstTagSetterIFace +gst_tag_setter_flush gst_tag_setter_merge_tags gst_tag_setter_add_tags gst_tag_setter_add_tag_values diff --git a/gst/gsttagsetter.c b/gst/gsttagsetter.c index 06c78061ea..6d6f44cce3 100644 --- a/gst/gsttagsetter.c +++ b/gst/gsttagsetter.c @@ -86,8 +86,7 @@ typedef struct { GstTagMergeMode mode; GstTagList *list; -} -GstTagData; +} GstTagData; GType gst_tag_setter_get_type (void) @@ -120,6 +119,7 @@ gst_tag_setter_get_type (void) return tag_setter_type; } + static void gst_tag_data_free (gpointer p) { @@ -130,6 +130,7 @@ gst_tag_data_free (gpointer p) g_free (data); } + static GstTagData * gst_tag_setter_get_data (GstTagSetter * setter) { @@ -147,6 +148,27 @@ gst_tag_setter_get_data (GstTagSetter * setter) return data; } +/** + * gst_tag_setter_flush: + * @setter: a #GstTagSetter + * + * Reset the internal taglist. Elements should call this from within the + * state-change handler. + */ +void +gst_tag_setter_flush (GstTagSetter * setter) +{ + GstTagData *data; + + g_return_if_fail (GST_IS_TAG_SETTER (setter)); + + data = gst_tag_setter_get_data (setter); + if (data->list) { + gst_tag_list_free (data->list); + data->list = NULL; + } +} + /** * gst_tag_setter_merge_tags: * @setter: a #GstTagSetter diff --git a/gst/gsttagsetter.h b/gst/gsttagsetter.h index f7941c1805..c024a751a0 100644 --- a/gst/gsttagsetter.h +++ b/gst/gsttagsetter.h @@ -58,6 +58,8 @@ struct _GstTagSetterIFace GType gst_tag_setter_get_type (void); +void gst_tag_setter_flush (GstTagSetter * setter); + void gst_tag_setter_merge_tags (GstTagSetter * setter, const GstTagList * list, GstTagMergeMode mode);