[FFmpeg-devel] [PATCH 11/12] ffplay: remove variable-length array

Michael Niedermayer michaelni
Sun Jun 27 02:29:11 CEST 2010


On Wed, Jun 23, 2010 at 06:26:49PM +0100, Mans Rullgard wrote:
> ---
>  ffplay.c |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/ffplay.c b/ffplay.c
> index 129cd28..2532a74 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -168,6 +168,7 @@ typedef struct VideoState {
>      int last_i_start;
>      RDFTContext *rdft;
>      int rdft_bits;
> +    FFTSample *rdft_data;
>      int xpos;
>  
>      SDL_Thread *subtitle_tid;

> @@ -917,27 +918,31 @@ static void video_audio_display(VideoState *s)
>          nb_display_channels= FFMIN(nb_display_channels, 2);
>          if(rdft_bits != s->rdft_bits){
>              av_rdft_end(s->rdft);
> +            av_freep(&s->rdft_data);
>              s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
>              s->rdft_bits= rdft_bits;
> +            s->rdft_data= av_malloc(4*nb_freq*sizeof(*s->rdft_data));

freep is overkill if we immedeatly set it again


>          }
>          {
> -            FFTSample data[2][2*nb_freq];
> +            FFTSample *data0 = s->rdft_data;
> +            FFTSample *data1 = s->rdft_data + 2*nb_freq;

this change is a step away from >2 channel support
please keep it an array of some kind

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100627/c1dfc495/attachment.pgp>



More information about the ffmpeg-devel mailing list