[MPlayer-dev-eng] [PATCH 3/9] ad_libmad: Use BE sample format on big endian architectures

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Feb 16 17:39:15 CET 2009


On Mon, Feb 16, 2009 at 05:16:52PM +0100, Hans-Christian Egtvedt wrote:
> Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt at atmel.com>
> ---
>  libmpcodecs/ad_libmad.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/libmpcodecs/ad_libmad.c b/libmpcodecs/ad_libmad.c
> index 076359a..51b77fe 100644
> --- a/libmpcodecs/ad_libmad.c
> +++ b/libmpcodecs/ad_libmad.c
> @@ -86,6 +86,11 @@ static int init(sh_audio_t *sh){
>    sh->channels=(this->frame.header.mode == MAD_MODE_SINGLE_CHANNEL) ? 1 : 2;
>    sh->samplerate=this->frame.header.samplerate;
>    sh->i_bps=this->frame.header.bitrate/8;
> +#ifdef WORDS_BIGENDIAN
> +  sh->sample_format = AF_FORMAT_S16_BE;
> +#else
> +  sh->sample_format = AF_FORMAT_S16_LE;
> +#endif
>    sh->samplesize=2;

Weird, why has that worked so far (I am not aware of any complaints)?
Also, for avoiding such ugly ifdefs is what AF_FORMAT_S16_NE is there
for.



More information about the MPlayer-dev-eng mailing list