- if (!avctx->extradata_size) {
- int ret;
-
- ff_combine_frame(pc, END_NOT_FOUND, &buf, &buf_size);
-
- if (!s->header_size && pc->index >= MIN_HEADER_SIZE) {
- if (ret = avpriv_adx_decode_header(avctx, pc->buffer, pc->index,
- &s->header_size, NULL))
- return AVERROR_INVALIDDATA;
- s->block_size = BLOCK_SIZE * avctx->channels;
+ if (!s->header_size) {
+ for (i = 0; i < buf_size; i++) {
+ state = (state << 8) | buf[i];
+ /* check for fixed fields in ADX header for possible match */
+ if ((state & 0xFFFF0000FFFFFF00) == 0x8000000003120400ULL) {
+ int channels = state & 0xFF;
+ int header_size = ((state >> 32) & 0xFFFF) + 4;
+ if (channels > 0 && header_size >= 8) {
+ s->header_size = header_size;
+ s->block_size = BLOCK_SIZE * channels;
+ s->remaining = i - 7 + s->header_size + s->block_size;
+ break;
+ }
+ }