aboutsummaryrefslogtreecommitdiff
path: root/src/tag.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-31 01:54:10 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-31 01:54:10 +0000
commit30424cb3e9cf500165621802f65d552218e080f3 (patch)
treeaae8c4123849ff22271afd25083d918c5b9dc135 /src/tag.c
parentfd6aa253594e18877ca2380961c0425a7de21b2e (diff)
flac_plugin
git-svn-id: https://svn.musicpd.org/mpd/trunk@1246 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c114
1 files changed, 0 insertions, 114 deletions
diff --git a/src/tag.c b/src/tag.c
index c540fa06..493b1a19 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -279,120 +279,6 @@ MpdTag * mp4TagDup(char * utf8file) {
}
#endif
-#ifdef HAVE_FLAC
-MpdTag * flacMetadataDup(char * utf8file, int * vorbisCommentFound) {
- MpdTag * ret = NULL;
- FLAC__Metadata_SimpleIterator * it;
- FLAC__StreamMetadata * block = NULL;
- int offset;
- int len, pos;
-
- *vorbisCommentFound = 0;
-
- it = FLAC__metadata_simple_iterator_new();
- if(!FLAC__metadata_simple_iterator_init(it,rmp2amp(utf8ToFsCharset(utf8file)),1,0)) {
- FLAC__metadata_simple_iterator_delete(it);
- return ret;
- }
-
- do {
- block = FLAC__metadata_simple_iterator_get_block(it);
- if(!block) break;
- if(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
- char * dup;
-
- offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"artist");
- if(offset>=0) {
- *vorbisCommentFound = 1;
- if(!ret) ret = newMpdTag();
- pos = strlen("artist=");
- len = block->data.vorbis_comment.comments[offset].length-pos;
- if(len>0) {
- dup = malloc(len+1);
- memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
- dup[len] = '\0';
- stripReturnChar(dup);
- ret->artist = dup;
- }
- }
- offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"album");
- if(offset>=0) {
- *vorbisCommentFound = 1;
- if(!ret) ret = newMpdTag();
- pos = strlen("album=");
- len = block->data.vorbis_comment.comments[offset].length-pos;
- if(len>0) {
- dup = malloc(len+1);
- memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
- dup[len] = '\0';
- stripReturnChar(dup);
- ret->album = dup;
- }
- }
- offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"title");
- if(offset>=0) {
- *vorbisCommentFound = 1;
- if(!ret) ret = newMpdTag();
- pos = strlen("title=");
- len = block->data.vorbis_comment.comments[offset].length-pos;
- if(len>0) {
- dup = malloc(len+1);
- memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
- dup[len] = '\0';
- stripReturnChar(dup);
- ret->title = dup;
- }
- }
- offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"tracknumber");
- if(offset>=0) {
- *vorbisCommentFound = 1;
- if(!ret) ret = newMpdTag();
- pos = strlen("tracknumber=");
- len = block->data.vorbis_comment.comments[offset].length-pos;
- if(len>0) {
- dup = malloc(len+1);
- memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
- dup[len] = '\0';
- stripReturnChar(dup);
- ret->track = dup;
- }
- }
- }
- else if(block->type == FLAC__METADATA_TYPE_STREAMINFO) {
- if(!ret) ret = newMpdTag();
- ret->time = ((float)block->data.stream_info.
- total_samples) /
- block->data.stream_info.sample_rate +
- 0.5;
- }
- FLAC__metadata_object_delete(block);
- } while(FLAC__metadata_simple_iterator_next(it));
-
- FLAC__metadata_simple_iterator_delete(it);
- return ret;
-}
-
-MpdTag * flacTagDup(char * utf8file) {
- MpdTag * ret = NULL;
- int foundVorbisComment = 0;
-
- ret = flacMetadataDup(utf8file,&foundVorbisComment);
- if(!ret) return NULL;
- if(!foundVorbisComment) {
- MpdTag * temp = id3Dup(utf8file);
- if(temp) {
- temp->time = ret->time;
- freeMpdTag(ret);
- ret = temp;
- }
- }
-
- if(ret) validateUtf8Tag(ret);
-
- return ret;
-}
-#endif
-
MpdTag * newMpdTag() {
MpdTag * ret = malloc(sizeof(MpdTag));
ret->album = NULL;