X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=aac_afh.c;h=026df50f00c43bff16294d3ec26a869517f7e3c1;hb=2e74df5e133586cc41875b2c76617f97f8937b04;hp=3315a42d57a5ea9673be88b077daef1275ab49f6;hpb=d31995b3074bb19aa4da66ce5c4774ca9ed101a1;p=paraslash.git diff --git a/aac_afh.c b/aac_afh.c index 3315a42d..026df50f 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -37,12 +37,8 @@ static uint32_t aac_afh_read_cb(void *user_data, void *dest, uint32_t want) struct aac_afh_context *c = user_data; uint32_t have, rv; - if (want == 0 || c->fpos >= c->mapsize) { - PARA_INFO_LOG("failed attempt to read %u bytes @%zu\n", want, - c->fpos); - errno = EAGAIN; - return -1; - } + if (want == 0 || c->fpos >= c->mapsize) + return 0; have = c->mapsize - c->fpos; rv = PARA_MIN(have, want); PARA_DEBUG_LOG("reading %u bytes @%zu\n", rv, c->fpos); @@ -292,8 +288,7 @@ static int aac_afh_rewrite_tags(const char *map, size_t mapsize, mp4ff_tag_t *tag = metadata.tags + i; ret = -E_MP4FF_META_READ; - if (mp4ff_meta_get_by_index(mp4ff, i, - &tag->item, &tag->value) < 0) + if (!mp4ff_meta_get_by_index(mp4ff, i, &tag->item, &tag->value)) goto free_tags; PARA_INFO_LOG("found: %s: %s\n", tag->item, tag->value); if (!strcmp(tag->item, "artist")) @@ -318,7 +313,7 @@ static int aac_afh_rewrite_tags(const char *map, size_t mapsize, if (!found_comment) add_tag(&metadata, "comment", tags->comment); ret = -E_MP4FF_META_WRITE; - if (mp4ff_meta_update(&cb, &metadata) < 0) + if (!mp4ff_meta_update(&cb, &metadata)) goto free_tags; ret = 1; free_tags: @@ -333,17 +328,17 @@ close: } static const char * const aac_suffixes[] = {"m4a", "mp4", NULL}; + /** - * the init function of the aac audio format handler + * The audio format handler for the Advanced Audio Codec. * - * \param afh pointer to the struct to initialize + * This is only compiled in if the faad library is installed. */ -void aac_afh_init(struct audio_format_handler *afh) -{ - afh->get_file_info = aac_get_file_info, - afh->suffixes = aac_suffixes; - afh->rewrite_tags = aac_afh_rewrite_tags; - afh->open = aac_afh_open; - afh->get_chunk = aac_afh_get_chunk; - afh->close = aac_afh_close; -} +const struct audio_format_handler aac_afh = { + .get_file_info = aac_get_file_info, + .suffixes = aac_suffixes, + .rewrite_tags = aac_afh_rewrite_tags, + .open = aac_afh_open, + .get_chunk = aac_afh_get_chunk, + .close = aac_afh_close, +};