Merge commit '0c082565965258dca143767cc6cb25e38b6e9ea3'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 12 Feb 2014 15:16:16 +0000 (16:16 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 12 Feb 2014 15:16:16 +0000 (16:16 +0100)
* commit '0c082565965258dca143767cc6cb25e38b6e9ea3':
  asfdec: short-circuit seeking to the start of stream

Conflicts:
libavformat/asfdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/asfdec.c

@@@ -1538,17 -1465,21 +1538,24 @@@ static int asf_read_seek(AVFormatContex
              return ret;
      }
  
 -    if (!asf->index_read)
+     /* explicitly handle the case of seeking to 0 */
+     if (!pts) {
+         asf_reset_header(s);
+         avio_seek(s->pb, s->data_offset, SEEK_SET);
+         return 0;
+     }
 +    if (!asf->index_read) {
          ret = asf_build_simple_index(s, stream_index);
 +        if (ret < 0)
 +            asf->index_read = -1;
 +    }
  
 -    if (!ret && asf->index_read && st->index_entries) {
 -        index = av_index_search_timestamp(st, pts, flags);
 +    if (asf->index_read > 0 && st->index_entries) {
 +        int index = av_index_search_timestamp(st, pts, flags);
          if (index >= 0) {
              /* find the position */
 -            pos = st->index_entries[index].pos;
 +            uint64_t pos = st->index_entries[index].pos;
  
              /* do the seek */
              av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);