[vlc-devel] Re: [Patch]

Jean-Paul Saman jean-paul.saman at planet.nl
Tue Feb 27 22:57:23 CET 2007


xxcv wrote:
> .
> ------------------------------------------------------------------------
> 
> --- /home/slack/VLC_SVN/modules/stream_out/transcode.c	2006-12-31 14:51:31.000000000 +1100
> +++ modules/stream_out/transcode.c	2007-02-21 16:29:22.000000000 +1100
> @@ -1306,7 +1306,11 @@
>          audio_BitsPerSample( id->p_decoder->fmt_out.i_codec );
>      fmt_last = id->p_decoder->fmt_out;
>      /* FIX decoders so we don't have to do this */
> -    fmt_last.audio.i_rate = id->p_decoder->fmt_in.audio.i_rate;
> +    /* Fix AAC SBR changing number of channels and sampling rate */
> +    if( !(id->p_decoder->fmt_in.i_codec == VLC_FOURCC('m','p','4','a') &&
> +        fmt_last.audio.i_rate != id->p_encoder->fmt_in.audio.i_rate &&
> +        fmt_last.audio.i_channels != id->p_encoder->fmt_in.audio.i_channels) )
> +        fmt_last.audio.i_rate = id->p_decoder->fmt_in.audio.i_rate;
>  
>      /*
>       * Open encoder
> @@ -1345,6 +1349,15 @@
>      id->p_encoder->fmt_in.audio.i_bitspersample =
>          audio_BitsPerSample( id->p_encoder->fmt_in.i_codec );
>  
> +    /* Fix AAC SBR changing number of channels and sampling rate */
> +    if( id->p_decoder->fmt_in.i_codec == VLC_FOURCC('m','p','4','a') &&
> +        fmt_last.audio.i_rate != id->p_encoder->fmt_in.audio.i_rate &&
> +        fmt_last.audio.i_channels != id->p_encoder->fmt_in.audio.i_channels )
> +    {
> +      id->p_encoder->fmt_in.audio.i_rate = fmt_last.audio.i_rate;
> +      id->p_encoder->fmt_out.audio.i_rate = fmt_last.audio.i_rate;
> +    }
> +
>      /* Load conversion filters */
>      if( fmt_last.audio.i_channels != id->p_encoder->fmt_in.audio.i_channels ||
>          fmt_last.audio.i_rate != id->p_encoder->fmt_in.audio.i_rate )
> 
This looks sane to me and I'll check it in this week when I have some time.

> ------------------------------------------------------------------------
> 
> --- /home/slack/VLC_SVN/modules/codec/ffmpeg/encoder.c	2007-02-13 01:29:33.000000000 +1100
> +++ modules/codec/ffmpeg/encoder.c	2007-02-21 17:54:10.000000000 +1100
> @@ -231,7 +231,11 @@
>      /* Initialization must be done before avcodec_find_encoder() */
>      E_(InitLibavcodec)(p_this);
>  
> -    p_codec = avcodec_find_encoder( i_codec_id );
> +    /* Disable libavcodec flac encoder it doesn't work with vlc */
> +    if( i_codec_id == 86031 )
> +        p_codec = NULL;
> +    else
> +        p_codec = avcodec_find_encoder( i_codec_id );
>      if( !p_codec )
>      {
>          msg_Err( p_enc, "cannot find encoder %s", psz_namecodec );

Does this segfault if we don't do this? I am not sure and reluctant to 
submit this to trunk. It looks like a kludge and should probably be 
solved in another file where the FOURCC's of ffmpeg are written down and 
not here. Check modules/codec/ffmpeg/ffmpeg.c for this.

Gtz,
Jean-Paul Saman.

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list