Commit 171966e2 authored by Gildas Bazin's avatar Gildas Bazin

* modules/audio_filter/converter/s16tofloat32swab.c:
   added an #ifdef HAVE_ALLOCA.
parent 58d2e718
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* with endianness change * with endianness change
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: s16tofloat32swab.c,v 1.8 2002/11/20 16:43:32 sam Exp $ * $Id: s16tofloat32swab.c,v 1.9 2003/04/22 22:25:09 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org> * Henri Fallon <henri@videolan.org>
...@@ -101,9 +101,15 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -101,9 +101,15 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float * p_out = (float *)p_out_buf->p_buffer + i - 1; float * p_out = (float *)p_out_buf->p_buffer + i - 1;
#ifdef HAVE_SWAB #ifdef HAVE_SWAB
# ifdef HAVE_ALLOCA
s16 * p_swabbed = alloca( i * sizeof(s16) ); s16 * p_swabbed = alloca( i * sizeof(s16) );
# else
s16 * p_swabbed = malloc( i * sizeof(s16) );
# endif
swab( p_in_buf->p_buffer, (void *)p_swabbed, i * sizeof(s16) ); swab( p_in_buf->p_buffer, (void *)p_swabbed, i * sizeof(s16) );
p_in = p_swabbed + i - 1; p_in = p_swabbed + i - 1;
#else #else
byte_t p_tmp[2]; byte_t p_tmp[2];
p_in = (s16 *)p_in_buf->p_buffer + i - 1; p_in = (s16 *)p_in_buf->p_buffer + i - 1;
...@@ -121,6 +127,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -121,6 +127,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_in--; p_out--; p_in--; p_out--;
} }
#ifdef HAVE_SWAB
# ifndef HAVE_ALLOCA
free( p_swabbed );
# endif
#endif
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2; p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment