[vlc-devel] [PATCH] Support DVD LPCM encode

Rémi Duraffort ivoire at videolan.org
Sat Oct 2 08:15:42 CEST 2010


Hello,

> +static int OpenEncoder( vlc_object_t *p_this )
> +{
> [...]
> +    /* Allocate the memory needed to store the encoder's structure */
> +    if( ( p_enc->p_sys = p_sys =
> +          (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
> +        return VLC_ENOMEM;
> +
> +    /* In DVD LCPM, a frame is always 150 PTS ticks. */
> +    p_sys->i_frame_samples = p_enc->fmt_in.audio.i_rate * 150 / 90000;
> +    p_sys->p_buffer = (uint8_t *)malloc(
> +        p_sys->i_frame_samples *
> +        p_enc->fmt_in.audio.i_channels *
> +        p_enc->fmt_in.audio.i_bitspersample);
> [...]
> +}
> +
> +/*****************************************************************************
> + * CloseEncoder: lpcm encoder destruction
> + *****************************************************************************/
> +static void CloseEncoder ( vlc_object_t *p_this )
> +{
You must at least free p_sys and p_sys->p_buffer too I guess.


Best regarsd.

-- 
Rémi Duraffort | ivoire
http://ivoire.dinauz.org/blog/



More information about the vlc-devel mailing list