static int read_tfra(MOVContext *mov, AVIOContext *f)

{

    MOVFragmentIndex* index = NULL;

    int version, fieldlength, i, j, err;

    int64_t pos = avio_tell(f);

    uint32_t size = avio_rb32(f);

    if (avio_rb32(f) != MKBETAG('t', 'f', 'r', 'a')) {

        return -1;

    }

    av_log(mov->fc, AV_LOG_VERBOSE, "found tfra\n");

    index = av_mallocz(sizeof(MOVFragmentIndex));

    if (!index) {

        return AVERROR(ENOMEM);

    }

    mov->fragment_index_count++;

    if ((err = av_reallocp(&mov->fragment_index_data,

                           mov->fragment_index_count *

                           sizeof(MOVFragmentIndex*))) < 0) {

        av_freep(&index);

        return err;

    }

    mov->fragment_index_data[mov->fragment_index_count - 1] =

        index;



    version = avio_r8(f);

    avio_rb24(f);

    index->track_id = avio_rb32(f);

    fieldlength = avio_rb32(f);

    index->item_count = avio_rb32(f);

    index->items = av_mallocz(

            index->item_count * sizeof(MOVFragmentIndexItem));

    if (!index->items) {

        return AVERROR(ENOMEM);

    }

    for (i = 0; i < index->item_count; i++) {

        int64_t time, offset;

        if (version == 1) {

            time   = avio_rb64(f);

            offset = avio_rb64(f);

        } else {

            time   = avio_rb32(f);

            offset = avio_rb32(f);

        }

        index->items[i].time = time;

        index->items[i].moof_offset = offset;

        for (j = 0; j < ((fieldlength >> 4) & 3) + 1; j++)

            avio_r8(f);

        for (j = 0; j < ((fieldlength >> 2) & 3) + 1; j++)

            avio_r8(f);

        for (j = 0; j < ((fieldlength >> 0) & 3) + 1; j++)

            avio_r8(f);

    }



    avio_seek(f, pos + size, SEEK_SET);

    return 0;

}

static int read_tfra(MOVContext *mov, AVIOContext *f)

{

    MOVFragmentIndex* index = NULL;

    int version, fieldlength, i, j, err;

    int64_t pos = avio_tell(f);

    uint32_t size = avio_rb32(f);

    if (avio_rb32(f) != MKBETAG('t', 'f', 'r', 'a')) {

        return -1;

    }

    av_log(mov->fc, AV_LOG_VERBOSE, "found tfra\n");

    index = av_mallocz(sizeof(MOVFragmentIndex));

    if (!index) {

        return AVERROR(ENOMEM);

    }

    mov->fragment_index_count++;

    if ((err = av_reallocp(&mov->fragment_index_data,

                           mov->fragment_index_count *

                           sizeof(MOVFragmentIndex*))) < 0) {

        av_freep(&index);

        return err;

    }

    mov->fragment_index_data[mov->fragment_index_count - 1] =

        index;



    version = avio_r8(f);

    avio_rb24(f);

    index->track_id = avio_rb32(f);

    fieldlength = avio_rb32(f);

    index->item_count = avio_rb32(f);

    index->items = av_mallocz(

            index->item_count * sizeof(MOVFragmentIndexItem));

    if (!index->items) {

        return AVERROR(ENOMEM);

    }

    for (i = 0; i < index->item_count; i++) {

        int64_t time, offset;

        if (version == 1) {

            time   = avio_rb64(f);

            offset = avio_rb64(f);

        } else {

            time   = avio_rb32(f);

            offset = avio_rb32(f);

        }

        index->items[i].time = time;

        index->items[i].moof_offset = offset;

        for (j = 0; j < ((fieldlength >> 4) & 3) + 1; j++)

            avio_r8(f);

        for (j = 0; j < ((fieldlength >> 2) & 3) + 1; j++)

            avio_r8(f);

        for (j = 0; j < ((fieldlength >> 0) & 3) + 1; j++)

            avio_r8(f);

    }



    avio_seek(f, pos + size, SEEK_SET);

    return 0;

}

    int version, fieldlength, i, j, err;         return -1;     mov->fragment_index_count++;     if ((err = av_reallocp(&mov->fragment_index_data,                            mov->fragment_index_count *                            sizeof(MOVFragmentIndex*))) < 0) {         return err;     mov->fragment_index_data[mov->fragment_index_count - 1] =         index;     index->items = av_mallocz(             index->item_count * sizeof(MOVFragmentIndexItem));
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1)

