static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *segment)

{

    int i, length;



    segment->nb_index_entries = avio_rb32(pb);



    length = avio_rb32(pb);





    if (!(segment->temporal_offset_entries=av_calloc(segment->nb_index_entries, sizeof(*segment->temporal_offset_entries))) ||

        !(segment->flag_entries          = av_calloc(segment->nb_index_entries, sizeof(*segment->flag_entries))) ||

        !(segment->stream_offset_entries = av_calloc(segment->nb_index_entries, sizeof(*segment->stream_offset_entries)))) {

        av_freep(&segment->temporal_offset_entries);

        av_freep(&segment->flag_entries);

        return AVERROR(ENOMEM);

    }



    for (i = 0; i < segment->nb_index_entries; i++) {

        if(avio_feof(pb))


        segment->temporal_offset_entries[i] = avio_r8(pb);

        avio_r8(pb);                                        /* KeyFrameOffset */

        segment->flag_entries[i] = avio_r8(pb);

        segment->stream_offset_entries[i] = avio_rb64(pb);

        avio_skip(pb, length - 11);

    }

    return 0;

}
static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *segment)

{

    int i, length;



    segment->nb_index_entries = avio_rb32(pb);



    length = avio_rb32(pb);





    if (!(segment->temporal_offset_entries=av_calloc(segment->nb_index_entries, sizeof(*segment->temporal_offset_entries))) ||

        !(segment->flag_entries          = av_calloc(segment->nb_index_entries, sizeof(*segment->flag_entries))) ||

        !(segment->stream_offset_entries = av_calloc(segment->nb_index_entries, sizeof(*segment->stream_offset_entries)))) {

        av_freep(&segment->temporal_offset_entries);

        av_freep(&segment->flag_entries);

        return AVERROR(ENOMEM);

    }



    for (i = 0; i < segment->nb_index_entries; i++) {

        if(avio_feof(pb))


        segment->temporal_offset_entries[i] = avio_r8(pb);

        avio_r8(pb);                                        

        segment->flag_entries[i] = avio_r8(pb);

        segment->stream_offset_entries[i] = avio_rb64(pb);

        avio_skip(pb, length - 11);

    }

    return 0;

}
static int FUNC_0(AVIOContext *VAR_0, MXFIndexTableSegment *VAR_1)

{

    int VAR_2, VAR_3;



    VAR_1->nb_index_entries = avio_rb32(VAR_0);



    VAR_3 = avio_rb32(VAR_0);





    if (!(VAR_1->temporal_offset_entries=av_calloc(VAR_1->nb_index_entries, sizeof(*VAR_1->temporal_offset_entries))) ||

        !(VAR_1->flag_entries          = av_calloc(VAR_1->nb_index_entries, sizeof(*VAR_1->flag_entries))) ||

        !(VAR_1->stream_offset_entries = av_calloc(VAR_1->nb_index_entries, sizeof(*VAR_1->stream_offset_entries)))) {

        av_freep(&VAR_1->temporal_offset_entries);

        av_freep(&VAR_1->flag_entries);

        return AVERROR(ENOMEM);

    }



    for (VAR_2 = 0; VAR_2 < VAR_1->nb_index_entries; VAR_2++) {

        if(avio_feof(VAR_0))


        VAR_1->temporal_offset_entries[VAR_2] = avio_r8(VAR_0);

        avio_r8(VAR_0);                                        

        VAR_1->flag_entries[VAR_2] = avio_r8(VAR_0);

        VAR_1->stream_offset_entries[VAR_2] = avio_rb64(VAR_0);

        avio_skip(VAR_0, VAR_3 - 11);

    }

    return 0;

}
static int FUNC_0(AVIOContext *VAR_0, MXFIndexTableSegment *VAR_1)
{ int VAR_2, VAR_3; VAR_1->nb_index_entries = avio_rb32(VAR_0); VAR_3 = avio_rb32(VAR_0); if (!(VAR_1->temporal_offset_entries=av_calloc(VAR_1->nb_index_entries, sizeof(*VAR_1->temporal_offset_entries))) ||
!(VAR_1->flag_entries          = av_calloc(VAR_1->nb_index_entries, sizeof(*VAR_1->flag_entries))) ||
!(VAR_1->stream_offset_entries = av_calloc(VAR_1->nb_index_entries, sizeof(*VAR_1->stream_offset_entries)))) { av_freep(&VAR_1->temporal_offset_entries); av_freep(&VAR_1->flag_entries); return AVERROR(ENOMEM); } for (VAR_2 = 0; VAR_2 < VAR_1->nb_index_entries; VAR_2++) { if(avio_feof(VAR_0))
VAR_1->temporal_offset_entries[VAR_2] = avio_r8(VAR_0); avio_r8(VAR_0); VAR_1->flag_entries[VAR_2] = avio_r8(VAR_0); VAR_1->stream_offset_entries[VAR_2] = avio_rb64(VAR_0); avio_skip(VAR_0, VAR_3 - 11); } return 0; }