[vlc-commits] amem: call cleanup() if setup() succeeded but format is unsupported

Rémi Denis-Courmont git at videolan.org
Sat Dec 8 08:56:45 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec  8 09:55:52 2012 +0200| [e4f129bf932c6e4bc5aa04344cbcfc6b95777465] | committer: Rémi Denis-Courmont

amem: call cleanup() if setup() succeeded but format is unsupported

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e4f129bf932c6e4bc5aa04344cbcfc6b95777465
---

 modules/audio_output/amem.c |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/modules/audio_output/amem.c b/modules/audio_output/amem.c
index a60a0a7..0296fc4 100644
--- a/modules/audio_output/amem.c
+++ b/modules/audio_output/amem.c
@@ -148,6 +148,15 @@ static int SoftMuteSet (audio_output_t *aout, bool mute)
     return 0;
 }
 
+static void Stop (audio_output_t *aout)
+{
+    aout_sys_t *sys = aout->sys;
+
+    if (sys->cleanup != NULL)
+        sys->cleanup (sys->opaque);
+    sys->ready = false;
+}
+
 static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
 {
     aout_sys_t *sys = aout->sys;
@@ -173,14 +182,14 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
     if (sys->set_volume != NULL)
         sys->set_volume(sys->opaque, sys->volume, sys->mute);
 
+    /* Ensure that format is supported */
     if (fmt->i_rate == 0 || fmt->i_rate > 192000
-     || channels == 0 || channels > AOUT_CHAN_MAX)
-        return VLC_EGENERIC;
-
-    /* TODO: amem-format */
-    if (strcmp(format, "S16N"))
+     || channels == 0 || channels > AOUT_CHAN_MAX
+     || strcmp(format, "S16N") /* TODO: amem-format */)
     {
-        msg_Err (aout, "format not supported");
+        msg_Err (aout, "format not supported: %s, %u channel(s), %u Hz",
+                 format, channels, fmt->i_rate);
+        Stop (aout);
         return VLC_EGENERIC;
     }
 
@@ -223,15 +232,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
     return VLC_SUCCESS;
 }
 
-static void Stop (audio_output_t *aout)
-{
-    aout_sys_t *sys = aout->sys;
-
-    if (sys->cleanup != NULL)
-        sys->cleanup (sys->opaque);
-    sys->ready = false;
-}
-
 static int Open (vlc_object_t *obj)
 {
     audio_output_t *aout = (audio_output_t *)obj;



More information about the vlc-commits mailing list