qtmux: refactor tags functions to accomodata UDTA at trak level

Refactor the functions that were bound to the 'moov' atom to
directly pass the desired 'udta' that should receive the tags.
This allows the tags to be written to 'udta' at the 'moov' or
the 'trak' level, creating tags that are for the container or
for a stream only.

https://bugzilla.gnome.org/show_bug.cgi?id=692473
This commit is contained in:
Thiago Santos 2015-01-31 13:14:44 -03:00
parent f0fde8be88
commit 6321cdedb3
3 changed files with 165 additions and 167 deletions

View file

@ -1040,42 +1040,6 @@ atom_tkhd_clear (AtomTKHD * tkhd)
atom_full_clear (&tkhd->header);
}
static void
atom_trak_init (AtomTRAK * trak, AtomsContext * context)
{
atom_header_set (&trak->header, FOURCC_trak, 0, 0);
atom_tkhd_init (&trak->tkhd, context);
trak->edts = NULL;
atom_mdia_init (&trak->mdia, context);
}
AtomTRAK *
atom_trak_new (AtomsContext * context)
{
AtomTRAK *trak = g_new0 (AtomTRAK, 1);
atom_trak_init (trak, context);
return trak;
}
static void
atom_trak_clear (AtomTRAK * trak)
{
atom_clear (&trak->header);
atom_tkhd_clear (&trak->tkhd);
if (trak->edts)
atom_edts_free (trak->edts);
atom_mdia_clear (&trak->mdia);
}
static void
atom_trak_free (AtomTRAK * trak)
{
atom_trak_clear (trak);
g_free (trak);
}
static void
atom_ilst_init (AtomILST * ilst)
{
@ -1135,23 +1099,30 @@ atom_meta_free (AtomMETA * meta)
}
static void
atom_udta_init (AtomUDTA * udta)
atom_udta_init_metatags (AtomUDTA * udta, AtomsContext * context)
{
atom_header_set (&udta->header, FOURCC_udta, 0, 0);
udta->meta = NULL;
}
static AtomUDTA *
atom_udta_new (void)
{
AtomUDTA *udta = g_new0 (AtomUDTA, 1);
atom_udta_init (udta);
return udta;
if (context->flavor != ATOMS_TREE_FLAVOR_3GP) {
if (!udta->meta) {
udta->meta = atom_meta_new (context);
}
if (!udta->meta->ilst) {
udta->meta->ilst = atom_ilst_new ();
}
}
}
static void
atom_udta_free (AtomUDTA * udta)
atom_udta_init (AtomUDTA * udta, AtomsContext * context)
{
atom_header_set (&udta->header, FOURCC_udta, 0, 0);
udta->meta = NULL;
udta->context = context;
atom_udta_init_metatags (udta, context);
}
static void
atom_udta_clear (AtomUDTA * udta)
{
atom_clear (&udta->header);
if (udta->meta)
@ -1159,7 +1130,6 @@ atom_udta_free (AtomUDTA * udta)
udta->meta = NULL;
if (udta->entries)
atom_info_list_free (udta->entries);
g_free (udta);
}
static void
@ -1253,13 +1223,53 @@ atom_mvex_init (AtomMVEX * mvex)
mvex->trexs = NULL;
}
static void
atom_trak_init (AtomTRAK * trak, AtomsContext * context)
{
atom_header_set (&trak->header, FOURCC_trak, 0, 0);
atom_tkhd_init (&trak->tkhd, context);
trak->context = context;
atom_udta_init (&trak->udta, context);
trak->edts = NULL;
atom_mdia_init (&trak->mdia, context);
}
AtomTRAK *
atom_trak_new (AtomsContext * context)
{
AtomTRAK *trak = g_new0 (AtomTRAK, 1);
atom_trak_init (trak, context);
return trak;
}
static void
atom_trak_clear (AtomTRAK * trak)
{
atom_clear (&trak->header);
atom_tkhd_clear (&trak->tkhd);
if (trak->edts)
atom_edts_free (trak->edts);
atom_udta_clear (&trak->udta);
atom_mdia_clear (&trak->mdia);
}
static void
atom_trak_free (AtomTRAK * trak)
{
atom_trak_clear (trak);
g_free (trak);
}
static void
atom_moov_init (AtomMOOV * moov, AtomsContext * context)
{
atom_header_set (&(moov->header), FOURCC_moov, 0, 0);
atom_mvhd_init (&(moov->mvhd));
atom_mvex_init (&(moov->mvex));
moov->udta = NULL;
atom_udta_init (&moov->udta, context);
moov->traks = NULL;
moov->context = *context;
}
@ -1311,11 +1321,7 @@ atom_moov_free (AtomMOOV * moov)
g_list_free (moov->traks);
moov->traks = NULL;
if (moov->udta) {
atom_udta_free (moov->udta);
moov->udta = NULL;
}
atom_udta_clear (&moov->udta);
atom_mvex_clear (&moov->mvex);
g_free (moov);
@ -2303,32 +2309,6 @@ atom_edts_copy_data (AtomEDTS * edts, guint8 ** buffer, guint64 * size,
return *offset - original_offset;
}
guint64
atom_trak_copy_data (AtomTRAK * trak, guint8 ** buffer, guint64 * size,
guint64 * offset)
{
guint64 original_offset = *offset;
if (!atom_copy_data (&trak->header, buffer, size, offset)) {
return 0;
}
if (!atom_tkhd_copy_data (&trak->tkhd, buffer, size, offset)) {
return 0;
}
if (trak->edts) {
if (!atom_edts_copy_data (trak->edts, buffer, size, offset)) {
return 0;
}
}
if (!atom_mdia_copy_data (&trak->mdia, buffer, size, offset)) {
return 0;
}
atom_write_size (buffer, size, offset, original_offset);
return *offset - original_offset;
}
static guint64
atom_tag_data_copy_data (AtomTagData * data, guint8 ** buffer, guint64 * size,
guint64 * offset)
@ -2492,6 +2472,37 @@ atom_mvex_copy_data (AtomMVEX * mvex, guint8 ** buffer, guint64 * size,
return *offset - original_offset;
}
guint64
atom_trak_copy_data (AtomTRAK * trak, guint8 ** buffer, guint64 * size,
guint64 * offset)
{
guint64 original_offset = *offset;
if (!atom_copy_data (&trak->header, buffer, size, offset)) {
return 0;
}
if (!atom_tkhd_copy_data (&trak->tkhd, buffer, size, offset)) {
return 0;
}
if (trak->edts) {
if (!atom_edts_copy_data (trak->edts, buffer, size, offset)) {
return 0;
}
}
if (!atom_mdia_copy_data (&trak->mdia, buffer, size, offset)) {
return 0;
}
if (!atom_udta_copy_data (&trak->udta, buffer, size, offset)) {
return 0;
}
atom_write_size (buffer, size, offset, original_offset);
return *offset - original_offset;
}
guint64
atom_moov_copy_data (AtomMOOV * atom, guint8 ** buffer, guint64 * size,
guint64 * offset)
@ -2513,10 +2524,8 @@ atom_moov_copy_data (AtomMOOV * atom, guint8 ** buffer, guint64 * size,
walker = g_list_next (walker);
}
if (atom->udta) {
if (!atom_udta_copy_data (atom->udta, buffer, size, offset)) {
return 0;
}
if (!atom_udta_copy_data (&atom->udta, buffer, size, offset)) {
return 0;
}
if (atom->fragmented) {
@ -2948,22 +2957,6 @@ atom_trak_tx3g_update_dimension (AtomTRAK * trak, guint32 width, guint32 height)
/*
* Meta tags functions
*/
static void
atom_moov_init_metatags (AtomMOOV * moov, AtomsContext * context)
{
if (!moov->udta) {
moov->udta = atom_udta_new ();
}
if (context->flavor != ATOMS_TREE_FLAVOR_3GP) {
if (!moov->udta->meta) {
moov->udta->meta = atom_meta_new (context);
}
if (!moov->udta->meta->ilst) {
moov->udta->meta->ilst = atom_ilst_new ();
}
}
}
static void
atom_tag_data_alloc_data (AtomTagData * data, guint size)
{
@ -2975,20 +2968,19 @@ atom_tag_data_alloc_data (AtomTagData * data, guint size)
}
static void
atom_moov_append_tag (AtomMOOV * moov, AtomInfo * tag)
atom_udta_append_tag (AtomUDTA * udta, AtomInfo * tag)
{
GList **entries;
atom_moov_init_metatags (moov, &moov->context);
if (moov->udta->meta)
entries = &moov->udta->meta->ilst->entries;
if (udta->meta)
entries = &udta->meta->ilst->entries;
else
entries = &moov->udta->entries;
entries = &udta->entries;
*entries = g_list_append (*entries, tag);
}
void
atom_moov_add_tag (AtomMOOV * moov, guint32 fourcc, guint32 flags,
atom_udta_add_tag (AtomUDTA * udta, guint32 fourcc, guint32 flags,
const guint8 * data, guint size)
{
AtomTag *tag;
@ -2999,32 +2991,32 @@ atom_moov_add_tag (AtomMOOV * moov, guint32 fourcc, guint32 flags,
atom_tag_data_alloc_data (tdata, size);
memmove (tdata->data, data, size);
atom_moov_append_tag (moov,
atom_udta_append_tag (udta,
build_atom_info_wrapper ((Atom *) tag, atom_tag_copy_data,
atom_tag_free));
}
void
atom_moov_add_str_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value)
atom_udta_add_str_tag (AtomUDTA * udta, guint32 fourcc, const gchar * value)
{
gint len = strlen (value);
if (len > 0)
atom_moov_add_tag (moov, fourcc, METADATA_TEXT_FLAG, (guint8 *) value, len);
atom_udta_add_tag (udta, fourcc, METADATA_TEXT_FLAG, (guint8 *) value, len);
}
void
atom_moov_add_uint_tag (AtomMOOV * moov, guint32 fourcc, guint32 flags,
atom_udta_add_uint_tag (AtomUDTA * udta, guint32 fourcc, guint32 flags,
guint32 value)
{
guint8 data[8] = { 0, };
if (flags) {
GST_WRITE_UINT16_BE (data, value);
atom_moov_add_tag (moov, fourcc, flags, data, 2);
atom_udta_add_tag (udta, fourcc, flags, data, 2);
} else {
GST_WRITE_UINT32_BE (data + 2, value);
atom_moov_add_tag (moov, fourcc, flags, data, 8);
atom_udta_add_tag (udta, fourcc, flags, data, 8);
}
}
@ -3042,7 +3034,7 @@ _gst_buffer_new_wrapped (gpointer mem, gsize size, GFreeFunc free_func)
}
void
atom_moov_add_blob_tag (AtomMOOV * moov, guint8 * data, guint size)
atom_udta_add_blob_tag (AtomUDTA * udta, guint8 * data, guint size)
{
AtomData *data_atom;
GstBuffer *buf;
@ -3063,13 +3055,13 @@ atom_moov_add_blob_tag (AtomMOOV * moov, guint8 * data, guint size)
data_atom = atom_data_new_from_gst_buffer (fourcc, buf);
gst_buffer_unref (buf);
atom_moov_append_tag (moov,
atom_udta_append_tag (udta,
build_atom_info_wrapper ((Atom *) data_atom, atom_data_copy_data,
atom_data_free));
}
void
atom_moov_add_3gp_tag (AtomMOOV * moov, guint32 fourcc, guint8 * data,
atom_udta_add_3gp_tag (AtomUDTA * udta, guint32 fourcc, guint8 * data,
guint size)
{
AtomData *data_atom;
@ -3086,7 +3078,7 @@ atom_moov_add_3gp_tag (AtomMOOV * moov, guint32 fourcc, guint8 * data,
data_atom = atom_data_new_from_gst_buffer (fourcc, buf);
gst_buffer_unref (buf);
atom_moov_append_tag (moov,
atom_udta_append_tag (udta,
build_atom_info_wrapper ((Atom *) data_atom, atom_data_copy_data,
atom_data_free));
}
@ -3102,7 +3094,7 @@ language_code (const char *lang)
}
void
atom_moov_add_3gp_str_int_tag (AtomMOOV * moov, guint32 fourcc,
atom_udta_add_3gp_str_int_tag (AtomUDTA * udta, guint32 fourcc,
const gchar * value, gint16 ivalue)
{
gint len = 0, size = 0;
@ -3133,39 +3125,37 @@ atom_moov_add_3gp_str_int_tag (AtomMOOV * moov, guint32 fourcc,
}
}
atom_moov_add_3gp_tag (moov, fourcc, data, size);
atom_udta_add_3gp_tag (udta, fourcc, data, size);
g_free (data);
}
void
atom_moov_add_3gp_str_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value)
atom_udta_add_3gp_str_tag (AtomUDTA * udta, guint32 fourcc, const gchar * value)
{
atom_moov_add_3gp_str_int_tag (moov, fourcc, value, -1);
atom_udta_add_3gp_str_int_tag (udta, fourcc, value, -1);
}
void
atom_moov_add_3gp_uint_tag (AtomMOOV * moov, guint32 fourcc, guint16 value)
atom_udta_add_3gp_uint_tag (AtomUDTA * udta, guint32 fourcc, guint16 value)
{
atom_moov_add_3gp_str_int_tag (moov, fourcc, NULL, value);
atom_udta_add_3gp_str_int_tag (udta, fourcc, NULL, value);
}
void
atom_moov_add_xmp_tags (AtomMOOV * moov, GstBuffer * xmpbuffer)
atom_udta_add_xmp_tags (AtomUDTA * udta, GstBuffer * xmpbuffer)
{
AtomData *data_atom = NULL;
if (moov->context.flavor == ATOMS_TREE_FLAVOR_MOV) {
if (udta->context->flavor == ATOMS_TREE_FLAVOR_MOV) {
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,
udta->entries = g_list_append (udta->entries,
build_atom_info_wrapper ((Atom *) data_atom, atom_data_copy_data,
atom_data_free));
}
} else {
GST_DEBUG ("Not adding xmp to moov atom, it is only used in 'mov' format");
}
}
/*

View file

@ -597,6 +597,8 @@ typedef struct _AtomUDTA
GList* entries;
/* or list is further down */
AtomMETA *meta;
AtomsContext *context;
} AtomUDTA;
enum TrFlags
@ -626,10 +628,13 @@ typedef struct _AtomTRAK
AtomTKHD tkhd;
AtomEDTS *edts;
AtomMDIA mdia;
AtomUDTA udta;
/* some helper info for structural conformity checks */
gboolean is_video;
gboolean is_h264;
AtomsContext *context;
} AtomTRAK;
typedef struct _AtomTREX
@ -746,7 +751,7 @@ typedef struct _AtomMOOV
/* list of AtomTRAK */
GList *traks;
AtomUDTA *udta;
AtomUDTA udta;
gboolean fragmented;
} AtomMOOV;
@ -969,21 +974,21 @@ AtomInfo * build_uuid_xmp_atom (GstBuffer * xmp);
/*
* Meta tags functions
*/
void atom_moov_add_str_tag (AtomMOOV *moov, guint32 fourcc, const gchar *value);
void atom_moov_add_uint_tag (AtomMOOV *moov, guint32 fourcc, guint32 flags,
void atom_udta_add_str_tag (AtomUDTA *udta, guint32 fourcc, const gchar *value);
void atom_udta_add_uint_tag (AtomUDTA *udta, guint32 fourcc, guint32 flags,
guint32 value);
void atom_moov_add_tag (AtomMOOV *moov, guint32 fourcc, guint32 flags,
void atom_udta_add_tag (AtomUDTA *udta, guint32 fourcc, guint32 flags,
const guint8 * data, guint size);
void atom_moov_add_blob_tag (AtomMOOV *moov, guint8 *data, guint size);
void atom_udta_add_blob_tag (AtomUDTA *udta, guint8 *data, guint size);
void atom_moov_add_3gp_str_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value);
void atom_moov_add_3gp_uint_tag (AtomMOOV * moov, guint32 fourcc, guint16 value);
void atom_moov_add_3gp_str_int_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value,
void atom_udta_add_3gp_str_tag (AtomUDTA *udta, guint32 fourcc, const gchar * value);
void atom_udta_add_3gp_uint_tag (AtomUDTA *udta, guint32 fourcc, guint16 value);
void atom_udta_add_3gp_str_int_tag (AtomUDTA *udta, guint32 fourcc, const gchar * value,
gint16 ivalue);
void atom_moov_add_3gp_tag (AtomMOOV * moov, guint32 fourcc, guint8 * data,
void atom_udta_add_3gp_tag (AtomUDTA *udta, guint32 fourcc, guint8 * data,
guint size);
void atom_moov_add_xmp_tags (AtomMOOV * moov, GstBuffer * xmp);
void atom_udta_add_xmp_tags (AtomUDTA *udta, GstBuffer * xmp);
#define GST_QT_MUX_DEFAULT_TAG_LANGUAGE "und" /* undefined/unknown */
guint16 language_code (const char * lang);

View file

@ -600,7 +600,7 @@ gst_qt_mux_create_empty_tx3g_buffer (GstQTPad * qtpad, gint64 duration)
static void
gst_qt_mux_add_mp4_tag (GstQTMux * qtmux, const GstTagList * list,
const char *tag, const char *tag2, guint32 fourcc)
AtomUDTA * udta, const char *tag, const char *tag2, guint32 fourcc)
{
switch (gst_tag_get_type (tag)) {
/* strings */
@ -612,7 +612,7 @@ gst_qt_mux_add_mp4_tag (GstQTMux * qtmux, const GstTagList * list,
break;
GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s",
GST_FOURCC_ARGS (fourcc), str);
atom_moov_add_str_tag (qtmux->moov, fourcc, str);
atom_udta_add_str_tag (udta, fourcc, str);
g_free (str);
break;
}
@ -625,7 +625,7 @@ gst_qt_mux_add_mp4_tag (GstQTMux * qtmux, const GstTagList * list,
break;
GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %u",
GST_FOURCC_ARGS (fourcc), (gint) value);
atom_moov_add_uint_tag (qtmux->moov, fourcc, 21, (gint) value);
atom_udta_add_uint_tag (udta, fourcc, 21, (gint) value);
break;
}
case G_TYPE_UINT:
@ -642,7 +642,7 @@ gst_qt_mux_add_mp4_tag (GstQTMux * qtmux, const GstTagList * list,
break;
GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %u/%u",
GST_FOURCC_ARGS (fourcc), value, count);
atom_moov_add_uint_tag (qtmux->moov, fourcc, 0,
atom_udta_add_uint_tag (udta, fourcc, 0,
value << 16 | (count & 0xFFFF));
} else {
/* unpaired unsigned integers */
@ -650,7 +650,7 @@ gst_qt_mux_add_mp4_tag (GstQTMux * qtmux, const GstTagList * list,
break;
GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %u",
GST_FOURCC_ARGS (fourcc), value);
atom_moov_add_uint_tag (qtmux->moov, fourcc, 1, value);
atom_udta_add_uint_tag (udta, fourcc, 1, value);
}
break;
}
@ -662,7 +662,7 @@ gst_qt_mux_add_mp4_tag (GstQTMux * qtmux, const GstTagList * list,
static void
gst_qt_mux_add_mp4_date (GstQTMux * qtmux, const GstTagList * list,
const char *tag, const char *tag2, guint32 fourcc)
AtomUDTA * udta, const char *tag, const char *tag2, guint32 fourcc)
{
GDate *date = NULL;
GDateYear year;
@ -690,13 +690,13 @@ gst_qt_mux_add_mp4_date (GstQTMux * qtmux, const GstTagList * list,
str = g_strdup_printf ("%u-%u-%u", year, month, day);
GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s",
GST_FOURCC_ARGS (fourcc), str);
atom_moov_add_str_tag (qtmux->moov, fourcc, str);
atom_udta_add_str_tag (udta, fourcc, str);
g_free (str);
}
static void
gst_qt_mux_add_mp4_cover (GstQTMux * qtmux, const GstTagList * list,
const char *tag, const char *tag2, guint32 fourcc)
AtomUDTA * udta, const char *tag, const char *tag2, guint32 fourcc)
{
GValue value = { 0, };
GstBuffer *buf;
@ -742,7 +742,7 @@ gst_qt_mux_add_mp4_cover (GstQTMux * qtmux, const GstTagList * list,
gst_buffer_map (buf, &map, GST_MAP_READ);
GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT
" -> image size %" G_GSIZE_FORMAT "", GST_FOURCC_ARGS (fourcc), map.size);
atom_moov_add_tag (qtmux->moov, fourcc, flags, map.data, map.size);
atom_udta_add_tag (udta, fourcc, flags, map.data, map.size);
gst_buffer_unmap (buf, &map);
done:
g_value_unset (&value);
@ -750,7 +750,7 @@ done:
static void
gst_qt_mux_add_3gp_str (GstQTMux * qtmux, const GstTagList * list,
const char *tag, const char *tag2, guint32 fourcc)
AtomUDTA * udta, const char *tag, const char *tag2, guint32 fourcc)
{
gchar *str = NULL;
guint number;
@ -768,11 +768,11 @@ gst_qt_mux_add_3gp_str (GstQTMux * qtmux, const GstTagList * list,
if (!tag2) {
GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s",
GST_FOURCC_ARGS (fourcc), str);
atom_moov_add_3gp_str_tag (qtmux->moov, fourcc, str);
atom_udta_add_3gp_str_tag (udta, fourcc, str);
} else {
GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s/%d",
GST_FOURCC_ARGS (fourcc), str, number);
atom_moov_add_3gp_str_int_tag (qtmux->moov, fourcc, str, number);
atom_udta_add_3gp_str_int_tag (udta, fourcc, str, number);
}
g_free (str);
@ -780,7 +780,7 @@ gst_qt_mux_add_3gp_str (GstQTMux * qtmux, const GstTagList * list,
static void
gst_qt_mux_add_3gp_date (GstQTMux * qtmux, const GstTagList * list,
const char *tag, const char *tag2, guint32 fourcc)
AtomUDTA * udta, const char *tag, const char *tag2, guint32 fourcc)
{
GDate *date = NULL;
GDateYear year;
@ -799,12 +799,12 @@ gst_qt_mux_add_3gp_date (GstQTMux * qtmux, const GstTagList * list,
GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %d",
GST_FOURCC_ARGS (fourcc), year);
atom_moov_add_3gp_uint_tag (qtmux->moov, fourcc, year);
atom_udta_add_3gp_uint_tag (udta, fourcc, year);
}
static void
gst_qt_mux_add_3gp_location (GstQTMux * qtmux, const GstTagList * list,
const char *tag, const char *tag2, guint32 fourcc)
AtomUDTA * udta, const char *tag, const char *tag2, guint32 fourcc)
{
gdouble latitude = -360, longitude = -360, altitude = 0;
gchar *location = NULL;
@ -852,13 +852,13 @@ gst_qt_mux_add_3gp_location (GstQTMux * qtmux, const GstTagList * list,
GST_WRITE_UINT16_BE (data + 13, 0);
GST_DEBUG_OBJECT (qtmux, "Adding tag 'loci'");
atom_moov_add_3gp_tag (qtmux->moov, fourcc, ddata, size);
atom_udta_add_3gp_tag (udta, fourcc, ddata, size);
g_free (ddata);
}
static void
gst_qt_mux_add_3gp_keywords (GstQTMux * qtmux, const GstTagList * list,
const char *tag, const char *tag2, guint32 fourcc)
AtomUDTA * udta, const char *tag, const char *tag2, guint32 fourcc)
{
gchar *keywords = NULL;
guint8 *data, *ddata;
@ -903,7 +903,7 @@ gst_qt_mux_add_3gp_keywords (GstQTMux * qtmux, const GstTagList * list,
g_strfreev (kwds);
atom_moov_add_3gp_tag (qtmux->moov, fourcc, ddata, size);
atom_udta_add_3gp_tag (udta, fourcc, ddata, size);
g_free (ddata);
}
@ -981,7 +981,7 @@ mismatch:
static void
gst_qt_mux_add_3gp_classification (GstQTMux * qtmux, const GstTagList * list,
const char *tag, const char *tag2, guint32 fourcc)
AtomUDTA * udta, const char *tag, const char *tag2, guint32 fourcc)
{
gchar *clsf_data = NULL;
gint size = 0;
@ -1016,12 +1016,13 @@ gst_qt_mux_add_3gp_classification (GstQTMux * qtmux, const GstTagList * list,
memcpy (data + 8, content, size);
g_free (content);
atom_moov_add_3gp_tag (qtmux->moov, fourcc, data, 4 + 2 + 2 + size);
atom_udta_add_3gp_tag (udta, fourcc, data, 4 + 2 + 2 + size);
g_free (data);
}
typedef void (*GstQTMuxAddTagFunc) (GstQTMux * mux, const GstTagList * list,
const char *tag, const char *tag2, guint32 fourcc);
typedef void (*GstQTMuxAddUdtaTagFunc) (GstQTMux * mux,
const GstTagList * list, AtomUDTA * udta, const char *tag,
const char *tag2, guint32 fourcc);
/*
* Struct to record mappings from gstreamer tags to fourcc codes
@ -1031,7 +1032,7 @@ typedef struct _GstTagToFourcc
guint32 fourcc;
const gchar *gsttag;
const gchar *gsttag2;
const GstQTMuxAddTagFunc func;
const GstQTMuxAddUdtaTagFunc func;
} GstTagToFourcc;
/* tag list tags to fourcc matching */
@ -1109,7 +1110,7 @@ gst_qt_mux_add_xmp_tags (GstQTMux * qtmux, const GstTagList * 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);
atom_udta_add_xmp_tags (&qtmux->moov->udta, xmp);
} else {
AtomInfo *ainfo;
/* for isom/mp4, it is a top level uuid atom */
@ -1127,7 +1128,8 @@ gst_qt_mux_add_xmp_tags (GstQTMux * qtmux, const GstTagList * list)
}
static void
gst_qt_mux_add_metadata_tags (GstQTMux * qtmux, const GstTagList * list)
gst_qt_mux_add_metadata_tags (GstQTMux * qtmux, const GstTagList * list,
AtomUDTA * udta)
{
GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux));
guint32 fourcc;
@ -1157,7 +1159,7 @@ gst_qt_mux_add_metadata_tags (GstQTMux * qtmux, const GstTagList * list)
tag2 = tag_matches[i].gsttag2;
g_assert (tag_matches[i].func);
tag_matches[i].func (qtmux, list, tag, tag2, fourcc);
tag_matches[i].func (qtmux, list, udta, tag, tag2, fourcc);
}
/* add unparsed blobs if present */
@ -1191,7 +1193,7 @@ gst_qt_mux_add_metadata_tags (GstQTMux * qtmux, const GstTagList * list)
(strcmp (style, "iso") == 0 &&
qtmux_klass->format == GST_QT_MUX_FORMAT_3GP)) {
GST_DEBUG_OBJECT (qtmux, "Adding private tag");
atom_moov_add_blob_tag (qtmux->moov, map.data, map.size);
atom_udta_add_blob_tag (udta, map.data, map.size);
}
}
gst_buffer_unmap (buf, &map);
@ -1226,12 +1228,13 @@ gst_qt_mux_setup_metadata (GstQTMux * qtmux)
gst_tag_list_remove_tag (copy, GST_TAG_CONTAINER_FORMAT);
GST_DEBUG_OBJECT (qtmux, "Formatting tags");
gst_qt_mux_add_metadata_tags (qtmux, copy);
gst_qt_mux_add_metadata_tags (qtmux, copy, &qtmux->moov->udta);
gst_qt_mux_add_xmp_tags (qtmux, copy);
gst_tag_list_unref (copy);
} else {
GST_DEBUG_OBJECT (qtmux, "No tags received");
}
}
static inline GstBuffer *