- // Deficit sample count
- if (get_bits(&s->gb, 5) != DCA_PCMBLOCK_SAMPLES - 1) {
- av_log(s->avctx, AV_LOG_ERROR, "Deficit samples are not supported\n");
- return normal_frame ? AVERROR_INVALIDDATA : AVERROR_PATCHWELCOME;
- }
-
- // CRC present flag
- s->crc_present = get_bits1(&s->gb);
-
- // Number of PCM sample blocks
- s->npcmblocks = get_bits(&s->gb, 7) + 1;
- if (s->npcmblocks & (DCA_SUBBAND_SAMPLES - 1)) {
- av_log(s->avctx, AV_LOG_ERROR, "Unsupported number of PCM sample blocks (%d)\n", s->npcmblocks);
- return (s->npcmblocks < 6 || normal_frame) ? AVERROR_INVALIDDATA : AVERROR_PATCHWELCOME;
- }
-
- // Primary frame byte size
- s->frame_size = get_bits(&s->gb, 14) + 1;
- if (s->frame_size < 96) {
- av_log(s->avctx, AV_LOG_ERROR, "Invalid core frame size (%d bytes)\n", s->frame_size);
- return AVERROR_INVALIDDATA;
- }
-
- // Audio channel arrangement
- s->audio_mode = get_bits(&s->gb, 6);
- if (s->audio_mode >= DCA_AMODE_COUNT) {
- av_log(s->avctx, AV_LOG_ERROR, "Unsupported audio channel arrangement (%d)\n", s->audio_mode);
- return AVERROR_PATCHWELCOME;
- }
-
- // Core audio sampling frequency
- s->sample_rate = avpriv_dca_sample_rates[get_bits(&s->gb, 4)];
- if (!s->sample_rate) {
- av_log(s->avctx, AV_LOG_ERROR, "Invalid core audio sampling frequency\n");
- return AVERROR_INVALIDDATA;
- }
-
- // Transmission bit rate
- s->bit_rate = ff_dca_bit_rates[get_bits(&s->gb, 5)];
-
- // Reserved field
- skip_bits1(&s->gb);
-
- // Embedded dynamic range flag
- s->drc_present = get_bits1(&s->gb);
-
- // Embedded time stamp flag
- s->ts_present = get_bits1(&s->gb);
-
- // Auxiliary data flag
- s->aux_present = get_bits1(&s->gb);
-
- // HDCD mastering flag
- skip_bits1(&s->gb);