From: Guenter B. <gu...@us...> - 2003-03-06 16:56:59
|
Update of /cvsroot/xine/xine-lib/src/audio_out In directory sc8-pr-cvs1:/tmp/cvs-serv10967/src/audio_out Modified Files: audio_oss_out.c Log Message: steps toward muting xine's console output by default Index: audio_oss_out.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/audio_out/audio_oss_out.c,v retrieving revision 1.86 retrieving revision 1.87 diff -u -r1.86 -r1.87 --- audio_oss_out.c 8 Feb 2003 15:14:45 -0000 1.86 +++ audio_oss_out.c 6 Mar 2003 16:49:30 -0000 1.87 @@ -142,12 +142,14 @@ struct timeval start_time; + xine_t *xine; } oss_driver_t; typedef struct { - audio_driver_class_t driver_class; + audio_driver_class_t driver_class; - config_values_t *config; + config_values_t *config; + xine_t *xine; } oss_class_t; /* @@ -159,8 +161,9 @@ oss_driver_t *this = (oss_driver_t *) this_gen; int tmp; - printf ("audio_oss_out: ao_open rate=%d, mode=%d, dev=%s\n", - rate, mode, this->audio_dev); + if (this->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("audio_oss_out: ao_open rate=%d, mode=%d, dev=%s\n", + rate, mode, this->audio_dev); if ( (mode & this->capabilities) == 0 ) { printf ("audio_oss_out: unsupported mode %08x\n", mode); @@ -188,7 +191,7 @@ */ this->audio_fd=open(this->audio_dev,O_WRONLY|O_NONBLOCK); - if(this->audio_fd < 0) { + if (this->audio_fd < 0) { printf("audio_oss_out: Opening audio device %s: %s\n", this->audio_dev, strerror(errno)); return 0; @@ -211,7 +214,8 @@ tmp = this->input_sample_rate; if (ioctl(this->audio_fd,SNDCTL_DSP_SPEED, &tmp) == -1) { - printf ("audio_oss_out: warning: sampling rate %d Hz not supported, trying 44100 Hz\n", this->input_sample_rate); + if (this->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("audio_oss_out: warning: sampling rate %d Hz not supported, trying 44100 Hz\n", this->input_sample_rate); tmp = 44100; if (ioctl(this->audio_fd,SNDCTL_DSP_SPEED, &tmp) == -1) { @@ -221,8 +225,9 @@ } this->output_sample_rate = tmp; this->output_sample_k_rate = this->output_sample_rate / 1000; - printf ("audio_oss_out: audio rate : %d requested, %d provided by device/sec\n", - this->input_sample_rate, this->output_sample_rate); + if (this->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("audio_oss_out: audio rate : %d requested, %d provided by device/sec\n", + this->input_sample_rate, this->output_sample_rate); } /* * set number of channels / a52 passthrough @@ -260,11 +265,13 @@ this->num_channels = 2; /* FIXME: is this correct ? */ this->output_sample_rate = this->input_sample_rate; this->output_sample_k_rate = this->output_sample_rate / 1000; - printf ("audio_oss_out: AO_CAP_MODE_A52\n"); + if (this->xine->verbosity >= XINE_VERBOSITY_DEBUG) + printf ("audio_oss_out: AO_CAP_MODE_A52\n"); break; } - printf ("audio_oss_out: %d channels output\n",this->num_channels); + if (this->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("audio_oss_out: %d channels output\n",this->num_channels); this->bytes_per_frame=(this->bits_per_sample*this->num_channels)/8; /* @@ -577,8 +584,8 @@ } else - printf("%s(): open() %s failed: %s\n", - __XINE_FUNCTION__, this->mixer.name, strerror(errno)); + printf("audio_oss_out: open() %s failed: %s\n", + this->mixer.name, strerror(errno)); } else this->mixer.volume = value; @@ -613,8 +620,8 @@ } else - printf("%s(): open() %s failed: %s\n", - __XINE_FUNCTION__, this->mixer.name, strerror(errno)); + printf("audio_oss_out: open() %s failed: %s\n", + this->mixer.name, strerror(errno)); } else (void) ao_oss_set_property(&this->ao_driver, this->mixer.prop, this->mixer.volume); @@ -695,7 +702,8 @@ * find best device driver/channel */ - printf ("audio_oss_out: Opening audio device...\n"); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("audio_oss_out: Opening audio device...\n"); best_rate = 0; devnum = config->register_num (config, "audio.oss_device_num", -1, @@ -739,12 +747,13 @@ * open that device */ - printf ("audio_oss_out: using device >%s<\n", - this->audio_dev); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("audio_oss_out: using device >%s<\n", + this->audio_dev); audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK); - if(audio_fd < 0) { + if (audio_fd < 0) { printf("audio_oss_out: opening audio device %s failed:\n%s\n", this->audio_dev, strerror(errno)); @@ -779,10 +788,12 @@ */ if (ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &info) != -1) { - printf("audio_oss_out: using SNDCTL_DSP_GETODELAY\n"); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf("audio_oss_out: using SNDCTL_DSP_GETODELAY\n"); this->sync_method = OSS_SYNC_GETODELAY; } else if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) != -1) { - printf("audio_oss_out: using SNDCTL_DSP_GETOPTR\n"); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf("audio_oss_out: using SNDCTL_DSP_GETOPTR\n"); this->sync_method = OSS_SYNC_GETOPTR; } else { this->sync_method = OSS_SYNC_SOFTSYNC; @@ -790,9 +801,11 @@ } if (this->sync_method == OSS_SYNC_SOFTSYNC) { - printf ("audio_oss_out: Audio driver realtime sync disabled...\n"); - printf ("audio_oss_out: ...will use system real-time clock for soft-sync instead\n"); - printf ("audio_oss_out: ...there may be audio/video synchronization issues\n"); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) { + printf ("audio_oss_out: Audio driver realtime sync disabled...\n"); + printf ("audio_oss_out: ...will use system real-time clock for soft-sync instead\n"); + printf ("audio_oss_out: ...there may be audio/video synchronization issues\n"); + } gettimeofday(&this->start_time, NULL); } @@ -801,8 +814,10 @@ char *buf; int c; - printf ("audio_oss_out: Audio driver realtime sync disabled...\n"); - printf ("audio_oss_out: ...probing output buffer size: "); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) { + printf ("audio_oss_out: Audio driver realtime sync disabled...\n"); + printf ("audio_oss_out: ...probing output buffer size: "); + } this->buffer_size = 0; if( (buf=malloc(1024)) != NULL ) { @@ -817,9 +832,11 @@ free(buf); } close(audio_fd); - printf ("%d bytes\n", this->buffer_size ); - printf ("audio_oss_out: ...there may be audio/video synchronization issues\n"); - + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) { + printf ("%d bytes\n", this->buffer_size ); + printf ("audio_oss_out: ...there may be audio/video synchronization issues\n"); + } + audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK); if(audio_fd < 0) @@ -852,18 +869,21 @@ return NULL; } - printf ("audio_oss_out: supported modes are "); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("audio_oss_out: supported modes are "); num_channels = 1; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==1) ) { this->capabilities |= AO_CAP_MODE_MONO; - printf ("mono "); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("mono "); } num_channels = 2; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==2) ) { this->capabilities |= AO_CAP_MODE_STEREO; - printf ("stereo "); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("stereo "); } num_channels = 4; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); @@ -872,8 +892,9 @@ _("Enable 4.0 channel analog surround output"), NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_4CHANNEL; - printf ("4-channel "); - } else + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("4-channel "); + } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) printf ("(4-channel not enabled in xine config) " ); } num_channels = 5; @@ -883,8 +904,9 @@ _("Enable 5.0 channel analog surround output"), NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5CHANNEL; - printf ("5-channel "); - } else + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("5-channel "); + } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) printf ("(5-channel not enabled in xine config) " ); } num_channels = 6; @@ -894,8 +916,9 @@ _("Enable 5.1 channel analog surround output"), NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; - printf ("5.1-channel "); - } else + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("5.1-channel "); + } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) printf ("(5.1-channel not enabled in xine config) " ); } @@ -911,7 +934,8 @@ printf ("(a/52-pass-through not enabled in xine config)"); } - printf ("\n"); + if (class->xine->verbosity >= XINE_VERBOSITY_LOG) + printf ("\n"); /* * mixer initialisation. @@ -965,6 +989,7 @@ this->output_sample_rate = 0; this->output_sample_k_rate = 0; this->audio_fd = -1; + this->xine = class->xine; this->config = config; this->ao_driver.get_capabilities = ao_oss_get_capabilities; @@ -1014,6 +1039,7 @@ this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; return this; } |