changeset 2434:571538d73e08

audio channels nr is identified from libmad's channel mode
author alex
date Tue, 23 Oct 2001 17:26:20 +0000
parents f6caecb14d6d
children ee81502bbc4a
files dec_audio.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dec_audio.c	Tue Oct 23 17:04:41 2001 +0000
+++ b/dec_audio.c	Tue Oct 23 17:26:20 2001 +0000
@@ -588,7 +588,21 @@
 	 printf(__FILE__ ":%d:mad: frame decoding failed\n", __LINE__);
        }
      
-     sh_audio->channels=2; // hack
+     switch (mad_frame.header.mode)
+     {
+        case MAD_MODE_SINGLE_CHANNEL:
+	    sh_audio->channels=1;
+	    break;
+	case MAD_MODE_DUAL_CHANNEL:
+	case MAD_MODE_JOINT_STEREO:
+	case MAD_MODE_STEREO:
+	    sh_audio->channels=2;
+	    break;
+	default:
+	    mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "mad: unknown number of channels\n");
+     }
+     mp_msg(MSGT_DECAUDIO, MSGL_HINT, "mad: channels: %d (mad channel mode: %d)\n",
+        sh_audio->channels, mad_frame.header.mode);
 /* var. name changed in 0.13.0 (beta) (libmad/CHANGES) -- alex */
 #if (MAD_VERSION_MAJOR >= 0) && (MAD_VERSION_MINOR >= 13)
      sh_audio->samplerate=mad_frame.header.samplerate;