case MKTAG('w', 'a', 'v', 'e'):
if ((uint64_t)size > (1<<30))
return -1;
- st->codecpar->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
- if (!st->codecpar->extradata)
+ if (ff_get_extradata(s, st->codecpar, pb, size) < 0)
return AVERROR(ENOMEM);
- st->codecpar->extradata_size = size;
- avio_read(pb, st->codecpar->extradata, size);
+ if ( (st->codecpar->codec_id == AV_CODEC_ID_QDMC || st->codecpar->codec_id == AV_CODEC_ID_QDM2)
+ && size>=12*4 && !st->codecpar->block_align) {
+ st->codecpar->block_align = AV_RB32(st->codecpar->extradata+11*4);
+ aiff->block_duration = AV_RB32(st->codecpar->extradata+9*4);
+ } else if (st->codecpar->codec_id == AV_CODEC_ID_QCELP) {
+ char rate = 0;
+ if (size >= 25)
+ rate = st->codecpar->extradata[24];
+ switch (rate) {
+ case 'H': // RATE_HALF
+ st->codecpar->block_align = 17;
+ break;
+ case 'F': // RATE_FULL
+ default:
+ st->codecpar->block_align = 35;
+ }
+ aiff->block_duration = 160;
+ st->codecpar->bit_rate = (int64_t)st->codecpar->sample_rate * (st->codecpar->block_align << 3) /
+ aiff->block_duration;
+ }
break;
+ case MKTAG('C','H','A','N'):
+ if(ff_mov_read_chan(s, pb, st, size) < 0)
+ return AVERROR_INVALIDDATA;
+ break;
+ case 0:
+ if (offset > 0 && st->codecpar->block_align) // COMM && SSND
+ goto got_sound;
default: /* Jump */
- if (size & 1) /* Always even aligned */
- size++;
avio_skip(pb, size);
}
+
+ /* Skip required padding byte for odd-sized chunks. */
+ if (size & 1) {
+ filesize--;
+ avio_skip(pb, 1);
+ }
}
got_sound: