Mercurial > libavcodec.hg
changeset 1877:869256817a91 libavcodec
smarten up the SVQ3 extradata decoder without changing the external API
author | melanson |
---|---|
date | Sat, 13 Mar 2004 20:07:38 +0000 |
parents | 72ac356803ea |
children | 838c18d1e7fc |
files | svq3.c |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/svq3.c Sat Mar 13 19:21:58 2004 +0000 +++ b/svq3.c Sat Mar 13 20:07:38 2004 +0000 @@ -766,6 +766,7 @@ MpegEncContext *const s = avctx->priv_data; H264Context *const h = avctx->priv_data; int m, mb_type; + unsigned char *extradata; *data_size = 0; @@ -790,13 +791,20 @@ alloc_tables (h); - if (avctx->extradata && avctx->extradata_size >= 0x64 - && !memcmp (avctx->extradata, "SVQ3", 4)) { + /* prowl for the "SEQH" marker in the extradata */ + extradata = (unsigned char *)avctx->extradata; + for (m = 0; m < avctx->extradata_size; m++) { + if (!memcmp (extradata, "SEQH", 4)) + break; + extradata++; + } + + /* if a match was found, parse the extra data */ + if (!memcmp (extradata, "SEQH", 4)) { GetBitContext gb; - init_get_bits (&gb, (uint8_t *) avctx->extradata + 0x62, - 8*(avctx->extradata_size - 0x62)); + init_get_bits (&gb, extradata + 0x8, 8*8); /* 'frame size code' and optional 'width, height' */ if (get_bits (&gb, 3) == 7) {