[gst-cvs] gst-plugins-base: alsa: remove 'dir' out variable

Stefan Kost ensonic at kemper.freedesktop.org
Thu Aug 12 05:44:20 PDT 2010


Module: gst-plugins-base
Branch: master
Commit: 0fee4ed3d0c264dc4c0cb215d7b88320006ce2fb
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=0fee4ed3d0c264dc4c0cb215d7b88320006ce2fb

Author: Stefan Kost <ensonic at users.sf.net>
Date:   Thu Aug 12 15:26:08 2010 +0300

alsa: remove 'dir' out variable

Alsa seems to expect that we initialize it. Remove the variable and pass NULL
as we actually don't use it. In alsasink also #ifdef one section that is
grabing diagnostics to be disabled, when logging is disabled (the code was
using the out parameter as well).

Fixes #626125

---

 ext/alsa/gstalsasink.c |   22 ++++++++++++----------
 ext/alsa/gstalsasrc.c  |    8 ++++----
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c
index 72ad68f..e57884a 100644
--- a/ext/alsa/gstalsasink.c
+++ b/ext/alsa/gstalsasink.c
@@ -319,7 +319,7 @@ static int
 set_hwparams (GstAlsaSink * alsa)
 {
   guint rrate;
-  gint err, dir;
+  gint err;
   snd_pcm_hw_params_t *params;
   guint period_time, buffer_time;
 
@@ -363,34 +363,36 @@ retry:
   if (rrate != alsa->rate)
     goto rate_match;
 
+#ifndef GST_DISABLE_GST_DEBUG
   /* get and dump some limits */
   {
     guint min, max;
 
-    snd_pcm_hw_params_get_buffer_time_min (params, &min, &dir);
-    snd_pcm_hw_params_get_buffer_time_max (params, &max, &dir);
+    snd_pcm_hw_params_get_buffer_time_min (params, &min, NULL);
+    snd_pcm_hw_params_get_buffer_time_max (params, &max, NULL);
 
     GST_DEBUG_OBJECT (alsa, "buffer time %u, min %u, max %u",
         alsa->buffer_time, min, max);
 
-    snd_pcm_hw_params_get_period_time_min (params, &min, &dir);
-    snd_pcm_hw_params_get_period_time_max (params, &max, &dir);
+    snd_pcm_hw_params_get_period_time_min (params, &min, NULL);
+    snd_pcm_hw_params_get_period_time_max (params, &max, NULL);
 
     GST_DEBUG_OBJECT (alsa, "period time %u, min %u, max %u",
         alsa->period_time, min, max);
 
-    snd_pcm_hw_params_get_periods_min (params, &min, &dir);
-    snd_pcm_hw_params_get_periods_max (params, &max, &dir);
+    snd_pcm_hw_params_get_periods_min (params, &min, NULL);
+    snd_pcm_hw_params_get_periods_max (params, &max, NULL);
 
     GST_DEBUG_OBJECT (alsa, "periods min %u, max %u", min, max);
   }
+#endif
 
   /* now try to configure the buffer time and period time, if one
    * of those fail, we fall back to the defaults and emit a warning. */
   if (buffer_time != -1 && !alsa->iec958) {
     /* set the buffer time */
     if ((err = snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params,
-                &buffer_time, &dir)) < 0) {
+                &buffer_time, NULL)) < 0) {
       GST_ELEMENT_WARNING (alsa, RESOURCE, SETTINGS, (NULL),
           ("Unable to set buffer time %i for playback: %s",
               buffer_time, snd_strerror (err)));
@@ -403,7 +405,7 @@ retry:
   if (period_time != -1 && !alsa->iec958) {
     /* set the period time */
     if ((err = snd_pcm_hw_params_set_period_time_near (alsa->handle, params,
-                &period_time, &dir)) < 0) {
+                &period_time, NULL)) < 0) {
       GST_ELEMENT_WARNING (alsa, RESOURCE, SETTINGS, (NULL),
           ("Unable to set period time %i for playback: %s",
               period_time, snd_strerror (err)));
@@ -431,7 +433,7 @@ retry:
   /* now get the configured values */
   CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size),
       buffer_size);
-  CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, &dir),
+  CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, NULL),
       period_size);
 
   GST_DEBUG_OBJECT (alsa, "buffer size %lu, period size %lu", alsa->buffer_size,
diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c
index f061a1c..0aae04d 100644
--- a/ext/alsa/gstalsasrc.c
+++ b/ext/alsa/gstalsasrc.c
@@ -331,7 +331,7 @@ static int
 set_hwparams (GstAlsaSrc * alsa)
 {
   guint rrate;
-  gint err, dir;
+  gint err;
   snd_pcm_hw_params_t *params;
 
   snd_pcm_hw_params_malloc (&params);
@@ -357,12 +357,12 @@ set_hwparams (GstAlsaSrc * alsa)
   if (alsa->buffer_time != -1) {
     /* set the buffer time */
     CHECK (snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params,
-            &alsa->buffer_time, &dir), buffer_time);
+            &alsa->buffer_time, NULL), buffer_time);
   }
   if (alsa->period_time != -1) {
     /* set the period time */
     CHECK (snd_pcm_hw_params_set_period_time_near (alsa->handle, params,
-            &alsa->period_time, &dir), period_time);
+            &alsa->period_time, NULL), period_time);
   }
 
   /* write the parameters to device */
@@ -371,7 +371,7 @@ set_hwparams (GstAlsaSrc * alsa)
   CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size),
       buffer_size);
 
-  CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, &dir),
+  CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, NULL),
       period_size);
 
   snd_pcm_hw_params_free (params);





More information about the Gstreamer-commits mailing list