Mercurial > libavformat.hg
comparison utils.c @ 4708:87fbbc835a17 libavformat
add avformat_seek_file()
| author | michael |
|---|---|
| date | Sat, 14 Mar 2009 15:51:46 +0000 |
| parents | 755858ca9f6a |
| children | 2f7b32083fb0 |
comparison
equal
deleted
inserted
replaced
| 4707:f153437e1ac0 | 4708:87fbbc835a17 |
|---|---|
| 1582 return av_seek_frame_binary(s, stream_index, timestamp, flags); | 1582 return av_seek_frame_binary(s, stream_index, timestamp, flags); |
| 1583 else | 1583 else |
| 1584 return av_seek_frame_generic(s, stream_index, timestamp, flags); | 1584 return av_seek_frame_generic(s, stream_index, timestamp, flags); |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) | |
| 1588 { | |
| 1589 if(min_ts > ts || max_ts < ts) | |
| 1590 return -1; | |
| 1591 | |
| 1592 av_read_frame_flush(s); | |
| 1593 | |
| 1594 if (s->iformat->read_seek2) | |
| 1595 return s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags); | |
| 1596 | |
| 1597 if(s->iformat->read_timestamp){ | |
| 1598 //try to seek via read_timestamp() | |
| 1599 } | |
| 1600 | |
| 1601 //Fallback to old API if new is not implemented but old is | |
| 1602 //Note the old has somewat different sematics | |
| 1603 if(s->iformat->read_seek || 1) | |
| 1604 return av_seek_frame(s, stream_index, ts, ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0); | |
| 1605 | |
| 1606 // try some generic seek like av_seek_frame_generic() but with new ts semantics | |
| 1607 } | |
| 1608 | |
| 1587 /*******************************************************/ | 1609 /*******************************************************/ |
| 1588 | 1610 |
| 1589 /** | 1611 /** |
| 1590 * Returns TRUE if the stream has accurate duration in any stream. | 1612 * Returns TRUE if the stream has accurate duration in any stream. |
| 1591 * | 1613 * |
