DSPContext dsp;
} DCAContext;
-static void dca_init_vlcs(void)
+static av_cold void dca_init_vlcs(void)
{
static int vlcs_initialized = 0;
int i, j;
s->output = DCA_STEREO;
}
- avctx->channels = channels;
+ /* There is nothing that prevents a dts frame to change channel configuration
+ but FFmpeg doesn't support that so only set the channels if it is previously
+ unset. Ideally during the first probe for channels the crc should be checked
+ and only set avctx->channels when the crc is ok. Right now the decoder could
+ set the channels based on a broken first frame.*/
+ if (!avctx->channels)
+ avctx->channels = channels;
+
if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
return -1;
*data_size = 0;
* @param s pointer to the DCAContext
*/
-static void pre_calc_cosmod(DCAContext * s)
+static av_cold void pre_calc_cosmod(DCAContext * s)
{
int i, j, k;
static int cosmod_initialized = 0;
* @param avctx pointer to the AVCodecContext
*/
-static int dca_decode_init(AVCodecContext * avctx)
+static av_cold int dca_decode_init(AVCodecContext * avctx)
{
DCAContext *s = avctx->priv_data;
avctx->channels = avctx->request_channels;
}
+ avctx->sample_fmt = SAMPLE_FMT_S16;
return 0;
}
.priv_data_size = sizeof(DCAContext),
.init = dca_decode_init,
.decode = dca_decode_frame,
+ .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
};