int caf_info(caf_reader_t *reader, int64_t chunk_size)
{
    char *buf, *key, *val, *end;
    size_t len;

    if (chunk_size < 4 || (buf = malloc(chunk_size)) == 0)
        return -1;
    pcm_read(&reader->io, buf, chunk_size);
    key = buf + 4;
    end = buf + chunk_size;
    do {
        if ((val = key + strlen(key) + 1) < end) {
            len = strlen(val);
            if (reader->tag_callback)
                reader->tag_callback(reader->tag_ctx, key, val, len);
            key = val + len + 1;
        }
    } while (key < end && val < end);

    if (reader->tag_callback)
        reader->tag_callback(reader->tag_ctx, 0, 0, 0);
    free(buf);
    return 0;
}
int caf_info(caf_reader_t *reader, int64_t chunk_size)
{
    char *buf, *key, *val, *end;
    size_t len;

    if (chunk_size < 4 || (buf = malloc(chunk_size)) == 0)
        return -1;
    pcm_read(&reader->io, buf, chunk_size);
    key = buf + 4;
    end = buf + chunk_size;
    do {
        if ((val = key + strlen(key) + 1) < end) {
            len = strlen(val);
            if (reader->tag_callback)
                reader->tag_callback(reader->tag_ctx, key, val, len);
            key = val + len + 1;
        }
    } while (key < end && val < end);

    if (reader->tag_callback)
        reader->tag_callback(reader->tag_ctx, 0, 0, 0);
    free(buf);
    return 0;
}