Revision fc8fa007

View differences:

libavformat/flvdec.c
449 449
    return ret;
450 450
}
451 451

  
452
static int flv_read_seek(AVFormatContext *s, int stream_index,
453
    int64_t ts, int flags)
454
{
455
    return av_url_read_fseek(s->pb, stream_index, ts, flags);
456
}
457

  
458
#if 0 /* don't know enough to implement this */
459
static int flv_read_seek2(AVFormatContext *s, int stream_index,
460
    int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
461
{
462
    int ret = AVERROR(ENOSYS);
463

  
464
    if (ts - min_ts > (uint64_t)(max_ts - ts)) flags |= AVSEEK_FLAG_BACKWARD;
465

  
466
    if (url_is_streamed(s->pb)) {
467
        if (stream_index < 0) {
468
            stream_index = av_find_default_stream_index(s);
469
            if (stream_index < 0)
470
                return -1;
471

  
472
            /* timestamp for default must be expressed in AV_TIME_BASE units */
473
            ts = av_rescale_rnd(ts, 1000, AV_TIME_BASE,
474
                flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP);
475
        }
476
        ret = av_url_read_fseek(s->pb, stream_index, ts, flags);
477
    }
478

  
479
    if (ret == AVERROR(ENOSYS))
480
        ret = av_seek_frame(s, stream_index, ts, flags);
481
    return ret;
482
}
483
#endif
484

  
452 485
AVInputFormat flv_demuxer = {
453 486
    "flv",
454 487
    NULL_IF_CONFIG_SMALL("FLV format"),
......
456 489
    flv_probe,
457 490
    flv_read_header,
458 491
    flv_read_packet,
492
    .read_seek = flv_read_seek,
493
#if 0
494
    .read_seek2 = flv_read_seek2,
495
#endif
459 496
    .extensions = "flv",
460 497
    .value = CODEC_ID_FLV1,
461 498
};
libavformat/librtmp.c
144 144
        return AVERROR(ENOSYS);
145 145

  
146 146
    /* seeks are in milliseconds */
147
    timestamp = av_rescale(timestamp, AV_TIME_BASE, 1000);
147
    if (stream_index < 0)
148
        timestamp = av_rescale_rnd(timestamp, 1000, AV_TIME_BASE,
149
            flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP);
150

  
148 151
    if (!RTMP_SendSeek(r, timestamp))
149 152
        return -1;
150 153
    return timestamp;

Also available in: Unified diff