static int yop_read_seek(AVFormatContext *s, int stream_index,

                         int64_t timestamp, int flags)

{

    YopDecContext *yop = s->priv_data;

    int64_t frame_pos, pos_min, pos_max;

    int frame_count;



    av_free_packet(&yop->video_packet);



    if (!stream_index)

        return -1;



    pos_min        = s->data_offset;

    pos_max        = avio_size(s->pb) - yop->frame_size;

    frame_count    = (pos_max - pos_min) / yop->frame_size;



    timestamp      = FFMAX(0, FFMIN(frame_count, timestamp));



    frame_pos      = timestamp * yop->frame_size + pos_min;

    yop->odd_frame = timestamp & 1;



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

    return 0;

}

static int yop_read_seek(AVFormatContext *s, int stream_index,

                         int64_t timestamp, int flags)

{

    YopDecContext *yop = s->priv_data;

    int64_t frame_pos, pos_min, pos_max;

    int frame_count;



    av_free_packet(&yop->video_packet);



    if (!stream_index)

        return -1;



    pos_min        = s->data_offset;

    pos_max        = avio_size(s->pb) - yop->frame_size;

    frame_count    = (pos_max - pos_min) / yop->frame_size;



    timestamp      = FFMAX(0, FFMIN(frame_count, timestamp));



    frame_pos      = timestamp * yop->frame_size + pos_min;

    yop->odd_frame = timestamp & 1;



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

    return 0;

}

    av_free_packet(&yop->video_packet);     avio_seek(s->pb, frame_pos, SEEK_SET);
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1,

                         int64_t VAR_2, int VAR_3)

{

    YopDecContext *yop = VAR_0->priv_data;

    int64_t frame_pos, pos_min, pos_max;

    int VAR_4;



    av_free_packet(&yop->video_packet);



    if (!VAR_1)

        return -1;



    pos_min        = VAR_0->data_offset;

    pos_max        = avio_size(VAR_0->pb) - yop->frame_size;

    VAR_4    = (pos_max - pos_min) / yop->frame_size;



    VAR_2      = FFMAX(0, FFMIN(VAR_4, VAR_2));



    frame_pos      = VAR_2 * yop->frame_size + pos_min;

    yop->odd_frame = VAR_2 & 1;



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

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, int VAR_1,
int64_t VAR_2, int VAR_3)
{ YopDecContext *yop = VAR_0->priv_data; int64_t frame_pos, pos_min, pos_max; int VAR_4; av_free_packet(&yop->video_packet); if (!VAR_1)
return -1; pos_min        = VAR_0->data_offset; pos_max        = avio_size(VAR_0->pb) - yop->frame_size; VAR_4    = (pos_max - pos_min) / yop->frame_size; VAR_2      = FFMAX(0, FFMIN(VAR_4, VAR_2)); frame_pos      = VAR_2 * yop->frame_size + pos_min; yop->odd_frame = VAR_2 & 1; avio_seek(VAR_0->pb, frame_pos, SEEK_SET); return 0; }