c->cb.seek = aac_afh_seek_cb;
c->cb.user_data = c;
- ret = -E_MP4_OPEN;
- c->mp4 = mp4_open_read(&c->cb);
- if (!c->mp4)
+ ret = mp4_open_read(&c->cb, &c->mp4);
+ if (ret < 0)
goto free_ctx;
*afh_context = c;
return 0;
return lseek(fd, pos, SEEK_SET);
}
-static uint32_t aac_afh_meta_write_cb(void *user_data, void *dest, uint32_t want)
+static ssize_t aac_afh_meta_write_cb(void *user_data, void *dest, size_t count)
{
int fd = *(int *)user_data;
- return write(fd, dest, want);
+ return write(fd, dest, count);
}
static uint32_t aac_afh_meta_truncate_cb(void *user_data)
return ret;
lseek(fd, 0, SEEK_SET);
- mp4 = mp4_open_meta(&cb);
- if (!mp4)
- return -E_MP4_OPEN;
+ ret = mp4_open_meta(&cb, &mp4);
+ if (ret < 0)
+ return ret;
metadata = mp4_get_meta(mp4);
PARA_NOTICE_LOG("%u metadata item(s) found\n", metadata->count);
replace_or_add_tag("artist", tags->artist, metadata);
replace_or_add_tag("album", tags->album, metadata);
replace_or_add_tag("date", tags->year, metadata);
replace_or_add_tag("comment", tags->comment, metadata);
- ret = -E_MP4_META_WRITE;
- if (!mp4_meta_update(mp4))
- goto close;
- ret = 1;
-close:
+ ret = mp4_meta_update(mp4);
mp4_close(mp4);
return ret;
}