From: Daniel Caujolle-B. <f1...@us...> - 2003-11-26 23:44:42
|
Update of /cvsroot/xine/xine-lib/src/audio_out In directory sc8-pr-cvs1:/tmp/cvs-serv30244/src/audio_out Modified Files: audio_alsa_out.c audio_oss_out.c audio_sun_out.c Log Message: xprintf clean pass. xprintf now log into new XINE_LOG_TRACE log buffer. scratch buffer enhancement (thanks Thibaut for the malloc tips), enlarge log buffer from 25 lines (very useless), to 150 (better). Index: audio_alsa_out.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/audio_out/audio_alsa_out.c,v retrieving revision 1.117 retrieving revision 1.118 diff -u -r1.117 -r1.118 --- audio_alsa_out.c 7 Nov 2003 18:25:35 -0000 1.117 +++ audio_alsa_out.c 26 Nov 2003 23:44:08 -0000 1.118 @@ -522,8 +522,7 @@ /* Check for pause/resume support */ this->has_pause_resume = ( snd_pcm_hw_params_can_pause (params) && snd_pcm_hw_params_can_resume (params) ); - if (this->class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, "audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume); this->sample_rate_factor = (double) this->output_sample_rate / (double) this->input_sample_rate; this->bytes_per_frame = snd_pcm_frames_to_bytes (this->audio_fd, 1); /* @@ -1301,22 +1300,18 @@ this->capabilities = 0; - if(class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_alsa_out : supported modes are "); + xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_alsa_out : supported modes are "); if (!(snd_pcm_hw_params_test_format(this->audio_fd, params, SND_PCM_FORMAT_U8))) { this->capabilities |= AO_CAP_8BITS; - if(class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("8bit "); + xprintf(class->xine, XINE_VERBOSITY_LOG, "8bit "); } if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 1))) { this->capabilities |= AO_CAP_MODE_MONO; - if(class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("mono "); + xprintf(class->xine, XINE_VERBOSITY_LOG, "mono "); } if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 2))) { this->capabilities |= AO_CAP_MODE_STEREO; - if(class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("stereo "); + xprintf(class->xine, XINE_VERBOSITY_LOG, "stereo "); } if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 4)) && config->register_bool (config, @@ -1327,11 +1322,11 @@ 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_4CHANNEL; - 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) " ); - } + xprintf(class->xine, XINE_VERBOSITY_LOG, "4-channel "); + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, "(4-channel not enabled in xine config) "); + if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && config->register_bool (config, "audio.four_lfe_channel", @@ -1341,11 +1336,11 @@ 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_4_1CHANNEL; - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("4.1-channel "); - } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("(4.1-channel not enabled in xine config) " ); - } + xprintf(class->xine, XINE_VERBOSITY_LOG, "4.1-channel "); + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, "(4.1-channel not enabled in xine config) "); + if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && config->register_bool (config, "audio.five_channel", @@ -1355,11 +1350,11 @@ 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_5CHANNEL; - 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) " ); - } + xprintf(class->xine, XINE_VERBOSITY_LOG, "5-channel "); + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, "(5-channel not enabled in xine config) "); + if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && config->register_bool (config, "audio.five_lfe_channel", @@ -1369,11 +1364,11 @@ 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; - 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) " ); - } + xprintf(class->xine, XINE_VERBOSITY_LOG, "5.1-channel "); + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, "(5.1-channel not enabled in xine config) "); + this->has_pause_resume = 0; /* This is checked at open time instead */ @@ -1407,13 +1402,10 @@ this) ) { this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("a/52 and DTS pass-through "); - } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("(a/52 and DTS pass-through not enabled in xine config)"); - } - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("\n"); + xprintf(class->xine, XINE_VERBOSITY_LOG, "a/52 and DTS pass-through "); + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, "(a/52 and DTS pass-through not enabled in xine config)"); /* printf("audio_alsa_out: capabilities 0x%X\n",this->capabilities); */ Index: audio_oss_out.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/audio_out/audio_oss_out.c,v retrieving revision 1.93 retrieving revision 1.94 diff -u -r1.93 -r1.94 --- audio_oss_out.c 26 Nov 2003 19:43:26 -0000 1.93 +++ audio_oss_out.c 26 Nov 2003 23:44:08 -0000 1.94 @@ -165,9 +165,8 @@ oss_driver_t *this = (oss_driver_t *) this_gen; int tmp; - 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); + xprintf(this->xine, XINE_VERBOSITY_LOG, "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); @@ -218,8 +217,8 @@ tmp = this->input_sample_rate; if (ioctl(this->audio_fd,SNDCTL_DSP_SPEED, &tmp) == -1) { - 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); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "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) { @@ -229,9 +228,9 @@ } this->output_sample_rate = tmp; this->output_sample_k_rate = this->output_sample_rate / 1000; - 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); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "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 @@ -269,13 +268,11 @@ 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; - if (this->xine->verbosity >= XINE_VERBOSITY_DEBUG) - printf ("audio_oss_out: AO_CAP_MODE_A52\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: AO_CAP_MODE_A52\n"); break; } - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_oss_out: %d channels output\n",this->num_channels); + xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_oss_out: %d channels output\n",this->num_channels); this->bytes_per_frame=(this->bits_per_sample*this->num_channels)/8; /* @@ -703,8 +700,7 @@ * find best device driver/channel */ - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_oss_out: Opening audio device...\n"); + xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: Opening audio device...\n"); best_rate = 0; devnum = config->register_num (config, "audio.oss_device_num", -1, @@ -748,9 +744,8 @@ * open that device */ - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_oss_out: using device >%s<\n", - this->audio_dev); + xprintf(class->xine, XINE_VERBOSITY_LOG, + "audio_oss_out: using device >%s<\n", this->audio_dev); audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK); @@ -789,12 +784,10 @@ */ if (ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &info) != -1) { - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("audio_oss_out: using SNDCTL_DSP_GETODELAY\n"); + xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: using SNDCTL_DSP_GETODELAY\n"); this->sync_method = OSS_SYNC_GETODELAY; } else if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) != -1) { - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("audio_oss_out: using SNDCTL_DSP_GETOPTR\n"); + xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: using SNDCTL_DSP_GETOPTR\n"); this->sync_method = OSS_SYNC_GETOPTR; } else { this->sync_method = OSS_SYNC_SOFTSYNC; @@ -802,12 +795,10 @@ } if (this->sync_method == OSS_SYNC_SOFTSYNC) { - 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"); - } - + xprintf(class->xine, XINE_VERBOSITY_LOG, + "audio_oss_out: Audio driver realtime sync disabled...\n" + "audio_oss_out: ...will use system real-time clock for soft-sync instead\n" + "audio_oss_out: ...there may be audio/video synchronization issues\n"); gettimeofday(&this->start_time, NULL); } @@ -815,10 +806,9 @@ char *buf; int c; - 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: "); - } + xprintf(class->xine, XINE_VERBOSITY_LOG, + "audio_oss_out: Audio driver realtime sync disabled...\n" + "audio_oss_out: ...probing output buffer size: "); this->buffer_size = 0; if( (buf=malloc(1024)) != NULL ) { @@ -833,10 +823,9 @@ free(buf); } close(audio_fd); - 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"); - } + xprintf(class->xine, XINE_VERBOSITY_LOG, + "%d bytes\n" + "audio_oss_out: ...there may be audio/video synchronization issues\n", this->buffer_size); audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK); @@ -870,21 +859,18 @@ return NULL; } - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_oss_out: supported modes are "); + xprintf(class->xine, XINE_VERBOSITY_LOG, "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; - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("mono "); + xprintf(class->xine, XINE_VERBOSITY_LOG, "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; - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("stereo "); + xprintf(class->xine, XINE_VERBOSITY_LOG, "stereo "); } num_channels = 4; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); @@ -893,10 +879,10 @@ _("Enable 4.0 channel analog surround output"), NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_4CHANNEL; - 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) " ); + xprintf(class->xine, XINE_VERBOSITY_LOG, "4-channel "); + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, "(4-channel not enabled in xine config) " ); } num_channels = 5; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); @@ -905,10 +891,10 @@ _("Enable 5.0 channel analog surround output"), NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5CHANNEL; - 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) " ); + xprintf(class->xine, XINE_VERBOSITY_LOG,"5-channel "); + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, "(5-channel not enabled in xine config) " ); } num_channels = 6; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); @@ -917,10 +903,10 @@ _("Enable 5.1 channel analog surround output"), NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; - 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) " ); + xprintf(class->xine, XINE_VERBOSITY_LOG, "5.1-channel "); + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, "(5.1-channel not enabled in xine config) " ); } ioctl(audio_fd,SNDCTL_DSP_GETFMTS,&caps); @@ -933,15 +919,11 @@ NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("a/52-pass-through "); - } else - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("(a/52-pass-through not enabled in xine config)"); + xprintf(class->xine, XINE_VERBOSITY_LOG, "a/52-pass-through "); + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, "(a/52-pass-through not enabled in xine config)"); } - - if (class->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("\n"); /* * mixer initialisation. Index: audio_sun_out.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/audio_out/audio_sun_out.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- audio_sun_out.c 6 Oct 2003 15:27:10 -0000 1.30 +++ audio_sun_out.c 26 Nov 2003 23:44:08 -0000 1.31 @@ -412,12 +412,10 @@ int pass; int ok; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_sun_out: ao_sun_open rate=%d, mode=%d\n", rate, mode); + xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: ao_sun_open rate=%d, mode=%d\n", rate, mode); if ( (mode & this->capabilities) == 0 ) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_sun_out: unsupported mode %08x\n", mode); + xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: unsupported mode %08x\n", mode); return 0; } @@ -544,8 +542,7 @@ this->input_sample_rate, this->output_sample_rate); */ - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_sun_out: %d channels output\n",this->num_channels); + xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: %d channels output\n",this->num_channels); return this->output_sample_rate; } @@ -894,8 +891,7 @@ * find best device driver/channel */ - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("audio_sun_out: Opening audio device %s...\n", devname); + xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: Opening audio device %s...\n", devname); /* * open the device |