gst-libs/gst/tag/gsttagmux.c: Merge event tags and tag setter tags

correctly (#339918). Also, don't leak taglist in case...

Original commit message from CVS:
Patch by: James "Doc" Livingston  <doclivingston gmail com>
* gst-libs/gst/tag/gsttagmux.c: (gst_tag_lib_mux_render_tag):
Merge event tags and tag setter tags correctly (#339918). Also,
don't leak taglist in case of an error.
This commit is contained in:
James Doc Livingston 2006-05-18 12:46:08 +00:00 committed by Tim-Philipp Müller
parent 87e56b7713
commit e286dcec81

View file

@ -134,28 +134,23 @@ static GstBuffer *
gst_tag_lib_mux_render_tag (GstTagLibMux * mux) gst_tag_lib_mux_render_tag (GstTagLibMux * mux)
{ {
GstTagLibMuxClass *klass; GstTagLibMuxClass *klass;
GstTagMergeMode merge_mode;
GstTagSetter *tagsetter;
GstBuffer *buffer; GstBuffer *buffer;
GstTagSetter *tagsetter = GST_TAG_SETTER (mux);
const GstTagList *tagsetter_tags; const GstTagList *tagsetter_tags;
GstTagList *taglist; GstTagList *taglist;
GstEvent *event; GstEvent *event;
if (mux->event_tags != NULL) { tagsetter = GST_TAG_SETTER (mux);
taglist = gst_tag_list_copy (mux->event_tags);
} else {
taglist = gst_tag_list_new ();
}
tagsetter_tags = gst_tag_setter_get_tag_list (tagsetter); tagsetter_tags = gst_tag_setter_get_tag_list (tagsetter);
if (tagsetter_tags) {
GstTagMergeMode merge_mode;
merge_mode = gst_tag_setter_get_tag_merge_mode (tagsetter); merge_mode = gst_tag_setter_get_tag_merge_mode (tagsetter);
GST_LOG_OBJECT (mux, "merging tags, merge mode = %d", merge_mode); GST_LOG_OBJECT (mux, "merging tags, merge mode = %d", merge_mode);
GST_LOG_OBJECT (mux, "event tags: %" GST_PTR_FORMAT, taglist); GST_LOG_OBJECT (mux, "event tags: %" GST_PTR_FORMAT, mux->event_tags);
GST_LOG_OBJECT (mux, "set tags: %" GST_PTR_FORMAT, tagsetter_tags); GST_LOG_OBJECT (mux, "set tags: %" GST_PTR_FORMAT, tagsetter_tags);
gst_tag_list_insert (taglist, tagsetter_tags, merge_mode);
} taglist = gst_tag_list_merge (tagsetter_tags, mux->event_tags, merge_mode);
GST_LOG_OBJECT (mux, "final tags: %" GST_PTR_FORMAT, taglist); GST_LOG_OBJECT (mux, "final tags: %" GST_PTR_FORMAT, taglist);
@ -189,12 +184,14 @@ gst_tag_lib_mux_render_tag (GstTagLibMux * mux)
no_vfunc: no_vfunc:
{ {
GST_ERROR_OBJECT (mux, "Subclass does not implement render_tag vfunc!"); GST_ERROR_OBJECT (mux, "Subclass does not implement render_tag vfunc!");
gst_tag_list_free (taglist);
return NULL; return NULL;
} }
render_error: render_error:
{ {
GST_ERROR_OBJECT (mux, "Failed to render tag"); GST_ERROR_OBJECT (mux, "Failed to render tag");
gst_tag_list_free (taglist);
return NULL; return NULL;
} }
} }