diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-22 16:53:20 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-22 16:53:26 +0200 |
commit | fce350be0e7595846a6ce1a28bf240967283643e (patch) | |
tree | 329ae2ea9064efd9a8c8ad3428e4f41ec563fb3e /libavformat | |
parent | fbdbe7a5d262db06ae44a7bd606d18954241c040 (diff) | |
parent | 5655236a67203d923755f285584c6e68abe7e33f (diff) | |
download | ffmpeg-fce350be0e7595846a6ce1a28bf240967283643e.tar.gz |
Merge commit '5655236a67203d923755f285584c6e68abe7e33f'
* commit '5655236a67203d923755f285584c6e68abe7e33f':
asfdec: factor out seeking to the Data Object outside while
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/asfdec_o.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c index fe6b9ebb51..a8eb89f77a 100644 --- a/libavformat/asfdec_o.c +++ b/libavformat/asfdec_o.c @@ -1652,17 +1652,13 @@ static int asf_read_header(AVFormatContext *s) */ while (1) { // for the cases when object size is invalid - if (avio_tell(pb) == asf->offset) { - if (asf->data_reached) - avio_seek(pb, asf->first_packet_offset, SEEK_SET); + if (avio_tell(pb) == asf->offset) break; - } asf->offset = avio_tell(pb); if ((ret = ff_get_guid(pb, &guid)) < 0) { - if (ret == AVERROR_EOF && asf->data_reached) { - avio_seek(pb, asf->first_packet_offset, SEEK_SET); + if (ret == AVERROR_EOF && asf->data_reached) break; - } else + else return ret; } g = find_guid(guid); @@ -1679,6 +1675,13 @@ static int asf_read_header(AVFormatContext *s) break; } + if (!asf->data_reached) { + av_log(s, AV_LOG_ERROR, "Data Object was not found.\n"); + return AVERROR_INVALIDDATA; + } + if (pb->seekable) + avio_seek(pb, asf->first_packet_offset, SEEK_SET); + for (i = 0; i < asf->nb_streams; i++) { const char *rfc1766 = asf->asf_sd[asf->asf_st[i]->lang_idx].langs; AVStream *st = s->streams[asf->asf_st[i]->index]; |