/*
* LPCM codecs for PCM formats found in Video DVD streams
- * Copyright (c) 2009-2013 Christian Schmidt
+ * Copyright (c) 2013 Christian Schmidt
*
* This file is part of Libav.
*
/* reserve space for 8 channels, 3 bytes/sample, 4 samples/block */
if (!(s->extra_samples = av_malloc(8 * 3 * 4)))
return AVERROR(ENOMEM);
- s->extra_sample_count = 0;
return 0;
}
{
PCMDVDContext *s = avctx->priv_data;
- if (s->extra_samples)
- av_free(s->extra_samples);
+ av_freep(&s->extra_samples);
return 0;
}
* header[2] dynamic range control (0x80 = off)
*/
+ /* Discard potentially existing leftover samples from old channel layout */
+ s->extra_sample_count = 0;
+
/* get the sample depth and derive the sample format from it */
avctx->bits_per_coded_sample = 16 + (header[1] >> 6 & 3) * 4;
if (avctx->bits_per_coded_sample == 28) {