Mercurial > libavformat.hg
changeset 758:7bbe565d50db libavformat
check theora version
author | mru |
---|---|
date | Thu, 12 May 2005 22:33:05 +0000 |
parents | 7177bd7f1f47 |
children | 6418c3b8d8ec |
files | oggparsetheora.c |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/oggparsetheora.c Thu May 12 16:27:05 2005 +0000 +++ b/oggparsetheora.c Thu May 12 22:33:05 2005 +0000 @@ -43,7 +43,7 @@ int cds = st->codec.extradata_size + os->psize + 2; uint8_t *cdp; - if (os->seq > 2) + if(!(os->buf[os->pstart] & 0x80)) return 0; if(!thp){ @@ -56,8 +56,12 @@ init_get_bits(&gb, os->buf + os->pstart, os->psize*8); skip_bits(&gb, 7*8); /* 0x80"theora" */ - skip_bits(&gb, 3*8); - + if(get_bits(&gb, 8) != 3) /* major version */ + return -1; + if(get_bits(&gb, 8) != 2) /* minor version */ + return -1; + skip_bits(&gb, 8); /* revision */ + st->codec.width = get_bits(&gb, 16) << 4; st->codec.height = get_bits(&gb, 16) << 4; @@ -86,8 +90,7 @@ memcpy (cdp, os->buf + os->pstart, os->psize); st->codec.extradata_size = cds; - - return os->seq < 3; + return 1; } static uint64_t