static void avi_read_nikon(AVFormatContext *s, uint64_t end)

{

    while (avio_tell(s->pb) < end) {

        uint32_t tag  = avio_rl32(s->pb);

        uint32_t size = avio_rl32(s->pb);

        switch (tag) {

        case MKTAG('n', 'c', 't', 'g'):  /* Nikon Tags */

        {

            uint64_t tag_end = avio_tell(s->pb) + size;

            while (avio_tell(s->pb) < tag_end) {

                uint16_t tag     = avio_rl16(s->pb);

                uint16_t size    = avio_rl16(s->pb);

                const char *name = NULL;

                char buffer[64]  = { 0 };

                if (avio_tell(s->pb) + size > tag_end)

                    size = tag_end - avio_tell(s->pb);

                size -= avio_read(s->pb, buffer,

                                  FFMIN(size, sizeof(buffer) - 1));

                switch (tag) {

                case 0x03:

                    name = "maker";

                    break;

                case 0x04:

                    name = "model";

                    break;

                case 0x13:

                    name = "creation_time";

                    if (buffer[4] == ':' && buffer[7] == ':')

                        buffer[4] = buffer[7] = '-';

                    break;

                }

                if (name)

                    av_dict_set(&s->metadata, name, buffer, 0);

                avio_skip(s->pb, size);

            }

            break;

        }

        default:

            avio_skip(s->pb, size);

            break;

        }

    }

}

static void avi_read_nikon(AVFormatContext *s, uint64_t end)

{

    while (avio_tell(s->pb) < end) {

        uint32_t tag  = avio_rl32(s->pb);

        uint32_t size = avio_rl32(s->pb);

        switch (tag) {

        case MKTAG('n', 'c', 't', 'g'):  

        {

            uint64_t tag_end = avio_tell(s->pb) + size;

            while (avio_tell(s->pb) < tag_end) {

                uint16_t tag     = avio_rl16(s->pb);

                uint16_t size    = avio_rl16(s->pb);

                const char *name = NULL;

                char buffer[64]  = { 0 };

                if (avio_tell(s->pb) + size > tag_end)

                    size = tag_end - avio_tell(s->pb);

                size -= avio_read(s->pb, buffer,

                                  FFMIN(size, sizeof(buffer) - 1));

                switch (tag) {

                case 0x03:

                    name = "maker";

                    break;

                case 0x04:

                    name = "model";

                    break;

                case 0x13:

                    name = "creation_time";

                    if (buffer[4] == ':' && buffer[7] == ':')

                        buffer[4] = buffer[7] = '-';

                    break;

                }

                if (name)

                    av_dict_set(&s->metadata, name, buffer, 0);

                avio_skip(s->pb, size);

            }

            break;

        }

        default:

            avio_skip(s->pb, size);

            break;

        }

    }

}

                if (avio_tell(s->pb) + size > tag_end)                     size = tag_end - avio_tell(s->pb);
static void FUNC_0(AVFormatContext *VAR_0, uint64_t VAR_1)

{

    while (avio_tell(VAR_0->pb) < VAR_1) {

        uint32_t tag  = avio_rl32(VAR_0->pb);

        uint32_t size = avio_rl32(VAR_0->pb);

        switch (tag) {

        case MKTAG('n', 'c', 't', 'g'):  

        {

            uint64_t tag_end = avio_tell(VAR_0->pb) + size;

            while (avio_tell(VAR_0->pb) < tag_end) {

                uint16_t tag     = avio_rl16(VAR_0->pb);

                uint16_t size    = avio_rl16(VAR_0->pb);

                const char *VAR_2 = NULL;

                char VAR_3[64]  = { 0 };

                if (avio_tell(VAR_0->pb) + size > tag_end)

                    size = tag_end - avio_tell(VAR_0->pb);

                size -= avio_read(VAR_0->pb, VAR_3,

                                  FFMIN(size, sizeof(VAR_3) - 1));

                switch (tag) {

                case 0x03:

                    VAR_2 = "maker";

                    break;

                case 0x04:

                    VAR_2 = "model";

                    break;

                case 0x13:

                    VAR_2 = "creation_time";

                    if (VAR_3[4] == ':' && VAR_3[7] == ':')

                        VAR_3[4] = VAR_3[7] = '-';

                    break;

                }

                if (VAR_2)

                    av_dict_set(&VAR_0->metadata, VAR_2, VAR_3, 0);

                avio_skip(VAR_0->pb, size);

            }

            break;

        }

        default:

            avio_skip(VAR_0->pb, size);

            break;

        }

    }

}

static void FUNC_0(AVFormatContext *VAR_0, uint64_t VAR_1)
{ while (avio_tell(VAR_0->pb) < VAR_1) { uint32_t tag  = avio_rl32(VAR_0->pb); uint32_t size = avio_rl32(VAR_0->pb); switch (tag) { case MKTAG('n', 'c', 't', 'g'):
{ uint64_t tag_end = avio_tell(VAR_0->pb) + size; while (avio_tell(VAR_0->pb) < tag_end) { uint16_t tag     = avio_rl16(VAR_0->pb); uint16_t size    = avio_rl16(VAR_0->pb); const char *VAR_2 = NULL; char VAR_3[64]  = { 0 }; if (avio_tell(VAR_0->pb) + size > tag_end)
size = tag_end - avio_tell(VAR_0->pb); size -= avio_read(VAR_0->pb, VAR_3,
FFMIN(size, sizeof(VAR_3) - 1)); switch (tag) { case 0x03:
VAR_2 = "maker"; break; case 0x04:
VAR_2 = "model"; break; case 0x13:
VAR_2 = "creation_time"; if (VAR_3[4] == ':' && VAR_3[7] == ':')
VAR_3[4] = VAR_3[7] = '-'; break; } if (VAR_2)
av_dict_set(&VAR_0->metadata, VAR_2, VAR_3, 0); avio_skip(VAR_0->pb, size); } break; } default:
avio_skip(VAR_0->pb, size); break; } } }