Revision 2ef46053

View differences:

ffplay.c
971 971
}
972 972

  
973 973
/* seek in the stream */
974
static void stream_seek(VideoState *is, int64_t pos, int64_t rel)
974
static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int seek_by_bytes)
975 975
{
976 976
    if (!is->seek_req) {
977 977
        is->seek_pos = pos;
......
2319 2319
                        else
2320 2320
                            incr *= 180000.0;
2321 2321
                        pos += incr;
2322
                        stream_seek(cur_stream, pos, incr);
2322
                        stream_seek(cur_stream, pos, incr, 1);
2323 2323
                    } else {
2324 2324
                        pos = get_master_clock(cur_stream);
2325 2325
                        pos += incr;
2326
                        stream_seek(cur_stream, (int64_t)(pos * AV_TIME_BASE), (int64_t)(incr * AV_TIME_BASE));
2326
                        stream_seek(cur_stream, (int64_t)(pos * AV_TIME_BASE), (int64_t)(incr * AV_TIME_BASE), 0);
2327 2327
                    }
2328 2328
                }
2329 2329
                break;
......
2333 2333
            break;
2334 2334
        case SDL_MOUSEBUTTONDOWN:
2335 2335
            if (cur_stream) {
2336
                if(seek_by_bytes || cur_stream->ic->duration<=0){
2337
                    uint64_t size=  url_fsize(cur_stream->ic->pb);
2338
                    stream_seek(cur_stream, size*(double)event.button.x/(double)cur_stream->width, 0, 1);
2339
                }else{
2336 2340
                int64_t ts;
2337 2341
                int ns, hh, mm, ss;
2338 2342
                int tns, thh, tmm, tss;
......
2350 2354
                ts = frac*cur_stream->ic->duration;
2351 2355
                if (cur_stream->ic->start_time != AV_NOPTS_VALUE)
2352 2356
                    ts += cur_stream->ic->start_time;
2353
                stream_seek(cur_stream, ts, 0);
2357
                stream_seek(cur_stream, ts, 0, 0);
2358
                }
2354 2359
            }
2355 2360
            break;
2356 2361
        case SDL_VIDEORESIZE:

Also available in: Unified diff