From e46bcc81f2eaa35e9409dd96fdbcc15647919b96 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 14 Aug 2021 18:48:56 +0200 Subject: [PATCH] mp4: Drop metadata parameter from mp4_meta_update(). The function can as well access the modified metadata structure via the mp4 pointer. Drop the parameter also from modify_moov() for the same reason. --- aac_afh.c | 2 +- mp4.c | 14 +++++++------- mp4.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/aac_afh.c b/aac_afh.c index 1522b5f0..3c8ba867 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -269,7 +269,7 @@ static int aac_afh_rewrite_tags(const char *map, size_t mapsize, if (!found_comment) add_tag(metadata, "comment", tags->comment); ret = -E_MP4_META_WRITE; - if (!mp4_meta_update(mp4, metadata)) + if (!mp4_meta_update(mp4)) goto close; ret = 1; close: diff --git a/mp4.c b/mp4.c index 49fb22b9..1158a381 100644 --- a/mp4.c +++ b/mp4.c @@ -1571,8 +1571,8 @@ static uint32_t fix_byte_order_32(uint32_t src) return read_u32_be(&src); } -static uint32_t modify_moov(struct mp4 *f, const struct mp4_metadata *data, - void **out_buffer, uint32_t * out_size) +static uint32_t modify_moov(struct mp4 *f, void **out_buffer, + uint32_t *out_size) { uint64_t total_base = f->moov_offset + 8; uint32_t total_size = (uint32_t) (f->moov_size - 8); @@ -1590,7 +1590,7 @@ static uint32_t modify_moov(struct mp4 *f, const struct mp4_metadata *data, struct membuffer *buf; void *new_udta_buffer; uint32_t new_udta_size; - if (!create_udta(data, &new_udta_buffer, &new_udta_size)) + if (!create_udta(&f->tags, &new_udta_buffer, &new_udta_size)) return 0; buf = membuffer_create(); @@ -1614,7 +1614,7 @@ static uint32_t modify_moov(struct mp4 *f, const struct mp4_metadata *data, void *new_meta_buffer; uint32_t new_meta_size; - if (!create_meta(data, &new_meta_buffer, &new_meta_size)) + if (!create_meta(&f->tags, &new_meta_buffer, &new_meta_size)) return 0; buf = membuffer_create(); @@ -1642,7 +1642,7 @@ static uint32_t modify_moov(struct mp4 *f, const struct mp4_metadata *data, ilst_offset = get_position(f); ilst_size = read_int32(f); - if (!create_ilst(data, &new_ilst_buffer, &new_ilst_size)) + if (!create_ilst(&f->tags, &new_ilst_buffer, &new_ilst_size)) return 0; size_delta = new_ilst_size - (ilst_size - 8); @@ -1704,13 +1704,13 @@ static int32_t write_int32(struct mp4 *f, uint32_t data) return write_data(f, temp, sizeof(temp)); } -int32_t mp4_meta_update(struct mp4 *f, struct mp4_metadata *meta) +int32_t mp4_meta_update(struct mp4 *f) { void *new_moov_data; uint32_t new_moov_size; set_position(f, 0); - if (!modify_moov(f, meta, &new_moov_data, &new_moov_size)) { + if (!modify_moov(f, &new_moov_data, &new_moov_size)) { mp4_close(f); return 0; } diff --git a/mp4.h b/mp4.h index eb8cf87a..1d48174a 100644 --- a/mp4.h +++ b/mp4.h @@ -32,7 +32,7 @@ uint64_t mp4_get_duration(const struct mp4 *f, int32_t track); struct mp4 *mp4_open_meta(const struct mp4_callback *cb); struct mp4_metadata *mp4_get_meta(struct mp4 *f); -int32_t mp4_meta_update(struct mp4 *f, struct mp4_metadata *meta); +int32_t mp4_meta_update(struct mp4 *f); char *mp4_meta_get_artist(const struct mp4 *f); char *mp4_meta_get_title(const struct mp4 *f); char *mp4_meta_get_date(const struct mp4 *f); -- 2.39.2