forked from FFmpeg/FFmpeg
id3v2: strip trailing spaces from APIC tag
The APIC description must be unique, and some ID3v2 tag writers add spaces to write several APIC entries with the same description. The trailing spaces simply serve as a way to disambiguate the description. Do this so that API users do not have to special-case mp3 to fix this cosmetic issue. Requested-by: wm4 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
622f1468c9
commit
d4007d1763
1 changed files with 11 additions and 0 deletions
|
@ -535,6 +535,13 @@ static void free_apic(void *obj)
|
||||||
av_freep(&apic);
|
av_freep(&apic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rstrip_spaces(char *buf)
|
||||||
|
{
|
||||||
|
size_t len = strlen(buf);
|
||||||
|
while (len > 0 && buf[len - 1] == ' ')
|
||||||
|
buf[--len] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
|
static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
|
||||||
const char *tag, ID3v2ExtraMeta **extra_meta,
|
const char *tag, ID3v2ExtraMeta **extra_meta,
|
||||||
int isv34)
|
int isv34)
|
||||||
|
@ -608,6 +615,10 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
|
||||||
new_extra->next = *extra_meta;
|
new_extra->next = *extra_meta;
|
||||||
*extra_meta = new_extra;
|
*extra_meta = new_extra;
|
||||||
|
|
||||||
|
// The description must be unique, and some ID3v2 tag writers add spaces
|
||||||
|
// to write several APIC entries with the same description.
|
||||||
|
rstrip_spaces(apic->description);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
Loading…
Add table
Reference in a new issue