diff --git a/gst/quicktime/atoms.c b/gst/quicktime/atoms.c index bdba5bc5ad..5aebd6b69d 100644 --- a/gst/quicktime/atoms.c +++ b/gst/quicktime/atoms.c @@ -2937,20 +2937,17 @@ atom_moov_add_3gp_uint_tag (AtomMOOV * moov, guint32 fourcc, guint16 value) } void -atom_moov_add_xmp_tags (AtomMOOV * moov, const GstTagList * tags) +atom_moov_add_xmp_tags (AtomMOOV * moov, GstBuffer * xmpbuffer) { - GstBuffer *xmpbuffer; AtomData *data_atom = NULL; if (moov->context.flavor == ATOMS_TREE_FLAVOR_MOV) { - xmpbuffer = gst_tag_list_to_xmp_buffer (tags, TRUE); if (xmpbuffer) { data_atom = atom_data_new_from_gst_buffer (FOURCC_XMP_, xmpbuffer); atom_moov_init_metatags (moov, &moov->context); moov->udta->entries = g_list_append (moov->udta->entries, build_atom_info_wrapper ((Atom *) data_atom, atom_data_copy_data, atom_data_free)); - gst_buffer_unref (xmpbuffer); } } else { GST_DEBUG ("Not adding xmp to moov atom, it is only used in 'mov' format"); @@ -4402,9 +4399,8 @@ build_ima_adpcm_extension (gint channels, gint rate, gint blocksize) } AtomInfo * -build_uuid_xmp_atom (const GstTagList * taglist) +build_uuid_xmp_atom (GstBuffer * xmp_data) { - GstBuffer *xmp_data; AtomUUID *uuid; static guint8 xmp_uuid[] = { 0xBE, 0x7A, 0xCF, 0xCB, 0x97, 0xA9, 0x42, 0xE8, @@ -4412,7 +4408,6 @@ build_uuid_xmp_atom (const GstTagList * taglist) 0x91, 0xE3, 0xAF, 0xAC }; - xmp_data = gst_tag_list_to_xmp_buffer (taglist, TRUE); if (xmp_data == NULL) return NULL; @@ -4423,7 +4418,6 @@ build_uuid_xmp_atom (const GstTagList * taglist) uuid->datalen = GST_BUFFER_SIZE (xmp_data); memcpy (uuid->data, GST_BUFFER_DATA (xmp_data), GST_BUFFER_SIZE (xmp_data)); - gst_buffer_unref (xmp_data); return build_atom_info_wrapper ((Atom *) uuid, atom_uuid_copy_data, atom_uuid_free); } diff --git a/gst/quicktime/atoms.h b/gst/quicktime/atoms.h index d1241184d7..5aeb5f8f65 100644 --- a/gst/quicktime/atoms.h +++ b/gst/quicktime/atoms.h @@ -928,7 +928,7 @@ AtomInfo * build_gama_atom (gdouble gamma); AtomInfo * build_SMI_atom (const GstBuffer *seqh); AtomInfo * build_ima_adpcm_extension (gint channels, gint rate, gint blocksize); -AtomInfo * build_uuid_xmp_atom (const GstTagList * taglist); +AtomInfo * build_uuid_xmp_atom (GstBuffer * xmp); /* @@ -948,7 +948,7 @@ void atom_moov_add_3gp_str_int_tag (AtomMOOV * moov, guint32 fourcc, const gch void atom_moov_add_3gp_tag (AtomMOOV * moov, guint32 fourcc, guint8 * data, guint size); -void atom_moov_add_xmp_tags (AtomMOOV * moov, const GstTagList * tags); +void atom_moov_add_xmp_tags (AtomMOOV * moov, GstBuffer * xmp); #define GST_QT_MUX_DEFAULT_TAG_LANGUAGE "eng" guint16 language_code (const char * lang); diff --git a/gst/quicktime/gstqtmux.c b/gst/quicktime/gstqtmux.c index 0f41474e8f..5c7c4dde46 100644 --- a/gst/quicktime/gstqtmux.c +++ b/gst/quicktime/gstqtmux.c @@ -117,6 +117,7 @@ #include #include +#include #include #ifdef G_OS_WIN32 @@ -1015,6 +1016,7 @@ static void gst_qt_mux_add_xmp_tags (GstQTMux * qtmux, const GstTagList * list) { GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux)); + GstBuffer *xmp = NULL; /* adobe specs only have 'quicktime' and 'mp4', * but I guess we can extrapolate to gpp. @@ -1026,14 +1028,24 @@ gst_qt_mux_add_xmp_tags (GstQTMux * qtmux, const GstTagList * list) GST_DEBUG_OBJECT (qtmux, "Adding xmp tags"); if (qtmux_klass->format == GST_QT_MUX_FORMAT_QT) { - atom_moov_add_xmp_tags (qtmux->moov, list); + xmp = gst_tag_xmp_writer_tag_list_to_xmp_buffer (GST_TAG_XMP_WRITER (qtmux), + list, TRUE); + if (xmp) + atom_moov_add_xmp_tags (qtmux->moov, xmp); } else { + AtomInfo *ainfo; /* for isom/mp4, it is a top level uuid atom */ - AtomInfo *ainfo = build_uuid_xmp_atom (list); - if (ainfo) { - qtmux->extra_atoms = g_slist_prepend (qtmux->extra_atoms, ainfo); + xmp = gst_tag_xmp_writer_tag_list_to_xmp_buffer (GST_TAG_XMP_WRITER (qtmux), + list, TRUE); + if (xmp) { + ainfo = build_uuid_xmp_atom (xmp); + if (ainfo) { + qtmux->extra_atoms = g_slist_prepend (qtmux->extra_atoms, ainfo); + } } } + if (xmp) + gst_buffer_unref (xmp); } static void @@ -3426,6 +3438,9 @@ gst_qt_mux_register (GstPlugin * plugin) static const GInterfaceInfo tag_setter_info = { NULL, NULL, NULL }; + static const GInterfaceInfo tag_xmp_writer_info = { + NULL, NULL, NULL + }; GType type; GstQTMuxFormat format; GstQTMuxClassParams *params; @@ -3455,6 +3470,8 @@ gst_qt_mux_register (GstPlugin * plugin) 0); g_type_set_qdata (type, GST_QT_MUX_PARAMS_QDATA, (gpointer) params); g_type_add_interface_static (type, GST_TYPE_TAG_SETTER, &tag_setter_info); + g_type_add_interface_static (type, GST_TYPE_TAG_XMP_WRITER, + &tag_xmp_writer_info); if (!gst_element_register (plugin, prop->name, GST_RANK_PRIMARY, type)) return FALSE;