static int av_seek_frame_generic(AVFormatContext *s, 

                                 int stream_index, int64_t timestamp)

{

    int index;

    AVStream *st;

    AVIndexEntry *ie;



    if (!s->index_built) {

        if (is_raw_stream(s)) {

            av_build_index_raw(s);

        } else {

            return -1;

        }

        s->index_built = 1;

    }



    if (stream_index < 0)

        stream_index = 0;

    st = s->streams[stream_index];

    index = index_search_timestamp(st->index_entries, st->nb_index_entries,

                                   timestamp);

    if (index < 0)

        return -1;



    /* now we have found the index, we can seek */

    ie = &st->index_entries[index];

    av_read_frame_flush(s);

    url_fseek(&s->pb, ie->pos, SEEK_SET);

    st->cur_dts = ie->timestamp;

    return 0;

}

static int av_seek_frame_generic(AVFormatContext *s, 

                                 int stream_index, int64_t timestamp)

{

    int index;

    AVStream *st;

    AVIndexEntry *ie;



    if (!s->index_built) {

        if (is_raw_stream(s)) {

            av_build_index_raw(s);

        } else {

            return -1;

        }

        s->index_built = 1;

    }



    if (stream_index < 0)

        stream_index = 0;

    st = s->streams[stream_index];

    index = index_search_timestamp(st->index_entries, st->nb_index_entries,

                                   timestamp);

    if (index < 0)

        return -1;



    

    ie = &st->index_entries[index];

    av_read_frame_flush(s);

    url_fseek(&s->pb, ie->pos, SEEK_SET);

    st->cur_dts = ie->timestamp;

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, 

                                 int VAR_1, int64_t VAR_2)

{

    int VAR_3;

    AVStream *st;

    AVIndexEntry *ie;



    if (!VAR_0->index_built) {

        if (is_raw_stream(VAR_0)) {

            av_build_index_raw(VAR_0);

        } else {

            return -1;

        }

        VAR_0->index_built = 1;

    }



    if (VAR_1 < 0)

        VAR_1 = 0;

    st = VAR_0->streams[VAR_1];

    VAR_3 = index_search_timestamp(st->index_entries, st->nb_index_entries,

                                   VAR_2);

    if (VAR_3 < 0)

        return -1;



    

    ie = &st->index_entries[VAR_3];

    av_read_frame_flush(VAR_0);

    url_fseek(&VAR_0->pb, ie->pos, SEEK_SET);

    st->cur_dts = ie->VAR_2;

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0,
int VAR_1, int64_t VAR_2)
{ int VAR_3; AVStream *st; AVIndexEntry *ie; if (!VAR_0->index_built) { if (is_raw_stream(VAR_0)) { av_build_index_raw(VAR_0); } else { return -1; } VAR_0->index_built = 1; } if (VAR_1 < 0)
VAR_1 = 0; st = VAR_0->streams[VAR_1]; VAR_3 = index_search_timestamp(st->index_entries, st->nb_index_entries,
VAR_2); if (VAR_3 < 0)
return -1; ie = &st->index_entries[VAR_3]; av_read_frame_flush(VAR_0); url_fseek(&VAR_0->pb, ie->pos, SEEK_SET); st->cur_dts = ie->VAR_2; return 0; }