uint64_t p = min + (max - min) * target_ts / (tmax - tmin);
uint64_t p = min + (max - min) * (target_ts - tmin) / (tmax - tmin);
ogg_read_seek (AVFormatContext * s, int stream_index, int64_t target_ts,               int flags){    ogg_t *ogg = s->priv_data;    ByteIOContext *bc = &s->pb;    uint64_t min = 0, max = ogg->size;    uint64_t tmin = 0, tmax = s->duration;    int64_t pts = AV_NOPTS_VALUE;    ogg_save (s);    while (min <= max){        uint64_t p = min + (max - min) * target_ts / (tmax - tmin);        int i = -1;        url_fseek (bc, p, SEEK_SET);        while (!ogg_read_page (s, &i)){            if (ogg->streams[i].granule != 0 && ogg->streams[i].granule != -1)                break;        }        if (i == -1)            break;        pts = ogg_gptopts (s, i, ogg->streams[i].granule);        p = url_ftell (bc);        if (ABS (pts - target_ts) < 1000000LL)            break;        if (pts > target_ts){            max = p;            tmax = pts;        }else{            min = p;            tmin = pts;        }    }    if (ABS (pts - target_ts) < 1000000LL){        ogg_restore (s, 1);        ogg_reset (ogg);    }else{        ogg_restore (s, 0);        pts = AV_NOPTS_VALUE;    }    return pts;#if 0    //later...    int64_t pos;    if (av_seek_frame_binary (s, stream_index, target_ts, flags) < 0)        return -1;    pos = url_ftell (&s->pb);    ogg_read_timestamp (s, stream_index, &pos, pos - 1);#endif}