From 9e93796407ecb8a347f9799c0a03e80939004bd7 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 26 Mar 2022 21:54:23 +0000 Subject: buffering: remove bufgettail/bufcuttail These operations can only be used in limited circumstances and have exactly one user. bufgettail especially seems of dubious value; how often do you need to read N bytes from the end of a file without changing the file position? strip_tags() was the only function using them, to strip off ID3v1 and APE tags off the end of buffered tracks. This would save only 32-192 bytes per track -- if the container format uses APE/ID3v1. It hardly seems worth the effort. Change-Id: I8fc3c1408517eda6126e75e76d76daea904b50eb --- lib/rbcodec/metadata/metadata.c | 38 -------------------------------------- lib/rbcodec/metadata/metadata.h | 1 - 2 files changed, 39 deletions(-) (limited to 'lib/rbcodec') diff --git a/lib/rbcodec/metadata/metadata.c b/lib/rbcodec/metadata/metadata.c index aec72db97f..19147ccdb3 100644 --- a/lib/rbcodec/metadata/metadata.c +++ b/lib/rbcodec/metadata/metadata.c @@ -458,44 +458,6 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname) return true; } -#ifndef __PCTOOL__ -void strip_tags(int handle_id) -{ - static const unsigned char tag[] = "TAG"; - static const unsigned char apetag[] = "APETAGEX"; - size_t len, version; - void *tail; - - if (bufgettail(handle_id, 128, &tail) != 128) - return; - - if (memcmp(tail, tag, 3) == 0) - { - /* Skip id3v1 tag */ - logf("Cutting off ID3v1 tag"); - bufcuttail(handle_id, 128); - } - - /* Get a new tail, as the old one may have been cut */ - if (bufgettail(handle_id, 32, &tail) != 32) - return; - - /* Check for APE tag (look for the APE tag footer) */ - if (memcmp(tail, apetag, 8) != 0) - return; - - /* Read the version and length from the footer */ - version = get_long_le(&((unsigned char *)tail)[8]); - len = get_long_le(&((unsigned char *)tail)[12]); - if (version == 2000) - len += 32; /* APEv2 has a 32 byte header */ - - /* Skip APE tag */ - logf("Cutting off APE tag (%ldB)", len); - bufcuttail(handle_id, len); -} -#endif /* ! __PCTOOL__ */ - #define MOVE_ENTRY(x) if (x) x += offset; void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig) diff --git a/lib/rbcodec/metadata/metadata.h b/lib/rbcodec/metadata/metadata.h index 50fd5bac86..1a205a08eb 100644 --- a/lib/rbcodec/metadata/metadata.h +++ b/lib/rbcodec/metadata/metadata.h @@ -333,7 +333,6 @@ void wipe_mp3entry(struct mp3entry *id3); void fill_metadata_from_path(struct mp3entry *id3, const char *trackname); int get_audio_base_codec_type(int type); -void strip_tags(int handle_id); bool rbcodec_format_is_atomic(int afmt); bool format_buffers_with_offset(int afmt); -- cgit v1.2.3