else
max_frame_size = s->max_coded_frame_size;
- if ((ret = ff_alloc_packet(avpkt, 2 * max_frame_size))) {
- av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size)))
return ret;
- }
/* use verbatim mode for compression_level 0 */
- s->verbatim = !s->compression_level;
+ if (s->compression_level) {
+ s->verbatim = 0;
+ s->extra_bits = avctx->bits_per_raw_sample - 16;
+ } else {
+ s->verbatim = 1;
+ s->extra_bits = 0;
+ }
+ s->write_sample_size = avctx->bits_per_raw_sample - s->extra_bits +
+ avctx->channels - 1;
- out_bytes = write_frame(s, avpkt, samples);
+ out_bytes = write_frame(s, avpkt, frame->extended_data);
if (out_bytes > max_frame_size) {
/* frame too large. use verbatim mode */
samples += 2;
}
break;
+ case AV_CODEC_ID_PCM_S16BE_PLANAR:
+ DECODE_PLANAR(16, be16, src, samples, n, 0, 0);
+ break;
case AV_CODEC_ID_PCM_S16LE_PLANAR:
- DECODE_PLANAR(16, le16, src, samples, n, 0, 0);
- {
+ n /= avctx->channels;
+ for (c = 0; c < avctx->channels; c++) {
+ samples = s->frame.extended_data[c];
+ #if HAVE_BIGENDIAN
+ DECODE(16, le16, src, samples, n, 0, 0)
+ #else
+ memcpy(samples, src, n * 2);
+ #endif
+ src += n * 2;
+ }
break;
- }
+ case AV_CODEC_ID_PCM_S24LE_PLANAR:
+ DECODE_PLANAR(32, le24, src, samples, n, 8, 0);
+ break;
+ case AV_CODEC_ID_PCM_S32LE_PLANAR:
+ DECODE_PLANAR(32, le32, src, samples, n, 0, 0);
+ break;
case AV_CODEC_ID_PCM_U16LE:
DECODE(16, le16, src, samples, n, 0, 0x8000)
break;