static void read_ttag(AVFormatContext *s, int taglen, const char *key)

{

    char *q, dst[512];

    int len, dstlen = sizeof(dst) - 1;

    unsigned genre;



    dst[0] = 0;

    if (taglen < 1)

        return;



    taglen--; /* account for encoding type byte */



    switch (get_byte(s->pb)) { /* encoding type */



    case 0:  /* ISO-8859-1 (0 - 255 maps directly into unicode) */

        q = dst;

        while (taglen--) {

            uint8_t tmp;

            PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)

        }

        *q = '\0';

        break;



    case 3:  /* UTF-8 */

        len = FFMIN(taglen, dstlen - 1);

        get_buffer(s->pb, dst, len);

        dst[len] = 0;

        break;

    }



    if (!strcmp(key, "genre")

        && (sscanf(dst, "(%d)", &genre) == 1 || sscanf(dst, "%d", &genre) == 1)

        && genre <= ID3v1_GENRE_MAX)

        av_strlcpy(dst, ff_id3v1_genre_str[genre], sizeof(dst));



    if (*dst)

        av_metadata_set(&s->metadata, key, dst);

}

static void read_ttag(AVFormatContext *s, int taglen, const char *key)

{

    char *q, dst[512];

    int len, dstlen = sizeof(dst) - 1;

    unsigned genre;



    dst[0] = 0;

    if (taglen < 1)

        return;



    taglen--; 



    switch (get_byte(s->pb)) { 



    case 0:  

        q = dst;

        while (taglen--) {

            uint8_t tmp;

            PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)

        }

        *q = '\0';

        break;



    case 3:  

        len = FFMIN(taglen, dstlen - 1);

        get_buffer(s->pb, dst, len);

        dst[len] = 0;

        break;

    }



    if (!strcmp(key, "genre")

        && (sscanf(dst, "(%d)", &genre) == 1 || sscanf(dst, "%d", &genre) == 1)

        && genre <= ID3v1_GENRE_MAX)

        av_strlcpy(dst, ff_id3v1_genre_str[genre], sizeof(dst));



    if (*dst)

        av_metadata_set(&s->metadata, key, dst);

}

static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, const char *VAR_2)

{

    char *VAR_3, VAR_4[512];

    int VAR_5, VAR_6 = sizeof(VAR_4) - 1;

    unsigned VAR_7;



    VAR_4[0] = 0;

    if (VAR_1 < 1)

        return;



    VAR_1--; 



    switch (get_byte(VAR_0->pb)) { 



    case 0:  

        VAR_3 = VAR_4;

        while (VAR_1--) {

            uint8_t tmp;

            PUT_UTF8(get_byte(VAR_0->pb), tmp, if (VAR_3 - VAR_4 < VAR_6 - 1) *VAR_3++ = tmp;)

        }

        *VAR_3 = '\0';

        break;



    case 3:  

        VAR_5 = FFMIN(VAR_1, VAR_6 - 1);

        get_buffer(VAR_0->pb, VAR_4, VAR_5);

        VAR_4[VAR_5] = 0;

        break;

    }



    if (!strcmp(VAR_2, "VAR_7")

        && (sscanf(VAR_4, "(%d)", &VAR_7) == 1 || sscanf(VAR_4, "%d", &VAR_7) == 1)

        && VAR_7 <= ID3v1_GENRE_MAX)

        av_strlcpy(VAR_4, ff_id3v1_genre_str[VAR_7], sizeof(VAR_4));



    if (*VAR_4)

        av_metadata_set(&VAR_0->metadata, VAR_2, VAR_4);

}

static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, const char *VAR_2)
{ char *VAR_3, VAR_4[512]; int VAR_5, VAR_6 = sizeof(VAR_4) - 1; unsigned VAR_7; VAR_4[0] = 0; if (VAR_1 < 1)
return; VAR_1--; switch (get_byte(VAR_0->pb)) { case 0:
VAR_3 = VAR_4; while (VAR_1--) { uint8_t tmp; PUT_UTF8(get_byte(VAR_0->pb), tmp, if (VAR_3 - VAR_4 < VAR_6 - 1) *VAR_3++ = tmp;) } *VAR_3 = '\0'; break; case 3:
VAR_5 = FFMIN(VAR_1, VAR_6 - 1); get_buffer(VAR_0->pb, VAR_4, VAR_5); VAR_4[VAR_5] = 0; break; } if (!strcmp(VAR_2, "VAR_7")
&& (sscanf(VAR_4, "(%d)", &VAR_7) == 1 || sscanf(VAR_4, "%d", &VAR_7) == 1)
&& VAR_7 <= ID3v1_GENRE_MAX)
av_strlcpy(VAR_4, ff_id3v1_genre_str[VAR_7], sizeof(VAR_4)); if (*VAR_4)
av_metadata_set(&VAR_0->metadata, VAR_2, VAR_4); }