--- mplayer/libaf/af_ladspa.c	2010-03-01 11:22:54.000000000 +0100
+++ mplayer.build/libaf/af_ladspa.c	2010-04-27 13:52:16.000000000 +0200
@@ -57,11 +57,6 @@
                      *   the data unchanged.
                      */
 
-    int activated;  /**< 0 or 1. Activate LADSPA filters only once, even
-                     *   if the buffers get resized, to avoid a stuttering
-                     *   filter.
-                     */
-
     char *file;
     char *label;
 
@@ -91,6 +86,10 @@
     float **inbufs;
     float **outbufs;
     LADSPA_Handle *chhandles;
+    int *activated;  /**< 0 or 1. Activate LADSPA filters only once, even
+                      *   if the buffers get resized, to avoid a stuttering
+                      *   filter.
+                      */
 
 } af_ladspa_t;
 
@@ -252,11 +251,16 @@
         }
 
         if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) {
-            mp_msg(MSGT_AFILTER, MSGL_V, "%0.2f]\n", hint.UpperBound);
+            mp_msg(MSGT_AFILTER, MSGL_V, "%0.2f]", hint.UpperBound);
         } else {
-            mp_msg(MSGT_AFILTER, MSGL_V, "...]\n");
+            mp_msg(MSGT_AFILTER, MSGL_V, "...]");
         }
 
+	if (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor)) {
+	    mp_msg(MSGT_AFILTER, MSGL_V, "*srate\n");
+	} else {
+            mp_msg(MSGT_AFILTER, MSGL_V, "\n");
+        }
     }
 
     return AF_OK;
@@ -615,17 +619,23 @@
                                 setup->plugin_descriptor->PortRangeHints[p];
             val = setup->inputcontrols[p];
 
-            if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) &&
-                    val < hint.LowerBound) {
-                mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlBelow,
-                                            setup->myname, i, hint.LowerBound);
-                return AF_ERROR;
-            }
-            if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) &&
-                    val > hint.UpperBound) {
-                mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlAbove,
-                                            setup->myname, i, hint.UpperBound);
-                return AF_ERROR;
+            if (!LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor))
+            {
+                if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) &&
+                        val < hint.LowerBound ) {
+                    mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlBelow,
+                                                setup->myname, i, hint.LowerBound);
+                    return AF_ERROR;
+                }
+                if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) &&
+                        val > hint.UpperBound ) {
+                    mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlAbove,
+                                                setup->myname, i, hint.UpperBound);
+                    return AF_ERROR;
+                }
+            } else {
+                mp_msg(MSGT_AFILTER, MSGL_V, "%s: WARNING: boundaries depend on sample rate. not checked. take care\n",
+                                                                setup->myname);
             }
         }
         mp_msg(MSGT_AFILTER, MSGL_V, "%s: all controls have sane values\n",
@@ -704,6 +714,8 @@
             }
             free(setup->outbufs);
         }
+	if (setup->activated)
+            free(setup->activated);
 
         if (setup->libhandle)
             dlclose(setup->libhandle);
@@ -787,6 +799,7 @@
 
         if (!setup->chhandles) {
             setup->chhandles = calloc(nch, sizeof(LADSPA_Handle));
+            setup->activated = calloc(nch, sizeof(int));
 
             /* create handles
              * for stereo effects, create one handle for two channels
@@ -801,6 +814,7 @@
                 }
 
                 setup->chhandles[i] = pdes->instantiate(pdes, rate);
+		setup->activated[i] = 0;
             }
         }
 
@@ -832,11 +846,13 @@
                 }
             }
 
+        mp_msg(MSGT_AFILTER, MSGL_DBG3, "%s: ch = %d, act = %d\n",
+                                        setup->myname, i, setup->activated[i]);
             /* Activate filter (if it isn't already :) ) */
 
-            if ( (pdes->activate) && (setup->activated == 0) ) {
+            if ( (pdes->activate) && (setup->activated[i] == 0) ) {
                 pdes->activate(setup->chhandles[i]);
-                setup->activated = 1;
+                setup->activated[i] = 1;
             }
 
         } /* All channels/filters done! except for... */
