ID3v1 fields have a fixed size, and they are padded either with zeros,
or with spaces. Handle the latter case, instead of putting strings with
trailing spaces into the AVDictionary.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
const uint8_t *buf, int buf_size)
{
int i, c;
const uint8_t *buf, int buf_size)
{
int i, c;
+ char *q, str[512], *first_free_space = NULL;
q = str;
for(i = 0; i < buf_size; i++) {
q = str;
for(i = 0; i < buf_size; i++) {
break;
if ((q - str) >= sizeof(str) - 1)
break;
break;
if ((q - str) >= sizeof(str) - 1)
break;
+ if (c == ' ') {
+ if (!first_free_space)
+ first_free_space = q;
+ } else {
+ first_free_space = NULL;
+ }
+ if (first_free_space)
+ *first_free_space = '\0';
+
if (*str)
av_dict_set(&s->metadata, key, str, 0);
}
if (*str)
av_dict_set(&s->metadata, key, str, 0);
}