Revision 0e09997f libavcodec/ac3dec.c

View differences:

libavcodec/ac3dec.c
188 188
    ff_fmt_convert_init(&s->fmt_conv, avctx);
189 189
    av_lfg_init(&s->dith_state, 0);
190 190

  
191
    /* ffdshow custom code */
192
#if CONFIG_AUDIO_FLOAT
193
    s->mul_bias = 1.0f;
194
#else
191 195
    /* set scale value for float to int16 conversion */
192 196
    s->mul_bias = 32767.0f;
197
#endif
193 198

  
194 199
    /* allow downmixing to stereo or mono */
195 200
    if (avctx->channels > 0 && avctx->request_channels > 0 &&
......
204 209
        if (!s->input_buffer)
205 210
            return AVERROR(ENOMEM);
206 211

  
212
    /* ffdshow custom code */
213
#if CONFIG_AUDIO_FLOAT
214
    avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
215
#else
207 216
    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
217
#endif
208 218
    return 0;
209 219
}
210 220

  
......
1299 1309
    const uint8_t *buf = avpkt->data;
1300 1310
    int buf_size = avpkt->size;
1301 1311
    AC3DecodeContext *s = avctx->priv_data;
1312
    /* ffdshow custom code */
1313
#if CONFIG_AUDIO_FLOAT
1314
    float *out_samples = (float *)data;
1315
#else
1302 1316
    int16_t *out_samples = (int16_t *)data;
1317
#endif
1303 1318
    int blk, ch, err;
1304 1319
    const uint8_t *channel_map;
1305 1320
    const float *output[AC3_MAX_CHANNELS];
......
1405 1420
            av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
1406 1421
            err = 1;
1407 1422
        }
1423
        /* ffdshow custom code */
1424
#if CONFIG_AUDIO_FLOAT
1425
        float_interleave_noscale(out_samples, output, 256, s->out_channels);
1426
#else
1408 1427
        s->fmt_conv.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
1428
#endif
1409 1429
        out_samples += 256 * s->out_channels;
1410 1430
    }
1411
    *data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t);
1431
    *data_size = s->num_blocks * 256 * avctx->channels * sizeof (out_samples[0]); /* ffdshow custom code */
1412 1432
    return FFMIN(buf_size, s->frame_size);
1413 1433
}
1414 1434

  

Also available in: Unified diff