{

    MOVFragmentIndex* index = NULL;

    int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;

    int64_t pos = avio_tell(VAR_1);

    uint32_t size = avio_rb32(VAR_1);

    if (avio_rb32(VAR_1) != MKBETAG('t', 'VAR_1', 'r', 'a')) {

        return -1;

    }

    av_log(VAR_0->fc, AV_LOG_VERBOSE, "found tfra\n");

    index = av_mallocz(sizeof(MOVFragmentIndex));

    if (!index) {

        return AVERROR(ENOMEM);

    }

    VAR_0->fragment_index_count++;

    if ((VAR_6 = av_reallocp(&VAR_0->fragment_index_data,

                           VAR_0->fragment_index_count *

                           sizeof(MOVFragmentIndex*))) < 0) {

        av_freep(&index);

        return VAR_6;

    }

    VAR_0->fragment_index_data[VAR_0->fragment_index_count - 1] =

        index;



    VAR_2 = avio_r8(VAR_1);

    avio_rb24(VAR_1);

    index->track_id = avio_rb32(VAR_1);

    VAR_3 = avio_rb32(VAR_1);

    index->item_count = avio_rb32(VAR_1);

    index->items = av_mallocz(

            index->item_count * sizeof(MOVFragmentIndexItem));

    if (!index->items) {

        return AVERROR(ENOMEM);

    }

    for (VAR_4 = 0; VAR_4 < index->item_count; VAR_4++) {

        int64_t time, offset;

        if (VAR_2 == 1) {

            time   = avio_rb64(VAR_1);

            offset = avio_rb64(VAR_1);

        } else {

            time   = avio_rb32(VAR_1);

            offset = avio_rb32(VAR_1);

        }

        index->items[VAR_4].time = time;

        index->items[VAR_4].moof_offset = offset;

        for (VAR_5 = 0; VAR_5 < ((VAR_3 >> 4) & 3) + 1; VAR_5++)

            avio_r8(VAR_1);

        for (VAR_5 = 0; VAR_5 < ((VAR_3 >> 2) & 3) + 1; VAR_5++)

            avio_r8(VAR_1);

        for (VAR_5 = 0; VAR_5 < ((VAR_3 >> 0) & 3) + 1; VAR_5++)

            avio_r8(VAR_1);

    }



    avio_seek(VAR_1, pos + size, SEEK_SET);

    return 0;

}

static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1)
{ MOVFragmentIndex* index = NULL; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int64_t pos = avio_tell(VAR_1); uint32_t size = avio_rb32(VAR_1); if (avio_rb32(VAR_1) != MKBETAG('t', 'VAR_1', 'r', 'a')) { return -1; } av_log(VAR_0->fc, AV_LOG_VERBOSE, "found tfra\n"); index = av_mallocz(sizeof(MOVFragmentIndex)); if (!index) { return AVERROR(ENOMEM); } VAR_0->fragment_index_count++; if ((VAR_6 = av_reallocp(&VAR_0->fragment_index_data,
VAR_0->fragment_index_count *
sizeof(MOVFragmentIndex*))) < 0) { av_freep(&index); return VAR_6; } VAR_0->fragment_index_data[VAR_0->fragment_index_count - 1] =
index; VAR_2 = avio_r8(VAR_1); avio_rb24(VAR_1); index->track_id = avio_rb32(VAR_1); VAR_3 = avio_rb32(VAR_1); index->item_count = avio_rb32(VAR_1); index->items = av_mallocz(
index->item_count * sizeof(MOVFragmentIndexItem)); if (!index->items) { return AVERROR(ENOMEM); } for (VAR_4 = 0; VAR_4 < index->item_count; VAR_4++) { int64_t time, offset; if (VAR_2 == 1) { time   = avio_rb64(VAR_1); offset = avio_rb64(VAR_1); } else { time   = avio_rb32(VAR_1); offset = avio_rb32(VAR_1); } index->items[VAR_4].time = time; index->items[VAR_4].moof_offset = offset; for (VAR_5 = 0; VAR_5 < ((VAR_3 >> 4) & 3) + 1; VAR_5++) avio_r8(VAR_1); for (VAR_5 = 0; VAR_5 < ((VAR_3 >> 2) & 3) + 1; VAR_5++) avio_r8(VAR_1); for (VAR_5 = 0; VAR_5 < ((VAR_3 >> 0) & 3) + 1; VAR_5++) avio_r8(VAR_1); } avio_seek(VAR_1, pos + size, SEEK_SET); return 0; }