static void matroska_add_index_entries(MatroskaDemuxContext *matroska)

{

    EbmlList *index_list;

    MatroskaIndex *index;

    int index_scale = 1;

    int i, j;



    if (matroska->ctx->flags & AVFMT_FLAG_IGNIDX)

        return;



    index_list = &matroska->index;

    index      = index_list->elem;

    if (index_list->nb_elem &&

        index[0].time > 1E14 / matroska->time_scale) {

        av_log(matroska->ctx, AV_LOG_WARNING, "Working around broken index.\n");

        index_scale = matroska->time_scale;

    }

    for (i = 0; i < index_list->nb_elem; i++) {

        EbmlList *pos_list    = &index[i].pos;

        MatroskaIndexPos *pos = pos_list->elem;

        for (j = 0; j < pos_list->nb_elem; j++) {

            MatroskaTrack *track = matroska_find_track_by_num(matroska,

                                                              pos[j].track);

            if (track && track->stream)

                av_add_index_entry(track->stream,

                                   pos[j].pos + matroska->segment_start,

                                   index[i].time / index_scale, 0, 0,

                                   AVINDEX_KEYFRAME);

        }

    }

}

static void matroska_add_index_entries(MatroskaDemuxContext *matroska)

{

    EbmlList *index_list;

    MatroskaIndex *index;

    int index_scale = 1;

    int i, j;



    if (matroska->ctx->flags & AVFMT_FLAG_IGNIDX)

        return;



    index_list = &matroska->index;

    index      = index_list->elem;

    if (index_list->nb_elem &&

        index[0].time > 1E14 / matroska->time_scale) {

        av_log(matroska->ctx, AV_LOG_WARNING, "Working around broken index.\n");

        index_scale = matroska->time_scale;

    }

    for (i = 0; i < index_list->nb_elem; i++) {

        EbmlList *pos_list    = &index[i].pos;

        MatroskaIndexPos *pos = pos_list->elem;

        for (j = 0; j < pos_list->nb_elem; j++) {

            MatroskaTrack *track = matroska_find_track_by_num(matroska,

                                                              pos[j].track);

            if (track && track->stream)

                av_add_index_entry(track->stream,

                                   pos[j].pos + matroska->segment_start,

                                   index[i].time / index_scale, 0, 0,

                                   AVINDEX_KEYFRAME);

        }

    }

}

    int index_scale = 1;
static void FUNC_0(MatroskaDemuxContext *VAR_0)

{

    EbmlList *index_list;

    MatroskaIndex *index;

    int VAR_1 = 1;

    int VAR_2, VAR_3;



    if (VAR_0->ctx->flags & AVFMT_FLAG_IGNIDX)

        return;



    index_list = &VAR_0->index;

    index      = index_list->elem;

    if (index_list->nb_elem &&

        index[0].time > 1E14 / VAR_0->time_scale) {

        av_log(VAR_0->ctx, AV_LOG_WARNING, "Working around broken index.\n");

        VAR_1 = VAR_0->time_scale;

    }

    for (VAR_2 = 0; VAR_2 < index_list->nb_elem; VAR_2++) {

        EbmlList *pos_list    = &index[VAR_2].pos;

        MatroskaIndexPos *pos = pos_list->elem;

        for (VAR_3 = 0; VAR_3 < pos_list->nb_elem; VAR_3++) {

            MatroskaTrack *track = matroska_find_track_by_num(VAR_0,

                                                              pos[VAR_3].track);

            if (track && track->stream)

                av_add_index_entry(track->stream,

                                   pos[VAR_3].pos + VAR_0->segment_start,

                                   index[VAR_2].time / VAR_1, 0, 0,

                                   AVINDEX_KEYFRAME);

        }

    }

}

static void FUNC_0(MatroskaDemuxContext *VAR_0)
{ EbmlList *index_list; MatroskaIndex *index; int VAR_1 = 1; int VAR_2, VAR_3; if (VAR_0->ctx->flags & AVFMT_FLAG_IGNIDX)
return; index_list = &VAR_0->index; index      = index_list->elem; if (index_list->nb_elem &&
index[0].time > 1E14 / VAR_0->time_scale) { av_log(VAR_0->ctx, AV_LOG_WARNING, "Working around broken index.\n"); VAR_1 = VAR_0->time_scale; } for (VAR_2 = 0; VAR_2 < index_list->nb_elem; VAR_2++) { EbmlList *pos_list    = &index[VAR_2].pos; MatroskaIndexPos *pos = pos_list->elem; for (VAR_3 = 0; VAR_3 < pos_list->nb_elem; VAR_3++) { MatroskaTrack *track = matroska_find_track_by_num(VAR_0,
pos[VAR_3].track); if (track && track->stream)
av_add_index_entry(track->stream,
pos[VAR_3].pos + VAR_0->segment_start,
index[VAR_2].time / VAR_1, 0, 0,
AVINDEX_KEYFRAME); } } }