- int i, j, k, l;
- int is_mace3 = (avctx->codec_id == CODEC_ID_MACE3);
-
- if (*data_size < (3 * buf_size << (2-is_mace3))) {
- av_log(avctx, AV_LOG_ERROR, "Output buffer too small!\n");
- return -1;
+ int i, j, k, l, ret;
+ int is_mace3 = (avctx->codec_id == AV_CODEC_ID_MACE3);
+
+ /* get output buffer */
+ frame->nb_samples = 3 * (buf_size << (1 - is_mace3)) / avctx->channels;
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;