diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-03-21 13:43:19 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-03-21 13:43:19 +0000 |
commit | 433aeb62402ad307d3b43d8cb33cb199ace68772 (patch) | |
tree | ee4656d5bf1bbe22e239781ddf11f1919938cc24 | |
parent | 61aedb0f566d71a193abcb175ec9785ffb8b5736 (diff) | |
download | ffmpeg-433aeb62402ad307d3b43d8cb33cb199ace68772.tar.gz |
support fragments when non streamable
Originally committed as revision 12542 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/mov.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index d34de5c7ba..7c549ed0f3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1727,7 +1727,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) AVIndexEntry *sample = 0; int64_t best_dts = INT64_MAX; int i; - + retry: for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MOVStreamContext *msc = st->priv_data; @@ -1747,8 +1747,15 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) } } } - if (!sample) - return -1; + if (!sample) { + mov->found_mdat = 0; + if (!url_is_streamed(s->pb) || + mov_read_default(mov, s->pb, (MOV_atom_t){ 0, 0, INT64_MAX }) < 0 || + url_feof(s->pb)) + return -1; + dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb)); + goto retry; + } /* must be done just before reading, to avoid infinite loop on sample */ sc->current_sample++; if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { |