[MPlayer-cvslog] r27422 - in trunk: cfg-common.h configure gui/cfg.c gui/interface.c gui/mplayer/gtk/opts.c libao2/audio_out.c stream/audio_in.c stream/audio_in.h stream/stream_radio.c stream/tvi_v4l.c stream/tvi_v4l2.c

diego subversion at mplayerhq.hu
Thu Aug 7 01:19:30 CEST 2008


Author: diego
Date: Thu Aug  7 01:19:29 2008
New Revision: 27422

Log:
Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
Use it in all the places that checked for either ALSA 0.9 or 1.x.


Modified:
   trunk/cfg-common.h
   trunk/configure
   trunk/gui/cfg.c
   trunk/gui/interface.c
   trunk/gui/mplayer/gtk/opts.c
   trunk/libao2/audio_out.c
   trunk/stream/audio_in.c
   trunk/stream/audio_in.h
   trunk/stream/stream_radio.c
   trunk/stream/tvi_v4l.c
   trunk/stream/tvi_v4l2.c

Modified: trunk/cfg-common.h
==============================================================================
--- trunk/cfg-common.h	(original)
+++ trunk/cfg-common.h	Thu Aug  7 01:19:29 2008
@@ -119,9 +119,9 @@ const m_option_t tvopts_conf[]={
 	{"mjpeg", &stream_tv_defaults.mjpeg, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"decimation", &stream_tv_defaults.decimation, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL},
 	{"quality", &stream_tv_defaults.quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
 	{"alsa", &stream_tv_defaults.alsa, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#endif /* defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X) */
+#endif /* CONFIG_ALSA */
 #endif /* defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2) */
 	{"adevice", &stream_tv_defaults.adevice, CONF_TYPE_STRING, 0, 0, 0, NULL},
 #ifdef CONFIG_TV_TELETEXT

Modified: trunk/configure
==============================================================================
--- trunk/configure	(original)
+++ trunk/configure	Thu Aug  7 01:19:29 2008
@@ -5298,6 +5298,7 @@ int main(void) { return 0; }
 EOF
   cc_check -lasound $_ld_dl $_ld_pthread && _alsaver='1.0.x-alsa'
 fi
+_def_alsa='#undef CONFIG_ALSA'
 _def_alsa5='#undef CONFIG_ALSA5'
 _def_alsa9='#undef CONFIG_ALSA9'
 _def_alsa1x='#undef CONFIG_ALSA1X'
@@ -5316,6 +5317,7 @@ if test "$_alsaver" ; then
     _alsa9=yes
     _aosrc="$_aosrc ao_alsa.c"
     _aomodules="alsa $_aomodules"
+    _def_alsa='#define CONFIG_ALSA 1'
     _def_alsa9='#define CONFIG_ALSA9 1'
     _def_sys_asoundlib_h='#define HAVE_SYS_ASOUNDLIB_H 1'
     _res_comment="using alsa 0.9.x and sys/asoundlib.h"
@@ -5323,6 +5325,7 @@ if test "$_alsaver" ; then
     _alsa9=yes
     _aosrc="$_aosrc ao_alsa.c"
     _aomodules="alsa $_aomodules"
+    _def_alsa='#define CONFIG_ALSA 1'
     _def_alsa9='#define CONFIG_ALSA9 1'
     _def_alsa_asoundlib_h='#define HAVE_ALSA_ASOUNDLIB_H 1'
     _res_comment="using alsa 0.9.x and alsa/asoundlib.h"
@@ -5330,6 +5333,7 @@ if test "$_alsaver" ; then
     _alsa1x=yes
     _aosrc="$_aosrc ao_alsa.c"
     _aomodules="alsa $_aomodules"
+    _def_alsa='#define CONFIG_ALSA 1'
     _def_alsa1x="#define CONFIG_ALSA1X 1"
     _def_alsa_asoundlib_h='#define HAVE_SYS_ASOUNDLIB_H 1'
     _res_comment="using alsa 1.0.x and sys/asoundlib.h"
@@ -5337,6 +5341,7 @@ if test "$_alsaver" ; then
     _alsa1x=yes
     _aosrc="$_aosrc ao_alsa.c"
     _aomodules="alsa $_aomodules"
+    _def_alsa='#define CONFIG_ALSA 1'
     _def_alsa1x="#define CONFIG_ALSA1X 1"
     _def_alsa_asoundlib_h='#define HAVE_ALSA_ASOUNDLIB_H 1'
     _res_comment="using alsa 1.0.x and alsa/asoundlib.h"
@@ -8366,6 +8371,7 @@ $_def_gtk2
 $_def_ossaudio
 $_def_ossaudio_devdsp
 $_def_ossaudio_devmixer
+$_def_alsa
 $_def_alsa5
 $_def_alsa9
 $_def_alsa1x

Modified: trunk/gui/cfg.c
==============================================================================
--- trunk/gui/cfg.c	(original)
+++ trunk/gui/cfg.c	Thu Aug  7 01:19:29 2008
@@ -58,7 +58,7 @@ char * gtkAOOSSMixer;
 char * gtkAOOSSMixerChannel;
 char * gtkAOOSSDevice;
 #endif
-#if defined(CONFIG_ALSA9) || defined (CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
 char * gtkAOALSAMixer;
 char * gtkAOALSAMixerChannel;
 char * gtkAOALSADevice;
@@ -139,7 +139,7 @@ static const m_option_t gui_opts[] =
  { "ao_oss_mixer_channel",&gtkAOOSSMixerChannel,CONF_TYPE_STRING,0,0,0,NULL },
  { "ao_oss_device",&gtkAOOSSDevice,CONF_TYPE_STRING,0,0,0,NULL },
 #endif
-#if defined(CONFIG_ALSA9) || defined (CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
  { "ao_alsa_mixer",&gtkAOALSAMixer,CONF_TYPE_STRING,0,0,0,NULL },
  { "ao_alsa_mixer_channel",&gtkAOALSAMixerChannel,CONF_TYPE_STRING,0,0,0,NULL },
  { "ao_alsa_device",&gtkAOALSADevice,CONF_TYPE_STRING,0,0,0,NULL },

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	(original)
+++ trunk/gui/interface.c	Thu Aug  7 01:19:29 2008
@@ -842,7 +842,7 @@ int guiGetEvent( int type,char * arg )
 	  free(tmp);
 	 }
 #endif
-#if defined(CONFIG_ALSA9) || defined (CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
 	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) )
 	 {
 	  char *tmp;

Modified: trunk/gui/mplayer/gtk/opts.c
==============================================================================
--- trunk/gui/mplayer/gtk/opts.c	(original)
+++ trunk/gui/mplayer/gtk/opts.c	Thu Aug  7 01:19:29 2008
@@ -1423,7 +1423,7 @@ GList *appendOSSMixerChannels(GList *l) 
 }
 #endif
 
-#if defined(CONFIG_ALSA9) || defined (CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
 GList *appendALSADevices(GList *l) {
   l = g_list_append(l, (gpointer)"default");
   l = g_list_append(l, (gpointer)"hw=0.0");
@@ -1510,7 +1510,7 @@ void ShowAudioConfig() {
     setGtkEntryText(CEAudioMixerChannel, gtkAOOSSMixerChannel);
   }
 #endif
-#if defined(CONFIG_ALSA9) || defined (CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
   if (strncmp(ao_driver[0], "alsa", 4) == 0) {
     setGtkEntryText(CEAudioDevice, gtkAOALSADevice);
     setGtkEntryText(CEAudioMixer, gtkAOALSAMixer);
@@ -1552,7 +1552,7 @@ static void audioButton(GtkButton *butto
         gtkAOOSSMixerChannel = gstrdup(getGtkEntryText(CEAudioMixerChannel));
       }
 #endif
-#if defined(CONFIG_ALSA9) || defined (CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
       if (strncmp(ao_driver[0], "alsa", 4) == 0) {
         gfree(&gtkAOALSADevice);
         gtkAOALSADevice = gstrdup(getGtkEntryText(CEAudioDevice));
@@ -1616,7 +1616,7 @@ GtkWidget *create_AudioConfig() {
   if (strncmp(ao_driver[0], "oss", 3) == 0)
     items = appendOSSDevices(items);
 #endif
-#if defined(CONFIG_ALSA9) || defined (CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
   if (strncmp(ao_driver[0], "alsa", 4) == 0)
     items = appendALSADevices(items);
 #endif
@@ -1646,7 +1646,7 @@ GtkWidget *create_AudioConfig() {
   if (strncmp(ao_driver[0], "oss", 3) == 0)
     items = appendOSSMixers(items);
 #endif
-#if defined(CONFIG_ALSA9) || defined (CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
   if (strncmp(ao_driver[0], "alsa", 4) == 0)
     items = appendALSAMixers(items);
 #endif
@@ -1668,7 +1668,7 @@ GtkWidget *create_AudioConfig() {
   if (strncmp(ao_driver[0], "oss", 3) == 0)
     items = appendOSSMixerChannels(items);
 #endif
-#if defined(CONFIG_ALSA9) || defined (CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
   if (strncmp(ao_driver[0], "alsa", 4) == 0)
     items = appendALSAMixerChannels(items);
 #endif

Modified: trunk/libao2/audio_out.c
==============================================================================
--- trunk/libao2/audio_out.c	(original)
+++ trunk/libao2/audio_out.c	Thu Aug  7 01:19:29 2008
@@ -51,7 +51,7 @@ const ao_functions_t* const audio_out_dr
 #ifdef CONFIG_OSS_AUDIO
         &audio_out_oss,
 #endif
-#if defined (CONFIG_ALSA1X) || defined (CONFIG_ALSA9)
+#ifdef CONFIG_ALSA
         &audio_out_alsa,
 #endif
 #ifdef CONFIG_ALSA5

Modified: trunk/stream/audio_in.c
==============================================================================
--- trunk/stream/audio_in.c	(original)
+++ trunk/stream/audio_in.c	Thu Aug  7 01:19:29 2008
@@ -23,7 +23,7 @@ int audio_in_init(audio_in_t *ai, int ty
     ai->samplesize = -1;
 
     switch (ai->type) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     case AUDIO_IN_ALSA:
 	ai->alsa.handle = NULL;
 	ai->alsa.log = NULL;
@@ -45,7 +45,7 @@ int audio_in_setup(audio_in_t *ai)
 {
     
     switch (ai->type) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     case AUDIO_IN_ALSA:
 	if (ai_alsa_init(ai) < 0) return -1;
 	ai->setup = 1;
@@ -65,7 +65,7 @@ int audio_in_setup(audio_in_t *ai)
 int audio_in_set_samplerate(audio_in_t *ai, int rate)
 {
     switch (ai->type) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     case AUDIO_IN_ALSA:
 	ai->req_samplerate = rate;
 	if (!ai->setup) return 0;
@@ -87,7 +87,7 @@ int audio_in_set_samplerate(audio_in_t *
 int audio_in_set_channels(audio_in_t *ai, int channels)
 {
     switch (ai->type) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     case AUDIO_IN_ALSA:
 	ai->req_channels = channels;
 	if (!ai->setup) return 0;
@@ -108,12 +108,12 @@ int audio_in_set_channels(audio_in_t *ai
 
 int audio_in_set_device(audio_in_t *ai, char *device)
 {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     int i;
 #endif
     if (ai->setup) return -1;
     switch (ai->type) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     case AUDIO_IN_ALSA:
 	if (ai->alsa.device) free(ai->alsa.device);
 	ai->alsa.device = strdup(device);
@@ -138,7 +138,7 @@ int audio_in_uninit(audio_in_t *ai)
 {
     if (ai->setup) {
 	switch (ai->type) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
 	case AUDIO_IN_ALSA:
 	    if (ai->alsa.log)
 		snd_output_close(ai->alsa.log);
@@ -162,7 +162,7 @@ int audio_in_uninit(audio_in_t *ai)
 int audio_in_start_capture(audio_in_t *ai)
 {
     switch (ai->type) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     case AUDIO_IN_ALSA:
 	return snd_pcm_start(ai->alsa.handle);
 #endif
@@ -180,7 +180,7 @@ int audio_in_read_chunk(audio_in_t *ai, 
     int ret;
     
     switch (ai->type) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     case AUDIO_IN_ALSA:
 	ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size);
 	if (ret != ai->alsa.chunk_size) {

Modified: trunk/stream/audio_in.h
==============================================================================
--- trunk/stream/audio_in.h	(original)
+++ trunk/stream/audio_in.h	Thu Aug  7 01:19:29 2008
@@ -6,7 +6,7 @@
 
 #include "config.h"
 
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
 #include <alsa/asoundlib.h>
 
 typedef struct {
@@ -43,7 +43,7 @@ typedef struct 
     int bytes_per_sample;
     int samplesize;
     
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     ai_alsa_t alsa;
 #endif
 #ifdef CONFIG_OSS_AUDIO
@@ -60,7 +60,7 @@ int audio_in_uninit(audio_in_t *ai);
 int audio_in_start_capture(audio_in_t *ai);
 int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer);
 
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
 int ai_alsa_setup(audio_in_t *ai);
 int ai_alsa_init(audio_in_t *ai);
 int ai_alsa_xrun(audio_in_t *ai);

Modified: trunk/stream/stream_radio.c
==============================================================================
--- trunk/stream/stream_radio.c	(original)
+++ trunk/stream/stream_radio.c	Thu Aug  7 01:19:29 2008
@@ -715,7 +715,7 @@ static int read_chunk(audio_in_t *ai, un
     int ret;
 
     switch (ai->type) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     case AUDIO_IN_ALSA:
         //device opened in non-blocking mode
         ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size);
@@ -836,7 +836,7 @@ static int init_audio(radio_priv_t *priv
 
     priv->do_capture=1;
     mp_msg(MSGT_RADIO,MSGL_V,MSGTR_RADIO_CaptureStarting);
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     while ((tmp = strrchr(priv->radio_param->adevice, '='))){
         tmp[0] = ':';
         //adevice option looks like ALSA device name. Switching to ALSA
@@ -862,7 +862,7 @@ static int init_audio(radio_priv_t *priv
     if(is_oss)
         ioctl(priv->audio_in.oss.audio_fd, SNDCTL_DSP_NONBLOCK, 0);
 #endif
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
     if(!is_oss)
         snd_pcm_nonblock(priv->audio_in.alsa.handle,1);
 #endif

Modified: trunk/stream/tvi_v4l.c
==============================================================================
--- trunk/stream/tvi_v4l.c	(original)
+++ trunk/stream/tvi_v4l.c	Thu Aug  7 01:19:29 2008
@@ -627,7 +627,7 @@ static int init(priv_t *priv)
     /* audio init */
     if (!priv->tv_param->noaudio) {
 
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
         if (priv->tv_param->alsa)
             audio_in_init(&priv->audio_in, AUDIO_IN_ALSA);
         else

Modified: trunk/stream/tvi_v4l2.c
==============================================================================
--- trunk/stream/tvi_v4l2.c	(original)
+++ trunk/stream/tvi_v4l2.c	Thu Aug  7 01:19:29 2008
@@ -378,7 +378,7 @@ static void init_audio(priv_t *priv)
     if (priv->audio_initialized) return;
 
     if (!priv->tv_param->noaudio) {
-#if defined(CONFIG_ALSA9) || defined(CONFIG_ALSA1X)
+#ifdef CONFIG_ALSA
         if (priv->tv_param->alsa)
             audio_in_init(&priv->audio_in, AUDIO_IN_ALSA);
         else



More information about the MPlayer-cvslog mailing list