static void gxf_read_index(AVFormatContext *s, int pkt_len) {

    AVIOContext *pb = s->pb;

    AVStream *st = s->streams[0];

    uint32_t fields_per_map = avio_rl32(pb);

    uint32_t map_cnt = avio_rl32(pb);

    int i;

    pkt_len -= 8;

    if (s->flags & AVFMT_FLAG_IGNIDX) {

        avio_skip(pb, pkt_len);

        return;

    }

    if (map_cnt > 1000) {

        av_log(s, AV_LOG_ERROR, "too many index entries %u (%x)\n", map_cnt, map_cnt);

        map_cnt = 1000;

    }

    if (pkt_len < 4 * map_cnt) {

        av_log(s, AV_LOG_ERROR, "invalid index length\n");

        avio_skip(pb, pkt_len);

        return;

    }

    pkt_len -= 4 * map_cnt;

    av_add_index_entry(st, 0, 0, 0, 0, 0);

    for (i = 0; i < map_cnt; i++)

        av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024,

                           i * (uint64_t)fields_per_map + 1, 0, 0, 0);

    avio_skip(pb, pkt_len);

}

static void gxf_read_index(AVFormatContext *s, int pkt_len) {

    AVIOContext *pb = s->pb;

    AVStream *st = s->streams[0];

    uint32_t fields_per_map = avio_rl32(pb);

    uint32_t map_cnt = avio_rl32(pb);

    int i;

    pkt_len -= 8;

    if (s->flags & AVFMT_FLAG_IGNIDX) {

        avio_skip(pb, pkt_len);

        return;

    }

    if (map_cnt > 1000) {

        av_log(s, AV_LOG_ERROR, "too many index entries %u (%x)\n", map_cnt, map_cnt);

        map_cnt = 1000;

    }

    if (pkt_len < 4 * map_cnt) {

        av_log(s, AV_LOG_ERROR, "invalid index length\n");

        avio_skip(pb, pkt_len);

        return;

    }

    pkt_len -= 4 * map_cnt;

    av_add_index_entry(st, 0, 0, 0, 0, 0);

    for (i = 0; i < map_cnt; i++)

        av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024,

                           i * (uint64_t)fields_per_map + 1, 0, 0, 0);

    avio_skip(pb, pkt_len);

}

    AVStream *st = s->streams[0];     if (s->flags & AVFMT_FLAG_IGNIDX) {
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1) {

    AVIOContext *pb = VAR_0->pb;

    AVStream *st = VAR_0->streams[0];

    uint32_t fields_per_map = avio_rl32(pb);

    uint32_t map_cnt = avio_rl32(pb);

    int VAR_2;

    VAR_1 -= 8;

    if (VAR_0->flags & AVFMT_FLAG_IGNIDX) {

        avio_skip(pb, VAR_1);

        return;

    }

    if (map_cnt > 1000) {

        av_log(VAR_0, AV_LOG_ERROR, "too many index entries %u (%x)\n", map_cnt, map_cnt);

        map_cnt = 1000;

    }

    if (VAR_1 < 4 * map_cnt) {

        av_log(VAR_0, AV_LOG_ERROR, "invalid index length\n");

        avio_skip(pb, VAR_1);

        return;

    }

    VAR_1 -= 4 * map_cnt;

    av_add_index_entry(st, 0, 0, 0, 0, 0);

    for (VAR_2 = 0; VAR_2 < map_cnt; VAR_2++)

        av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024,

                           VAR_2 * (uint64_t)fields_per_map + 1, 0, 0, 0);

    avio_skip(pb, VAR_1);

}

static void FUNC_0(AVFormatContext *VAR_0, int VAR_1) { AVIOContext *pb = VAR_0->pb; AVStream *st = VAR_0->streams[0]; uint32_t fields_per_map = avio_rl32(pb); uint32_t map_cnt = avio_rl32(pb); int VAR_2; VAR_1 -= 8; if (VAR_0->flags & AVFMT_FLAG_IGNIDX) { avio_skip(pb, VAR_1); return; } if (map_cnt > 1000) { av_log(VAR_0, AV_LOG_ERROR, "too many index entries %u (%x)\n", map_cnt, map_cnt); map_cnt = 1000; } if (VAR_1 < 4 * map_cnt) { av_log(VAR_0, AV_LOG_ERROR, "invalid index length\n"); avio_skip(pb, VAR_1); return; } VAR_1 -= 4 * map_cnt; av_add_index_entry(st, 0, 0, 0, 0, 0); for (VAR_2 = 0; VAR_2 < map_cnt; VAR_2++) av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024,
VAR_2 * (uint64_t)fields_per_map + 1, 0, 0, 0); avio_skip(pb, VAR_1); }