return rv;
}
-static uint32_t aac_afh_seek_cb(void *user_data, uint64_t pos)
+static off_t aac_afh_seek_cb(void *user_data, off_t offset, int whence)
{
struct aac_afh_context *c = user_data;
- c->fpos = pos;
- return 0;
+
+ if (whence == SEEK_SET)
+ c->fpos = offset;
+ else if (whence == SEEK_CUR)
+ c->fpos += offset;
+ else if (whence == SEEK_END)
+ c->fpos = c->mapsize + offset;
+ else
+ assert(false);
+ return c->fpos;
}
static int aac_afh_open(const void *map, size_t mapsize, void **afh_context)
return 1;
}
-static void _aac_afh_get_taginfo(const struct mp4 *mp4, struct taginfo *tags)
+static void aac_afh_get_taginfo(const struct mp4 *mp4, struct taginfo *tags)
{
- tags->artist = mp4_meta_get_artist(mp4);
- tags->title = mp4_meta_get_title(mp4);
- tags->year = mp4_meta_get_date(mp4);
- tags->album = mp4_meta_get_album(mp4);
- tags->comment = mp4_meta_get_comment(mp4);
+ tags->artist = mp4_get_tag_value(mp4, "artist");
+ tags->title = mp4_get_tag_value(mp4, "title");
+ tags->year = mp4_get_tag_value(mp4, "date");
+ tags->album = mp4_get_tag_value(mp4, "album");
+ tags->comment = mp4_get_tag_value(mp4, "comment");
}
/*
if (aac_afh_get_chunk(0, c, &buf, &len) >= 0)
numbytes -= buf - map;
afhi->bitrate = 8 * numbytes / afhi->seconds_total / 1000;
- _aac_afh_get_taginfo(c->mp4, &afhi->tags);
+ aac_afh_get_taginfo(c->mp4, &afhi->tags);
ret = 1;
close:
aac_afh_close(c);
return read(fd, dest, want);
}
-static uint32_t aac_afh_meta_seek_cb(void *user_data, uint64_t pos)
+static off_t aac_afh_meta_seek_cb(void *user_data, off_t offset, int whence)
{
int fd = *(int *)user_data;
- return lseek(fd, pos, SEEK_SET);
+ off_t ret = lseek(fd, offset, whence);
+
+ assert(ret != (off_t)-1);
+ return ret;
}
static ssize_t aac_afh_meta_write_cb(void *user_data, void *dest, size_t count)