return f;
}
-int32_t mp4_meta_get_num_items(const struct mp4 *f)
+/**
+ * Return the metadata of an mp4 file.
+ *
+ * \param f As returned by either \ref mp4_open_read() or \ref mp4_open_meta().
+ *
+ * The caller is allowed to add, delete or modify the entries of the returned
+ * structure in order to pass the modified version to \ref mp4_meta_update().
+ */
+struct mp4_metadata *mp4_get_meta(struct mp4 *f)
{
- return f->tags.count;
-}
-
-int32_t mp4_meta_get_by_index(const struct mp4 *f, uint32_t index,
- char **item, char **value)
-{
- if (index >= f->tags.count) {
- *item = NULL;
- *value = NULL;
- return 0;
- } else {
- *item = para_strdup(f->tags.tags[index].item);
- *value = para_strdup(f->tags.tags[index].value);
- return 1;
- }
+ return &f->tags;
}
static uint32_t find_atom(struct mp4 *f, uint64_t base, uint32_t size,
struct membuffer *buf;
void *new_meta_buffer;
uint32_t new_meta_size;
+
if (!create_meta(data, &new_meta_buffer, &new_meta_size))
return 0;
void *new_moov_data;
uint32_t new_moov_size;
- tag_delete(&f->tags);
- f->tags = *meta;
set_position(f, 0);
if (!modify_moov(f, meta, &new_moov_data, &new_moov_size)) {
mp4_close(f);
return 0;
}
-
/* copy moov atom to end of the file */
if (f->last_atom != ATOM_MOOV) {
char *free_data = "free";