X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=afh_common.c;fp=afh_common.c;h=b1f8b25dd5726bbf887f0f4bca481f59937371fc;hp=eb0813df1cb10d16512fd6a863d7c50cb24cba43;hb=486314426fcd25e5271fd65a982f8b321585e195;hpb=6a22b3923f75436aaf84135bd397ab82f22bc09f;ds=sidebyside diff --git a/afh_common.c b/afh_common.c index eb0813df..b1f8b25d 100644 --- a/afh_common.c +++ b/afh_common.c @@ -48,7 +48,7 @@ static struct audio_format_handler afl[] = { }, { .name = "aac", -#ifdef HAVE_FAAD +#if defined(HAVE_MP4V2) .init = aac_afh_init, #endif }, @@ -392,3 +392,31 @@ unsigned afh_get_afhi_txt(int audio_format_num, struct afh_info *afhi, char **re status_item_list[SI_COMMENT], afhi->tags.comment? afhi->tags.comment : "" ); } + +/** + * Create a copy of the given file with altered meta tags. + * + * \param audio_format_id Specifies the audio format. + * \param map The (read-only) memory map of the input file. + * \param mapsize The size of the input file in bytes. + * \param tags The new tags. + * \param output_fd Altered file is created using this file descriptor. + * \param filename The name of the temporary output file. + * + * This calls the ->rewrite_tags method of the audio format handler associated + * with \a audio_format_id to create a copy of the memory-mapped file given + * by \a map and \a mapsize, but with altered tags according to \a tags. If + * the audio format handler for \a audio_format_id lacks this optional method, + * the function returns (the paraslash error code of) \p ENOTSUP. + * + * \return Standard. + */ +int afh_rewrite_tags(int audio_format_id, void *map, size_t mapsize, + struct taginfo *tags, int output_fd, const char *filename) +{ + struct audio_format_handler *afh = afl + audio_format_id; + + if (!afh->rewrite_tags) + return -ERRNO_TO_PARA_ERROR(ENOTSUP); + return afh->rewrite_tags(map, mapsize, tags, output_fd, filename); +}