summaryrefslogtreecommitdiffstats
path: root/libavformat/asfdec_f.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-07-22 13:49:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-22 14:11:48 +0200
commit9837d3b06844f6cb24e36bdbcce55c03f8241eb4 (patch)
treef2c452785decfc39febbb89fc8a5e2cec48699bb /libavformat/asfdec_f.c
parent3e35f8efa18d9b77bbdb16d9c61e387241a7bd83 (diff)
downloadffmpeg-streaming-9837d3b06844f6cb24e36bdbcce55c03f8241eb4.zip
ffmpeg-streaming-9837d3b06844f6cb24e36bdbcce55c03f8241eb4.tar.gz
avformat/asfdec_f: Parse ECC byte according to spec
This should not change anything as the spec requires specific values for the fields, which where handled previously. Ask for samples when these values do not match Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/asfdec_f.c')
-rw-r--r--libavformat/asfdec_f.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index 95d561d..9c79164 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -958,13 +958,13 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
int rsize = 8;
int c, d, e, off;
- if (asf->uses_std_ecc >= 0) {
+ if (asf->uses_std_ecc > 0) {
// if we do not know packet size, allow skipping up to 32 kB
off = 32768;
if (asf->no_resync_search)
off = 3;
- else if (s->packet_size > 0 && !asf->uses_std_ecc)
- off = (avio_tell(pb) - s->internal->data_offset) % s->packet_size + 3;
+// else if (s->packet_size > 0 && !asf->uses_std_ecc)
+// off = (avio_tell(pb) - s->internal->data_offset) % s->packet_size + 3;
c = d = e = -1;
while (off-- > 0) {
@@ -975,10 +975,6 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
break;
}
- if (!asf->uses_std_ecc) {
- asf->uses_std_ecc = (c == 0x82 && !d && !e) ? 1 : -1;
- }
-
if (c != 0x82) {
/* This code allows handling of -EAGAIN at packet boundaries (i.e.
* if the packet sync code above triggers -EAGAIN). This does not
@@ -1004,6 +1000,24 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
}
} else {
c = avio_r8(pb);
+ if (c & 0x80) {
+ rsize ++;
+ if (!(c & 0x60)) {
+ d = avio_r8(pb);
+ e = avio_r8(pb);
+ avio_seek(pb, (c & 0xF) - 2, SEEK_CUR);
+ rsize += c & 0xF;
+ }
+
+ if (c != 0x82)
+ avpriv_request_sample(s, "Invalid ECC byte\n");
+
+ if (!asf->uses_std_ecc)
+ asf->uses_std_ecc = (c == 0x82 && !d && !e) ? 1 : -1;
+
+ c = avio_r8(pb);
+ } else
+ asf->uses_std_ecc = -1;
d = avio_r8(pb);
}
OpenPOWER on IntegriCloud