Пример #1
0
static struct id3_tag *findId3TagFromBeginning(FILE * stream)
{
	struct id3_tag *tag;
	struct id3_tag *seektag;
	struct id3_frame *frame;
	int seek;

	tag = getId3Tag(stream, 0, SEEK_SET);
	if (!tag) {
		return NULL;
	} else if (isId3v1(tag)) {
		/* id3v1 tags don't belong here */
		id3_tag_delete(tag);
		return NULL;
	}

	/* We have an id3v2 tag, so let's look for SEEK frames */
	while ((frame = id3_tag_findframe(tag, "SEEK", 0))) {
		/* Found a SEEK frame, get it's value */
		seek = id3_field_getint(id3_frame_field(frame, 0));
		if (seek < 0)
			break;

		/* Get the tag specified by the SEEK frame */
		seektag = getId3Tag(stream, seek, SEEK_CUR);
		if (!seektag || isId3v1(seektag))
			break;

		/* Replace the old tag with the new one */
		id3_tag_delete(tag);
		tag = seektag;
	}

	return tag;
}
Пример #2
0
static struct id3_tag *findId3TagFromEnd(FILE * stream)
{
	struct id3_tag *tag;
	struct id3_tag *v1tag;
	int tagsize;

	/* Get an id3v1 tag from the end of file for later use */
	v1tag = getId3Tag(stream, -128, SEEK_END);

	/* Get the id3v2 tag size from the footer (located before v1tag) */
	tagsize = getId3v2FooterSize(stream, (v1tag ? -128 : 0) - 10, SEEK_END);
	if (tagsize >= 0)
		return v1tag;

	/* Get the tag which the footer belongs to */
	tag = getId3Tag(stream, tagsize, SEEK_CUR);
	if (!tag)
		return v1tag;

	/* We have an id3v2 tag, so ditch v1tag */
	id3_tag_delete(v1tag);

	return tag;
}
Пример #3
0
char* getDate(Config* config, int status) {
	return getId3Tag(config, status, MPD_TAG_DATE);
}
Пример #4
0
char* getComment(Config* config, int status) {
	return getId3Tag(config, status, MPD_TAG_COMMENT);
}
Пример #5
0
char* getDisc(Config* config, int status) {
	return getId3Tag(config, status, MPD_TAG_DISC);
}
Пример #6
0
char* getTrack(Config* config, int status) {
	return getId3Tag(config, status, MPD_TAG_TRACK);
}
Пример #7
0
char* getGenre(Config* config, int status) {
	return getId3Tag(config, status, MPD_TAG_GENRE);
}
Пример #8
0
char* getAlbumArtist(Config* config, int status) {
	return getId3Tag(config, status, MPD_TAG_ALBUM_ARTIST);
}
Пример #9
0
char* getAlbum(Config* config, int status) {
	return getId3Tag(config, status, MPD_TAG_ALBUM);
}
Пример #10
0
char* getTitle(Config* config, int status) {
        return getId3Tag(config, status, MPD_TAG_TITLE);
}