changeset 33689:8d0290220239

Replace numeric constants for gtkEquChannels array size. Use macro FF_ARRAY_ELEMS() instead.
author ib
date Wed, 29 Jun 2011 11:35:58 +0000
parents acb61c6d14cd
children 76342ee379eb
files gui/interface.c gui/ui/gtk/equalizer.c
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Wed Jun 29 11:21:09 2011 +0000
+++ b/gui/interface.c	Wed Jun 29 11:35:58 2011 +0000
@@ -32,6 +32,7 @@
 #include "help_mp.h"
 #include "input/input.h"
 #include "libaf/equalizer.h"
+#include "libavutil/common.h"
 #include "libmpcodecs/dec_audio.h"
 #include "libmpcodecs/dec_video.h"
 #include "libmpcodecs/vd.h"
@@ -597,8 +598,8 @@
             equalizer_t eq;
             int i, j;
 
-            for (i = 0; i < 6; i++) {
-                for (j = 0; j < 10; j++) {
+            for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++) {
+                for (j = 0; j < FF_ARRAY_ELEMS(*gtkEquChannels); j++) {
                     eq.channel = i;
                     eq.band    = j;
                     eq.gain    = gtkEquChannels[i][j];
@@ -1315,7 +1316,7 @@
             memset(gtkEquChannels, 0, sizeof(gtkEquChannels));
 
             if (guiInfo.afilter) {
-                for (i = 0; i < 6; i++) {
+                for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++) {
                     tmp.ch  = i;
                     tmp.arg = gtkEquChannels[i];
                     af_control_any_rev(guiInfo.afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
--- a/gui/ui/gtk/equalizer.c	Wed Jun 29 11:21:09 2011 +0000
+++ b/gui/ui/gtk/equalizer.c	Wed Jun 29 11:35:58 2011 +0000
@@ -31,6 +31,7 @@
 #include "gui/cfg.h"
 #include "help_mp.h"
 #include "libaf/equalizer.h"
+#include "libavutil/common.h"
 #include "libvo/video_out.h"
 #include "stream/stream.h"
 #include "libmpdemux/demuxer.h"
@@ -255,8 +256,8 @@
  if ( Channel == -1 )
   {
    int i,j; equalizer_t eq;
-   for ( i=1;i<6;i++ )
-    for ( j=0;j<10;j++ )
+   for ( i=1;i<FF_ARRAY_ELEMS(gtkEquChannels);i++ )
+    for ( j=0;j<FF_ARRAY_ELEMS(*gtkEquChannels);j++ )
      { eq.band=j; eq.channel=i; eq.gain=gtkEquChannels[0][j]; gtkSet( gtkSetEqualizer,0,&eq ); }
   }
 }