channel_mask = AV_RL32(edata_ptr + 2);
s->bits_per_sample = AV_RL16(edata_ptr);
if (s->bits_per_sample == 16)
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
else if (s->bits_per_sample == 24) {
- avctx->sample_fmt = AV_SAMPLE_FMT_S32;
- av_log_missing_feature(avctx, "bit-depth higher than 16", 0);
+ avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
+ avpriv_report_missing_feature(avctx, "Bit-depth higher than 16");
return AVERROR_PATCHWELCOME;
} else {
av_log(avctx, AV_LOG_ERROR, "Unknown bit-depth: %d\n",
av_dlog(avctx, "\n");
} else {
- av_log_ask_for_sample(avctx, "Unsupported extradata size\n");
- return AVERROR_INVALIDDATA;
+ avpriv_request_sample(avctx, "Unsupported extradata size");
+ return AVERROR_PATCHWELCOME;
}
/* generic init */
s->num_channels);
return AVERROR_INVALIDDATA;
} else if (s->num_channels > WMALL_MAX_CHANNELS) {
- av_log_ask_for_sample(avctx, "unsupported number of channels\n");
+ avpriv_request_sample(avctx,
+ "More than %d channels", WMALL_MAX_CHANNELS);
return AVERROR_PATCHWELCOME;
}
residue = quo;
else {
rem_bits = av_ceil_log2(ave_mean);
- rem = rem_bits ? get_bits(&s->gb, rem_bits) : 0;
+ rem = rem_bits ? get_bits_long(&s->gb, rem_bits) : 0;
residue = (quo << rem_bits) + rem;
}
s->do_arith_coding = get_bits1(&s->gb);
if (s->do_arith_coding) {
- av_log_missing_feature(s->avctx, "arithmetic coding", 1);
+ avpriv_request_sample(s->avctx, "Arithmetic coding");
return AVERROR_PATCHWELCOME;
}
s->do_ac_filter = get_bits1(&s->gb);
s->do_lpc = get_bits1(&s->gb);
if (s->do_lpc) {
decode_lpc(s);
- av_log_ask_for_sample(s->avctx, "Inverse LPC filter not "
- "implemented. Expect wrong output.\n");
+ avpriv_request_sample(s->avctx, "Expect wrong output since "
+ "inverse LPC filter");
}
} else
s->do_lpc = 0;
for (j = 0; j < subframe_len; j++) {
if (s->bits_per_sample == 16) {
- *s->samples_16[c] = (int16_t) s->channel_residues[c][j] << padding_zeroes;
- s->samples_16[c] += s->num_channels;
+ *s->samples_16[c]++ = (int16_t) s->channel_residues[c][j] << padding_zeroes;
} else {
- *s->samples_32[c] = s->channel_residues[c][j] << padding_zeroes;
- s->samples_32[c] += s->num_channels;
+ *s->samples_32[c]++ = s->channel_residues[c][j] << padding_zeroes;
}
}
}
int more_frames = 0, len = 0, i, ret;
s->frame.nb_samples = s->samples_per_frame;
- if ((ret = s->avctx->get_buffer(s->avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(s->avctx, &s->frame, 0)) < 0) {
/* return an error if no frame could be decoded at all */
av_log(s->avctx, AV_LOG_ERROR,
"not enough space for the output samples\n");
return ret;
}
for (i = 0; i < s->num_channels; i++) {
- s->samples_16[i] = (int16_t *)s->frame.data[0] + i;
- s->samples_32[i] = (int32_t *)s->frame.data[0] + i;
+ s->samples_16[i] = (int16_t *)s->frame.extended_data[i];
+ s->samples_32[i] = (int32_t *)s->frame.extended_data[i];
}
/* get frame length */
buflen = (s->num_saved_bits + len + 8) >> 3;
if (len <= 0 || buflen > MAX_FRAMESIZE) {
- av_log_ask_for_sample(s->avctx, "input buffer too small\n");
+ avpriv_request_sample(s->avctx, "Too small input buffer");
s->packet_loss = 1;
return;
}
skip_bits(gb, 1); // Skip seekable_frame_in_packet, currently ununused
spliced_packet = get_bits1(gb);
if (spliced_packet)
- av_log_missing_feature(avctx, "Bitstream splicing", 1);
+ avpriv_request_sample(avctx, "Bitstream splicing");
/* get number of bits that need to be added to the previous frame */
num_bits_prev_frame = get_bits(gb, s->log2_frame_size);
* to decode incomplete frames in the s->len_prefix == 0 case. */
s->num_saved_bits = 0;
s->packet_loss = 0;
+ init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
}
} else {
s->next_packet_start = 0;
s->cdlms[0][0].order = 0;
s->frame.nb_samples = 0;
+ init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
}
AVCodec ff_wmalossless_decoder = {
.flush = flush,
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S32P,
+ AV_SAMPLE_FMT_NONE },
};