From 95451b5821da1383f476cd8d6c6c8d12e683b777 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Aug 2008 09:38:21 +0200 Subject: tag: renamed functions, no CamelCase --- src/audioOutputs/audioOutput_shout.c | 8 +++--- src/command.c | 2 +- src/inputPlugins/_flac_common.c | 6 ++--- src/inputPlugins/aac_plugin.c | 4 +-- src/inputPlugins/audiofile_plugin.c | 2 +- src/inputPlugins/flac_plugin.c | 8 +++--- src/inputPlugins/mod_plugin.c | 4 +-- src/inputPlugins/mp3_plugin.c | 35 +++++++++++++------------- src/inputPlugins/mp4_plugin.c | 22 ++++++++--------- src/inputPlugins/mpc_plugin.c | 6 ++--- src/inputPlugins/oggvorbis_plugin.c | 12 ++++----- src/inputPlugins/wavpack_plugin.c | 6 ++--- src/main.c | 2 +- src/metadata_pipe.c | 20 +++++++-------- src/outputBuffer.c | 2 +- src/playlist.c | 6 ++--- src/song.c | 20 +++++++-------- src/tag.c | 48 ++++++++++++++++++------------------ src/tag.h | 28 ++++++++++----------- 19 files changed, 120 insertions(+), 121 deletions(-) (limited to 'src') diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c index cc5b36e29..7dfa702e1 100644 --- a/src/audioOutputs/audioOutput_shout.c +++ b/src/audioOutputs/audioOutput_shout.c @@ -93,7 +93,7 @@ static void freeShoutData(ShoutData * sd) if (sd->shoutConn) shout_free(sd->shoutConn); if (sd->tag) - freeMpdTag(sd->tag); + tag_free(sd->tag); if (sd->timer) timer_free(sd->timer); @@ -593,7 +593,7 @@ static void myShout_sendMetadata(ShoutData * sd) } } - /*if(sd->tag) freeMpdTag(sd->tag); + /*if(sd->tag) tag_free(sd->tag); sd->tag = NULL; */ sd->tagToSend = 0; } @@ -668,14 +668,14 @@ static void myShout_setTag(AudioOutput * audioOutput, struct mpd_tag *tag) ShoutData *sd = (ShoutData *) audioOutput->data; if (sd->tag) - freeMpdTag(sd->tag); + tag_free(sd->tag); sd->tag = NULL; sd->tagToSend = 0; if (!tag) return; - sd->tag = mpdTagDup(tag); + sd->tag = tag_dup(tag); sd->tagToSend = 1; } diff --git a/src/command.c b/src/command.c index 805addde1..bc646804e 100644 --- a/src/command.c +++ b/src/command.c @@ -245,7 +245,7 @@ static int handleUrlHandlers(int fd, mpd_unused int *permission, static int handleTagTypes(int fd, mpd_unused int *permission, mpd_unused int argc, mpd_unused char *argv[]) { - printTagTypes(fd); + tag_print_types(fd); return 0; } diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c index 6307af00d..9950f75db 100644 --- a/src/inputPlugins/_flac_common.c +++ b/src/inputPlugins/_flac_common.c @@ -123,10 +123,10 @@ static unsigned int commentMatchesAddToTag(const if ((vlen > 0) && (0 == strncasecmp(str, (char *)entry->entry, slen)) && (*(entry->entry + slen) == '=')) { if (!*tag) - *tag = newMpdTag(); + *tag = tag_new(); - addItemToMpdTagWithLen(*tag, itemType, - (char *)(entry->entry + slen + 1), vlen); + tag_add_item_n(*tag, itemType, + (char *)(entry->entry + slen + 1), vlen); return 1; } diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index 161b1b9b8..dc97c1e08 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -559,8 +559,8 @@ static struct mpd_tag *aacTagDup(char *file) int file_time = getAacTotalTime(file); if (file_time >= 0) { - if ((ret = id3Dup(file)) == NULL) - ret = newMpdTag(); + if ((ret = tag_id3_load(file)) == NULL) + ret = tag_new(); ret->time = file_time; } else { DEBUG("aacTagDup: Failed to get total song time from: %s\n", diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index ce8eb68d4..6fcc98239 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -123,7 +123,7 @@ static struct mpd_tag *audiofileTagDup(char *file) if (total_time >= 0) { if (!ret) - ret = newMpdTag(); + ret = tag_new(); ret->time = total_time; } else { DEBUG diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index c376497a9..89e988a03 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -338,7 +338,7 @@ static struct mpd_tag *flacMetadataDup(char *file, int *vorbisCommentFound) *vorbisCommentFound = 1; } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) { if (!ret) - ret = newMpdTag(); + ret = tag_new(); ret->time = ((float)block->data.stream_info. total_samples) / block->data.stream_info.sample_rate + 0.5; @@ -362,10 +362,10 @@ static struct mpd_tag *flacTagDup(char *file) return NULL; } if (!foundVorbisComment) { - struct mpd_tag *temp = id3Dup(file); + struct mpd_tag *temp = tag_id3_load(file); if (temp) { temp->time = ret->time; - freeMpdTag(ret); + tag_free(ret); ret = temp; } } @@ -484,7 +484,7 @@ static struct mpd_tag *oggflac_tag_dup(char *file) ret = copyVorbisCommentBlockToMpdTag(block, ret); } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) { if (!ret) - ret = newMpdTag(); + ret = tag_new(); ret->time = ((float)block->data.stream_info. total_samples) / block->data.stream_info.sample_rate + 0.5; diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index c954f064d..586d87ae9 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -224,12 +224,12 @@ static struct mpd_tag *modTagDup(char *file) } Player_Free(moduleHandle); - ret = newMpdTag(); + ret = tag_new(); ret->time = 0; title = xstrdup(Player_LoadTitle(file)); if (title) - addItemToMpdTag(ret, TAG_ITEM_TITLE, title); + tag_add_item(ret, TAG_ITEM_TITLE, title); MikMod_Exit(); diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 9644e7a62..ff3de80a3 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -348,10 +348,10 @@ static void mp3_parseId3Tag(mp3DecodeData * data, size_t tagsize, goto fail; if (mpdTag) { - tmpMpdTag = parseId3Tag(id3Tag); + tmpMpdTag = tag_id3_import(id3Tag); if (tmpMpdTag) { if (*mpdTag) - freeMpdTag(*mpdTag); + tag_free(*mpdTag); *mpdTag = tmpMpdTag; } } @@ -819,7 +819,7 @@ static int openMp3FromInputStream(InputStream * inStream, mp3DecodeData * data, if (decodeFirstFrame(data, tag, replayGainInfo) < 0) { mp3DecodeDataFinalize(data); if (tag && *tag) - freeMpdTag(*tag); + tag_free(*tag); return -1; } @@ -923,13 +923,12 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo) } if (data->inStream->metaTitle) { - struct mpd_tag *tag = newMpdTag(); + struct mpd_tag *tag = tag_new(); if (data->inStream->metaName) { - addItemToMpdTag(tag, - TAG_ITEM_NAME, - data->inStream->metaName); + tag_add_item(tag, TAG_ITEM_NAME, + data->inStream->metaName); } - addItemToMpdTag(tag, TAG_ITEM_TITLE, + tag_add_item(tag, TAG_ITEM_TITLE, data->inStream->metaTitle); free(data->inStream->metaTitle); data->inStream->metaTitle = NULL; @@ -1051,23 +1050,23 @@ static int mp3_decode(InputStream * inStream) if (inStream->metaTitle) { if (tag) - freeMpdTag(tag); - tag = newMpdTag(); - addItemToMpdTag(tag, TAG_ITEM_TITLE, inStream->metaTitle); + tag_free(tag); + tag = tag_new(); + tag_add_item(tag, TAG_ITEM_TITLE, inStream->metaTitle); free(inStream->metaTitle); inStream->metaTitle = NULL; if (inStream->metaName) { - addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName); + tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName); } } else if (tag) { if (inStream->metaName) { - clearItemsFromMpdTag(tag, TAG_ITEM_NAME); - addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName); + tag_clear_items_by_type(tag, TAG_ITEM_NAME); + tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName); } } else if (inStream->metaName) { - tag = newMpdTag(); + tag = tag_new(); if (inStream->metaName) { - addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName); + tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName); } } if (tag) @@ -1086,13 +1085,13 @@ static struct mpd_tag *mp3_tagDup(char *file) struct mpd_tag *ret = NULL; int total_time; - ret = id3Dup(file); + ret = tag_id3_load(file); total_time = getMp3TotalTime(file); if (total_time >= 0) { if (!ret) - ret = newMpdTag(); + ret = tag_new(); ret->time = total_time; } else { DEBUG("mp3_tagDup: Failed to get total song time from: %s\n", diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 543ff76b7..cc2b89efc 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -322,14 +322,14 @@ static struct mpd_tag *mp4DataDup(char *file, int *mp4MetadataFound) return NULL; } - ret = newMpdTag(); + ret = tag_new(); file_time = mp4ff_get_track_duration_use_offsets(mp4fh, track); scale = mp4ff_time_scale(mp4fh, track); if (scale < 0) { mp4ff_close(mp4fh); closeInputStream(&inStream); free(callback); - freeMpdTag(ret); + tag_free(ret); return NULL; } ret->time = ((float)file_time) / scale + 0.5; @@ -341,25 +341,25 @@ static struct mpd_tag *mp4DataDup(char *file, int *mp4MetadataFound) mp4ff_meta_get_by_index(mp4fh, i, &item, &value); if (0 == strcasecmp("artist", item)) { - addItemToMpdTag(ret, TAG_ITEM_ARTIST, value); + tag_add_item(ret, TAG_ITEM_ARTIST, value); *mp4MetadataFound = 1; } else if (0 == strcasecmp("title", item)) { - addItemToMpdTag(ret, TAG_ITEM_TITLE, value); + tag_add_item(ret, TAG_ITEM_TITLE, value); *mp4MetadataFound = 1; } else if (0 == strcasecmp("album", item)) { - addItemToMpdTag(ret, TAG_ITEM_ALBUM, value); + tag_add_item(ret, TAG_ITEM_ALBUM, value); *mp4MetadataFound = 1; } else if (0 == strcasecmp("track", item)) { - addItemToMpdTag(ret, TAG_ITEM_TRACK, value); + tag_add_item(ret, TAG_ITEM_TRACK, value); *mp4MetadataFound = 1; } else if (0 == strcasecmp("disc", item)) { /* Is that the correct id? */ - addItemToMpdTag(ret, TAG_ITEM_DISC, value); + tag_add_item(ret, TAG_ITEM_DISC, value); *mp4MetadataFound = 1; } else if (0 == strcasecmp("genre", item)) { - addItemToMpdTag(ret, TAG_ITEM_GENRE, value); + tag_add_item(ret, TAG_ITEM_GENRE, value); *mp4MetadataFound = 1; } else if (0 == strcasecmp("date", item)) { - addItemToMpdTag(ret, TAG_ITEM_DATE, value); + tag_add_item(ret, TAG_ITEM_DATE, value); *mp4MetadataFound = 1; } @@ -382,10 +382,10 @@ static struct mpd_tag *mp4TagDup(char *file) if (!ret) return NULL; if (!mp4MetadataFound) { - struct mpd_tag *temp = id3Dup(file); + struct mpd_tag *temp = tag_id3_load(file); if (temp) { temp->time = ret->time; - freeMpdTag(ret); + tag_free(ret); ret = temp; } } diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index e3e16e8b3..e5502a2f0 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -284,11 +284,11 @@ static struct mpd_tag *mpcTagDup(char *file) return NULL; } - ret = apeDup(file); + ret = tag_ape_load(file); if (!ret) - ret = id3Dup(file); + ret = tag_id3_load(file); if (!ret) - ret = newMpdTag(); + ret = tag_new(); ret->time = total_time; return ret; diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index 0ff54df60..bb8af4465 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -163,9 +163,9 @@ static unsigned int ogg_parseCommentAddToTag(char *comment, if (strncasecmp(comment, needle, len) == 0 && *(comment + len) == '=') { if (!*tag) - *tag = newMpdTag(); + *tag = tag_new(); - addItemToMpdTag(*tag, itemType, comment + len + 1); + tag_add_item(*tag, itemType, comment + len + 1); return 1; } @@ -197,14 +197,14 @@ static void putOggCommentsIntoOutputBuffer(char *streamName, tag = oggCommentsParse(comments); if (!tag && streamName) { - tag = newMpdTag(); + tag = tag_new(); } if (!tag) return; if (streamName) { - clearItemsFromMpdTag(tag, TAG_ITEM_NAME); - addItemToMpdTag(tag, TAG_ITEM_NAME, streamName); + tag_clear_items_by_type(tag, TAG_ITEM_NAME); + tag_add_item(tag, TAG_ITEM_NAME, streamName); } metadata_pipe_send(tag, cur_time); @@ -352,7 +352,7 @@ static struct mpd_tag *oggvorbis_TagDup(char *file) ret = oggCommentsParse(ov_comment(&vf, -1)->user_comments); if (!ret) - ret = newMpdTag(); + ret = tag_new(); ret->time = (int)(ov_time_total(&vf, -1) + 0.5); ov_clear(&vf); diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index a97242239..c8b4ac339 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -285,9 +285,9 @@ static struct mpd_tag *wavpack_tagdup(char *fname) return NULL; } - tag = newMpdTag(); + tag = tag_new(); if (tag == NULL) { - ERROR("failed to newMpdTag()\n"); + ERROR("failed to tag_new()\n"); return NULL; } @@ -314,7 +314,7 @@ static struct mpd_tag *wavpack_tagdup(char *fname) } WavpackGetTagItem(wpc, tagtypes[i].name, s, j); - addItemToMpdTag(tag, tagtypes[i].type, s); + tag_add_item(tag, tagtypes[i].type, s); } } diff --git a/src/main.c b/src/main.c index 9d75fadc7..236b3bbe1 100644 --- a/src/main.c +++ b/src/main.c @@ -393,7 +393,7 @@ int main(int argc, char *argv[]) killFromPidFile(); initStats(); - initTagConfig(); + tag_lib_init(); initLog(options.verbose); if (options.createDB <= 0) diff --git a/src/metadata_pipe.c b/src/metadata_pipe.c index 5cdc3af2d..2bf730fef 100644 --- a/src/metadata_pipe.c +++ b/src/metadata_pipe.c @@ -49,7 +49,7 @@ static void metadata_pipe_finish(void) { ringbuf_free(mp); if (current_tag) - freeMpdTag(current_tag); + tag_free(current_tag); } void init_metadata_pipe(void) @@ -68,7 +68,7 @@ void metadata_pipe_send(struct mpd_tag *tag, float metadata_time) if (mpd_unlikely(ringbuf_write_space(mp) < sizeof(struct tag_container))) { DEBUG("metadata_pipe: insufficient buffer space, dropping\n"); - freeMpdTag(tag); + tag_free(tag); return; } @@ -99,20 +99,20 @@ retry: if (expect_seq == tc.seq) { if (current_time < tc.metadata_time) goto out; /* not ready for tag yet */ - if (mpdTagsAreEqual(tc.tag, current_tag)) { - freeMpdTag(tc.tag); + if (tag_equal(tc.tag, current_tag)) { + tag_free(tc.tag); ringbuf_read_advance(mp, sizeof(struct tag_container)); goto out; /* nothing changed, don't bother */ } - tag = mpdTagDup(tc.tag); + tag = tag_dup(tc.tag); if (current_tag) - freeMpdTag(current_tag); + tag_free(current_tag); current_tag = tc.tag; ringbuf_read_advance(mp, sizeof(struct tag_container)); } else if (expect_seq > tc.seq || (!expect_seq && tc.seq == mpd_uint8_max)) { DEBUG("metadata_pipe: reader is ahead of writer\n"); - freeMpdTag(tc.tag); + tag_free(tc.tag); ringbuf_read_advance(mp, sizeof(struct tag_container)); goto retry; /* read and skip packets */ } else { @@ -131,7 +131,7 @@ struct mpd_tag *metadata_pipe_current(void) assert(! pthread_equal(pthread_self(), dc.thread)); if (pthread_mutex_trylock(&read_lock) == EBUSY) return NULL; - tag = current_tag ? mpdTagDup(current_tag) : NULL; + tag = current_tag ? tag_dup(current_tag) : NULL; pthread_mutex_unlock(&read_lock); return tag; @@ -146,11 +146,11 @@ void metadata_pipe_clear(void) while ((r = ringbuf_read(mp, &tc, sizeof(struct tag_container)))) { assert(r == sizeof(struct tag_container)); - freeMpdTag(tc.tag); + tag_free(tc.tag); } if (current_tag) { - freeMpdTag(current_tag); + tag_free(current_tag); current_tag = NULL; } diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 52506650f..ec46417c6 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -414,7 +414,7 @@ static void send_next_tag(void) if ((tag = metadata_pipe_recv())) { /* streaming tag */ DEBUG("Caught new metadata! %p\n", tag); sendMetadataToAudioDevice(tag); - freeMpdTag(tag); + tag_free(tag); wakeup_main_task(); /* call sync_metadata() in playlist.c */ } else if ((tag = playlist_current_tag())) { /* static file tag */ /* shouldn't need mpdTagsAreEqual here for static tags */ diff --git a/src/playlist.c b/src/playlist.c index 0faeab5ef..9546dee70 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -987,12 +987,12 @@ static void sync_metadata(void) return; song = song_at(playlist.current); if (!song || song->type != SONG_TYPE_URL || - mpdTagsAreEqual(song->tag, tag)) { - freeMpdTag(tag); + tag_equal(song->tag, tag)) { + tag_free(tag); return; } if (song->tag) - freeMpdTag(song->tag); + tag_free(song->tag); song->tag = tag; playlist.songMod[playlist.order[playlist.current]] = playlist.version; incrPlaylistVersion(); diff --git a/src/song.c b/src/song.c index cc1547d10..2958d0dc9 100644 --- a/src/song.c +++ b/src/song.c @@ -92,7 +92,7 @@ void freeJustSong(Song * song) { free(song->url); if (song->tag) - freeMpdTag(song->tag); + tag_free(song->tag); free(song); } @@ -147,7 +147,7 @@ int printSongInfo(int fd, Song * song) printSongUrl(fd, song); if (song->tag) - printMpdTag(fd, song->tag); + tag_print(fd, song->tag); return 0; } @@ -200,7 +200,7 @@ static void insertSongIntoList(SongList * list, ListNode ** nextSongNode, } else if (cmpRet == 0) { Song *tempSong = (Song *) ((*nextSongNode)->data); if (tempSong->mtime != song->mtime) { - freeMpdTag(tempSong->tag); + tag_free(tempSong->tag); tempSong->tag = song->tag; tempSong->mtime = song->mtime; song->tag = NULL; @@ -257,14 +257,14 @@ void readSongInfoIntoList(FILE * fp, SongList * list, Directory * parentDir) */ } else if (matchesAnMpdTagItemKey(buffer, &itemType)) { if (!song->tag) - song->tag = newMpdTag(); - addItemToMpdTag(song->tag, itemType, - &(buffer - [strlen(mpdTagItemKeys[itemType]) + - 2])); + song->tag = tag_new(); + tag_add_item(song->tag, itemType, + &(buffer + [strlen(mpdTagItemKeys[itemType]) + + 2])); } else if (0 == strncmp(SONG_TIME, buffer, strlen(SONG_TIME))) { if (!song->tag) - song->tag = newMpdTag(); + song->tag = tag_new(); song->tag->time = atoi(&(buffer[strlen(SONG_TIME)])); } else if (0 == strncmp(SONG_MTIME, buffer, strlen(SONG_MTIME))) { song->mtime = atoi(&(buffer[strlen(SONG_MTIME)])); @@ -295,7 +295,7 @@ int updateSongInfo(Song * song) rmp2amp_r(abs_path, abs_path); if (song->tag) - freeMpdTag(song->tag); + tag_free(song->tag); song->tag = NULL; diff --git a/src/tag.c b/src/tag.c index b50756036..8c9fddf91 100644 --- a/src/tag.c +++ b/src/tag.c @@ -55,7 +55,7 @@ const char *mpdTagItemKeys[TAG_NUM_OF_ITEM_TYPES] = { static mpd_sint8 ignoreTagItems[TAG_NUM_OF_ITEM_TYPES]; -void initTagConfig(void) +void tag_lib_init(void) { int quit = 0; char *temp; @@ -104,7 +104,7 @@ void initTagConfig(void) free(temp); } -void printTagTypes(int fd) +void tag_print_types(int fd) { int i; @@ -114,7 +114,7 @@ void printTagTypes(int fd) } } -void printMpdTag(int fd, struct mpd_tag *tag) +void tag_print(int fd, struct mpd_tag *tag) { int i; @@ -224,8 +224,8 @@ static struct mpd_tag *getID3Info( continue; if (mpdTag == NULL) - mpdTag = newMpdTag(); - addItemToMpdTag(mpdTag, type, (char *)utf8); + mpdTag = tag_new(); + tag_add_item(mpdTag, type, (char *)utf8); free(utf8); } } @@ -256,8 +256,8 @@ static struct mpd_tag *getID3Info( if(utf8) { if (mpdTag == NULL) - mpdTag = newMpdTag(); - addItemToMpdTag(mpdTag, type, (char *)utf8); + mpdTag = tag_new(); + tag_add_item(mpdTag, type, (char *)utf8); free(utf8); } } @@ -283,7 +283,7 @@ static struct mpd_tag *getID3Info( #endif #ifdef HAVE_ID3TAG -struct mpd_tag *parseId3Tag(struct id3_tag * tag) +struct mpd_tag *tag_id3_import(struct id3_tag * tag) { struct mpd_tag *ret = NULL; @@ -425,7 +425,7 @@ static struct id3_tag *findId3TagFromEnd(FILE * stream) } #endif -struct mpd_tag *id3Dup(char *file) +struct mpd_tag *tag_id3_load(char *file) { struct mpd_tag *ret = NULL; #ifdef HAVE_ID3TAG @@ -434,7 +434,7 @@ struct mpd_tag *id3Dup(char *file) stream = fopen(file, "r"); if (!stream) { - DEBUG("id3Dup: Failed to open file: '%s', %s\n", file, + DEBUG("tag_id3_load: Failed to open file: '%s', %s\n", file, strerror(errno)); return NULL; } @@ -447,13 +447,13 @@ struct mpd_tag *id3Dup(char *file) if (!tag) return NULL; - ret = parseId3Tag(tag); + ret = tag_id3_import(tag); id3_tag_delete(tag); #endif return ret; } -struct mpd_tag *apeDup(char *file) +struct mpd_tag *tag_ape_load(char *file) { struct mpd_tag *ret = NULL; FILE *fp; @@ -556,9 +556,9 @@ struct mpd_tag *apeDup(char *file) for (i = 0; i < 7; i++) { if (strcasecmp(key, apeItems[i]) == 0) { if (!ret) - ret = newMpdTag(); - addItemToMpdTagWithLen(ret, tagItems[i], - p, size); + ret = tag_new(); + tag_add_item_n(ret, tagItems[i], + p, size); } } } @@ -574,7 +574,7 @@ fail: return ret; } -struct mpd_tag *newMpdTag(void) +struct mpd_tag *tag_new(void) { struct mpd_tag *ret = xmalloc(sizeof(*ret)); ret->items = NULL; @@ -605,7 +605,7 @@ static void deleteItem(struct mpd_tag *tag, int idx) } } -void clearItemsFromMpdTag(struct mpd_tag *tag, enum tag_type type) +void tag_clear_items_by_type(struct mpd_tag *tag, enum tag_type type) { int i; @@ -636,13 +636,13 @@ static void clearMpdTag(struct mpd_tag *tag) tag->time = -1; } -void freeMpdTag(struct mpd_tag *tag) +void tag_free(struct mpd_tag *tag) { clearMpdTag(tag); free(tag); } -struct mpd_tag *mpdTagDup(struct mpd_tag *tag) +struct mpd_tag *tag_dup(struct mpd_tag *tag) { struct mpd_tag *ret; int i; @@ -650,17 +650,17 @@ struct mpd_tag *mpdTagDup(struct mpd_tag *tag) if (!tag) return NULL; - ret = newMpdTag(); + ret = tag_new(); ret->time = tag->time; for (i = 0; i < tag->numOfItems; i++) { - addItemToMpdTag(ret, tag->items[i].type, tag->items[i].value); + tag_add_item(ret, tag->items[i].type, tag->items[i].value); } return ret; } -int mpdTagsAreEqual(struct mpd_tag *tag1, struct mpd_tag *tag2) +int tag_equal(struct mpd_tag *tag1, struct mpd_tag *tag2) { int i; @@ -718,8 +718,8 @@ static void appendToTagItems(struct mpd_tag *tag, enum tag_type type, free(duplicated); } -void addItemToMpdTagWithLen(struct mpd_tag *tag, enum tag_type itemType, - const char *value, size_t len) +void tag_add_item_n(struct mpd_tag *tag, enum tag_type itemType, + const char *value, size_t len) { if (ignoreTagItems[itemType]) { diff --git a/src/tag.h b/src/tag.h index 93a6415e6..3f6df0021 100644 --- a/src/tag.h +++ b/src/tag.h @@ -57,33 +57,33 @@ struct mpd_tag { }; #ifdef HAVE_ID3TAG -struct mpd_tag *parseId3Tag(struct id3_tag *); +struct mpd_tag *tag_id3_import(struct id3_tag *); #endif -struct mpd_tag *apeDup(char *file); +struct mpd_tag *tag_ape_load(char *file); -struct mpd_tag *id3Dup(char *file); +struct mpd_tag *tag_id3_load(char *file); -struct mpd_tag *newMpdTag(void); +struct mpd_tag *tag_new(void); -void initTagConfig(void); +void tag_lib_init(void); -void clearItemsFromMpdTag(struct mpd_tag *tag, enum tag_type itemType); +void tag_clear_items_by_type(struct mpd_tag *tag, enum tag_type itemType); -void freeMpdTag(struct mpd_tag *tag); +void tag_free(struct mpd_tag *tag); -void addItemToMpdTagWithLen(struct mpd_tag *tag, enum tag_type itemType, +void tag_add_item_n(struct mpd_tag *tag, enum tag_type itemType, const char *value, size_t len); -#define addItemToMpdTag(tag, itemType, value) \ - addItemToMpdTagWithLen(tag, itemType, value, strlen(value)) +#define tag_add_item(tag, itemType, value) \ + tag_add_item_n(tag, itemType, value, strlen(value)) -void printTagTypes(int fd); +void tag_print_types(int fd); -void printMpdTag(int fd, struct mpd_tag *tag); +void tag_print(int fd, struct mpd_tag *tag); -struct mpd_tag *mpdTagDup(struct mpd_tag *tag); +struct mpd_tag *tag_dup(struct mpd_tag *tag); -int mpdTagsAreEqual(struct mpd_tag *tag1, struct mpd_tag *tag2); +int tag_equal(struct mpd_tag *tag1, struct mpd_tag *tag2); #endif -- cgit v1.2.3