static void asf_build_simple_index(AVFormatContext *s, int stream_index)

{

    ff_asf_guid g;

    ASFContext *asf = s->priv_data;

    int64_t current_pos= avio_tell(s->pb);

    int i;



    avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);

    ff_get_guid(s->pb, &g);



    /* the data object can be followed by other top-level objects,

       skip them until the simple index object is reached */

    while (ff_guidcmp(&g, &index_guid)) {

        int64_t gsize= avio_rl64(s->pb);

        if (gsize < 24 || url_feof(s->pb)) {

            avio_seek(s->pb, current_pos, SEEK_SET);

            return;

        }

        avio_skip(s->pb, gsize-24);

        ff_get_guid(s->pb, &g);

    }



    {

        int64_t itime, last_pos=-1;

        int pct, ict;

        int64_t av_unused gsize= avio_rl64(s->pb);

        ff_get_guid(s->pb, &g);

        itime=avio_rl64(s->pb);

        pct=avio_rl32(s->pb);

        ict=avio_rl32(s->pb);

        av_log(s, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict);



        for (i=0;i<ict;i++){

            int pktnum=avio_rl32(s->pb);

            int pktct =avio_rl16(s->pb);

            int64_t pos      = s->data_offset + s->packet_size*(int64_t)pktnum;

            int64_t index_pts= FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);



            if(pos != last_pos){

            av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d  pts: %"PRId64"\n", pktnum, pktct, index_pts);

            av_add_index_entry(s->streams[stream_index], pos, index_pts, s->packet_size, 0, AVINDEX_KEYFRAME);

            last_pos=pos;

            }

        }

        asf->index_read= 1;

    }

    avio_seek(s->pb, current_pos, SEEK_SET);

}

static void asf_build_simple_index(AVFormatContext *s, int stream_index)

{

    ff_asf_guid g;

    ASFContext *asf = s->priv_data;

    int64_t current_pos= avio_tell(s->pb);

    int i;



    avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);

    ff_get_guid(s->pb, &g);



    



    while (ff_guidcmp(&g, &index_guid)) {

        int64_t gsize= avio_rl64(s->pb);

        if (gsize < 24 || url_feof(s->pb)) {

            avio_seek(s->pb, current_pos, SEEK_SET);

            return;

        }

        avio_skip(s->pb, gsize-24);

        ff_get_guid(s->pb, &g);

    }



    {

        int64_t itime, last_pos=-1;

        int pct, ict;

        int64_t av_unused gsize= avio_rl64(s->pb);

        ff_get_guid(s->pb, &g);

        itime=avio_rl64(s->pb);

        pct=avio_rl32(s->pb);

        ict=avio_rl32(s->pb);

        av_log(s, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict);



        for (i=0;i<ict;i++){

            int pktnum=avio_rl32(s->pb);

            int pktct =avio_rl16(s->pb);

            int64_t pos      = s->data_offset + s->packet_size*(int64_t)pktnum;

            int64_t index_pts= FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);



            if(pos != last_pos){

            av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d  pts: %"PRId64"\n", pktnum, pktct, index_pts);

            av_add_index_entry(s->streams[stream_index], pos, index_pts, s->packet_size, 0, AVINDEX_KEYFRAME);

            last_pos=pos;

            }

        }

        asf->index_read= 1;

    }

    avio_seek(s->pb, current_pos, SEEK_SET);

}

static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)

{

    ff_asf_guid g;

    ASFContext *asf = VAR_0->priv_data;

    int64_t current_pos= avio_tell(VAR_0->pb);

    int VAR_2;



    avio_seek(VAR_0->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);

    ff_get_guid(VAR_0->pb, &g);



    



    while (ff_guidcmp(&g, &index_guid)) {

        int64_t gsize= avio_rl64(VAR_0->pb);

        if (gsize < 24 || url_feof(VAR_0->pb)) {

            avio_seek(VAR_0->pb, current_pos, SEEK_SET);

            return;

        }

        avio_skip(VAR_0->pb, gsize-24);

        ff_get_guid(VAR_0->pb, &g);

    }



    {

        int64_t itime, last_pos=-1;

        int VAR_3, VAR_4;

        int64_t av_unused gsize= avio_rl64(VAR_0->pb);

        ff_get_guid(VAR_0->pb, &g);

        itime=avio_rl64(VAR_0->pb);

        VAR_3=avio_rl32(VAR_0->pb);

        VAR_4=avio_rl32(VAR_0->pb);

        av_log(VAR_0, AV_LOG_DEBUG, "itime:0x%"PRIx64", VAR_3:%d, VAR_4:%d\n",itime,VAR_3,VAR_4);



        for (VAR_2=0;VAR_2<VAR_4;VAR_2++){

            int VAR_5=avio_rl32(VAR_0->pb);

            int VAR_6 =avio_rl16(VAR_0->pb);

            int64_t pos      = VAR_0->data_offset + VAR_0->packet_size*(int64_t)VAR_5;

            int64_t index_pts= FFMAX(av_rescale(itime, VAR_2, 10000) - asf->hdr.preroll, 0);



            if(pos != last_pos){

            av_log(VAR_0, AV_LOG_DEBUG, "VAR_5:%d, VAR_6:%d  pts: %"PRId64"\n", VAR_5, VAR_6, index_pts);

            av_add_index_entry(VAR_0->streams[VAR_1], pos, index_pts, VAR_0->packet_size, 0, AVINDEX_KEYFRAME);

            last_pos=pos;

            }

        }

        asf->index_read= 1;

    }

    avio_seek(VAR_0->pb, current_pos, SEEK_SET);

}

static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)
{ ff_asf_guid g; ASFContext *asf = VAR_0->priv_data; int64_t current_pos= avio_tell(VAR_0->pb); int VAR_2; avio_seek(VAR_0->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET); ff_get_guid(VAR_0->pb, &g); while (ff_guidcmp(&g, &index_guid)) { int64_t gsize= avio_rl64(VAR_0->pb); if (gsize < 24 || url_feof(VAR_0->pb)) { avio_seek(VAR_0->pb, current_pos, SEEK_SET); return; } avio_skip(VAR_0->pb, gsize-24); ff_get_guid(VAR_0->pb, &g); } { int64_t itime, last_pos=-1; int VAR_3, VAR_4; int64_t av_unused gsize= avio_rl64(VAR_0->pb); ff_get_guid(VAR_0->pb, &g); itime=avio_rl64(VAR_0->pb); VAR_3=avio_rl32(VAR_0->pb); VAR_4=avio_rl32(VAR_0->pb); av_log(VAR_0, AV_LOG_DEBUG, "itime:0x%"PRIx64", VAR_3:%d, VAR_4:%d\n",itime,VAR_3,VAR_4); for (VAR_2=0;VAR_2<VAR_4;VAR_2++){ int VAR_5=avio_rl32(VAR_0->pb); int VAR_6 =avio_rl16(VAR_0->pb); int64_t pos      = VAR_0->data_offset + VAR_0->packet_size*(int64_t)VAR_5; int64_t index_pts= FFMAX(av_rescale(itime, VAR_2, 10000) - asf->hdr.preroll, 0); if(pos != last_pos){ av_log(VAR_0, AV_LOG_DEBUG, "VAR_5:%d, VAR_6:%d  pts: %"PRId64"\n", VAR_5, VAR_6, index_pts); av_add_index_entry(VAR_0->streams[VAR_1], pos, index_pts, VAR_0->packet_size, 0, AVINDEX_KEYFRAME); last_pos=pos; } } asf->index_read= 1; } avio_seek(VAR_0->pb, current_pos, SEEK_SET); }