[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[593] mplayerxp/libao3
Brought to you by:
olov
From: <nic...@us...> - 2012-12-21 15:12:56
|
Revision: 593 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=593&view=rev Author: nickols_k Date: 2012-12-21 15:12:47 +0000 (Fri, 21 Dec 2012) Log Message: ----------- convert MSG_* into mpxp_ostream compatible output Modified Paths: -------------- mplayerxp/libao3/ao_alsa.cpp mplayerxp/libao3/ao_arts.cpp mplayerxp/libao3/ao_esd.cpp mplayerxp/libao3/ao_jack.cpp mplayerxp/libao3/ao_msg.h mplayerxp/libao3/ao_nas.cpp mplayerxp/libao3/ao_null.cpp mplayerxp/libao3/ao_openal.cpp mplayerxp/libao3/ao_oss.cpp mplayerxp/libao3/ao_sdl.cpp mplayerxp/libao3/ao_wav.cpp Modified: mplayerxp/libao3/ao_alsa.cpp =================================================================== --- mplayerxp/libao3/ao_alsa.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_alsa.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -87,21 +87,21 @@ Alsa_AO_Interface::~Alsa_AO_Interface() { int err; if(!handler) { - MSG_ERR("alsa-uninit: no handler defined!\n"); + mpxp_err<<"alsa-uninit: no handler defined!"<<std::endl; return; } if (!priv_conf.noblock) { if ((err = snd_pcm_drain(handler)) < 0) { - MSG_ERR("alsa-uninit: pcm drain error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-uninit: pcm drain error: "<<snd_strerror(err)<<std::endl; return; } } if ((err = snd_pcm_close(handler)) < 0) { - MSG_ERR("alsa-uninit: pcm close error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-uninit: pcm close error: "<<snd_strerror(err)<<std::endl; return; } else { handler = NULL; - MSG_V("alsa-uninit: pcm closed\n"); + mpxp_v<<"alsa-uninit: pcm closed"<<std::endl; } snd_pcm_hw_params_free(hwparams); snd_pcm_sw_params_free(swparams); @@ -207,30 +207,30 @@ snd_mixer_selem_id_set_name(sid, mix_name); if ((err = snd_mixer_open(&handle, 0)) < 0) { - MSG_ERR("alsa-control_ao: mixer open error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-control_ao: mixer open error: "<<snd_strerror(err)<<std::endl; return MPXP_Error; } if ((err = snd_mixer_attach(handle, card)) < 0) { - MSG_ERR("alsa-control_ao: mixer attach %s error: %s", card, snd_strerror(err)); + mpxp_err<<"alsa-control_ao: mixer attach "<<card<<" error: "<<snd_strerror(err)<<std::endl; snd_mixer_close(handle); return MPXP_Error; } if ((err = snd_mixer_selem_register(handle, NULL, NULL)) < 0) { - MSG_ERR("alsa-control_ao: mixer register error: %s", snd_strerror(err)); + mpxp_err<<"alsa-control_ao: mixer register error: "<<snd_strerror(err)<<std::endl; snd_mixer_close(handle); return MPXP_Error; } if ((err = snd_mixer_load(handle)) < 0) { - MSG_ERR("alsa-control_ao: mixer load error: %s", snd_strerror(err)); + mpxp_err<<"alsa-control_ao: mixer load error: "<<snd_strerror(err)<<std::endl; snd_mixer_close(handle); return MPXP_Error; } elem = snd_mixer_find_selem(handle, sid); if (!elem) { - MSG_ERR("alsa-control_ao: unable to find simple control_ao '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); + mpxp_err<<"alsa-control_ao: unable to find simple control_ao '"<<snd_mixer_selem_id_get_name(sid)<<"',"<<snd_mixer_selem_id_get_index(sid)<<std::endl; snd_mixer_close(handle); return MPXP_Error; } @@ -248,11 +248,11 @@ //setting channels if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(0), set_vol)) < 0) { - MSG_ERR("alsa-control_ao: error setting left channel, %s",snd_strerror(err)); + mpxp_err<<"alsa-control_ao: error setting left channel, "<<snd_strerror(err)<<std::endl; return MPXP_Error; } if ((err = snd_mixer_selem_set_playback_volume(elem, snd_mixer_selem_channel_id_t(1), set_vol)) < 0) { - MSG_ERR("alsa-control_ao: error setting right channel, %s",snd_strerror(err)); + mpxp_err<<"alsa-control_ao: error setting right channel, "<<snd_strerror(err)<<std::endl; return MPXP_Error; } } else { @@ -283,48 +283,47 @@ unsigned rmin,rmax; unsigned j,sdmin,sdmax; char adevice[ALSA_DEVICE_SIZE]; - if ((err = snd_card_next(&cards)) < 0 || cards < 0) - { - MSG_ERR("AO-INFO: alsa-init: no soundcards found: %s\n", snd_strerror(err)); + if ((err = snd_card_next(&cards)) < 0 || cards < 0) { + mpxp_err<<"AO-INFO: alsa-init: no soundcards found: "<<snd_strerror(err)<<std::endl; return; } snd_pcm_info_malloc(&alsa_info); snd_pcm_info_set_device(alsa_info,device); sdmin=snd_pcm_info_get_subdevice(alsa_info); sdmax=sdmin+snd_pcm_info_get_subdevices_count(alsa_info); - MSG_INFO("AO-INFO: show caps for device %i:%i-%i\n",device,sdmin,sdmax); + mpxp_info<<"AO-INFO: show caps for device "<<device<<":"<<sdmin<<"-"<<sdmax<<std::endl; for(j=sdmin;j<=sdmax;j++) { int i; snd_pcm_info_set_subdevice(alsa_info,j); sprintf(adevice,"hw:%u,%u",snd_pcm_info_get_device(alsa_info),snd_pcm_info_get_subdevice(alsa_info)); - MSG_INFO("AO-INFO: %s %s.%s.%s\n\n",adevice,snd_pcm_info_get_id(alsa_info),snd_pcm_info_get_name(alsa_info),snd_pcm_info_get_subdevice_name(alsa_info)); + mpxp_info<<"AO-INFO: "<<adevice<<" "<<snd_pcm_info_get_id(alsa_info)<<"."<<snd_pcm_info_get_name(alsa_info)<<"."<<snd_pcm_info_get_subdevice_name(alsa_info)<<std::endl; if(snd_pcm_open(&pcm,adevice,SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK)<0) { - MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-init: playback open error: "<<snd_strerror(err)<<std::endl; return; } snd_pcm_hw_params_malloc(&hw_params); if(snd_pcm_hw_params_any(pcm, hw_params)<0) { - MSG_ERR("alsa-init: can't get initial parameters: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-init: can't get initial parameters: "<<snd_strerror(err)<<std::endl; return; } - MSG_INFO(" AO-INFO: List of access type: "); + mpxp_info<<" AO-INFO: List of access type: "; for(i=0;i<SND_PCM_ACCESS_LAST;i++) if(!snd_pcm_hw_params_test_access(pcm,hw_params,snd_pcm_access_t(i))) - MSG_INFO("%s ",snd_pcm_access_name(snd_pcm_access_t(i))); - MSG_INFO("\n"); - MSG_INFO(" AO-INFO: List of supported formats: "); + mpxp_info<<snd_pcm_access_name(snd_pcm_access_t(i))<<" "; + mpxp_info<<std::endl; + mpxp_info<<" AO-INFO: List of supported formats: "; for(i=0;i<SND_PCM_FORMAT_LAST;i++) if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) - MSG_INFO("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); - MSG_INFO("\n"); - MSG_INFO(" AO-INFO: List of supported channels: "); + mpxp_info<<snd_pcm_format_name(snd_pcm_format_t(i))<<" "; + mpxp_info<<std::endl; + mpxp_info<<" AO-INFO: List of supported channels: "; for(i=0;i<64;i++) if(!snd_pcm_hw_params_test_format(pcm,hw_params,snd_pcm_format_t(i))) - MSG_INFO("%u ",i); - MSG_INFO("\n"); + mpxp_info<<i<<" "; + mpxp_info<<std::endl; snd_pcm_hw_params_get_rate_min(hw_params,&rmin,&err); snd_pcm_hw_params_get_rate_max(hw_params,&rmax,&err); - MSG_INFO(" AO-INFO: Rates range: %u %u\n",rmin,rmax); + mpxp_info<<" AO-INFO: Rates range: "<<rmin<<" "<<rmax<<std::endl; snd_output_stdio_attach(&sout, stderr, 0); snd_pcm_hw_params_dump(hw_params, sout); if(hw_params) snd_pcm_hw_params_free(hw_params); @@ -351,7 +350,7 @@ handler = NULL; alsa_device[0]='\0'; - MSG_V("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); + mpxp_v<<"alsa-init: compiled for ALSA-"<<SND_LIB_VERSION_STR<<std::endl; if (!subdevice.empty()) { const char *param; @@ -370,12 +369,12 @@ } if(alsa_port) snprintf(alsa_device,sizeof(alsa_device),"%s:%s",alsa_dev,alsa_port); else strncpy(alsa_device,alsa_dev,sizeof(alsa_device)); - MSG_V("alsa-init: soundcard set to %s\n", alsa_device); + mpxp_v<<"alsa-init: soundcard set to "<<alsa_device<<std::endl; } //end parsing ao->subdevice } if ((err = snd_card_next(&cards)) < 0 || cards < 0) { - MSG_ERR("alsa-init: no soundcards found: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-init: no soundcards found: "<<snd_strerror(err)<<std::endl; return MPXP_False; } @@ -383,28 +382,28 @@ int tmp_device, tmp_subdevice; if ((err = snd_pcm_info_malloc(&alsa_info)) < 0) { - MSG_ERR("alsa-init: memory allocation error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-init: memory allocation error: "<<snd_strerror(err)<<std::endl; return MPXP_False; } if ((tmp_device = snd_pcm_info_get_device(alsa_info)) < 0) { - MSG_ERR("alsa-init: cant get device\n"); + mpxp_err<<"alsa-init: cant get device"<<std::endl; return MPXP_False; } if ((tmp_subdevice = snd_pcm_info_get_subdevice(alsa_info)) < 0) { - MSG_ERR("alsa-init: cant get subdevice\n"); + mpxp_err<<"alsa-init: cant get subdevice"<<std::endl; return MPXP_False; } - MSG_V("alsa-init: got device=%i, subdevice=%i\n", tmp_device, tmp_subdevice); + mpxp_v<<"alsa-init: got device="<<tmp_device<<", subdevice="<<tmp_subdevice<<std::endl; if ((err = snprintf(alsa_device, ALSA_DEVICE_SIZE, "hw:%1d,%1d", tmp_device, tmp_subdevice)) <= 0) { - MSG_ERR("alsa-init: cant wrote device-id\n"); + mpxp_err<<"alsa-init: cant wrote device-id"<<std::endl; } snd_pcm_info_free(alsa_info); } - MSG_WARN("alsa-init: Testing & bugs are welcome. Found %d cards, use: %s\n",cards+1,alsa_device); + mpxp_warn<<"alsa-init: Testing & bugs are welcome. Found "<<(cards+1)<<" cards, use: "<<alsa_device<<std::endl; //setting modes for block or nonblock-mode int open_mode,block_mode; if (priv_conf.noblock) { @@ -421,9 +420,9 @@ //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) { if (priv_conf.noblock) { - MSG_ERR("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n"); + mpxp_err<<"alsa-init: open in nonblock-mode failed, trying to open in block-mode"<<std::endl; if ((err = snd_pcm_open(&handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { - MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-init: playback open error: "<<snd_strerror(err)<<std::endl; alsa_device[0]='\0'; return MPXP_False; } else { @@ -431,26 +430,25 @@ str_block_mode = "block-mode"; } } else { - MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-init: playback open error: "<<snd_strerror(err)<<std::endl; alsa_device[0]='\0'; return MPXP_False; } } alsa_device[0]='\0'; if ((err = snd_pcm_nonblock(handler, block_mode)) < 0) { - MSG_ERR("alsa-init: error set block-mode %s\n", snd_strerror(err)); - } else MSG_V("alsa-init: pcm opend in %s\n", str_block_mode); + mpxp_err<<"alsa-init: error set block-mode "<<snd_strerror(err)<<std::endl; + } else mpxp_v<<"alsa-init: pcm opend in "<<str_block_mode<<std::endl; snd_pcm_hw_params_malloc(&hwparams); snd_pcm_sw_params_malloc(&swparams); // setting hw-parameters if ((err = snd_pcm_hw_params_any(handler, hwparams)) < 0) { - MSG_ERR("alsa-init: unable to get initial parameters: %s\n", - snd_strerror(err)); + mpxp_err<<"alsa-init: unable to get initial parameters: "<<snd_strerror(err)<<std::endl; return MPXP_False; } - MSG_DBG2("snd_pcm_hw_params_any()\n"); + mpxp_dbg2<<"snd_pcm_hw_params_any()"<<std::endl; if (priv_conf.mmap) { snd_pcm_access_mask_t *mask = (snd_pcm_access_mask_t*)alloca(snd_pcm_access_mask_sizeof()); snd_pcm_access_mask_none(mask); @@ -458,13 +456,13 @@ snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); err = snd_pcm_hw_params_set_access_mask(handler, hwparams, mask); - MSG_ERR("alsa-init: mmap set\n"); + mpxp_err<<"alsa-init: mmap set"<<std::endl; } else { err = snd_pcm_hw_params_set_access(handler, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED); - MSG_DBG2("snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED)\n"); + mpxp_dbg2<<"snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED)"<<std::endl; } if (err < 0) { - MSG_ERR("alsa-init: unable to set access type: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-init: unable to set access type: "<<snd_strerror(err)<<std::endl; return MPXP_False; } } // end switch priv->handler (spdif) @@ -476,8 +474,7 @@ size_t chunk_size=0,chunk_bytes,bits_per_sample,bits_per_frame; snd_pcm_uframes_t dummy; - MSG_V("alsa-conf: requested format: %d Hz, %d channels, %s\n", r, - c, ao_format_name(f)); + mpxp_v<<"alsa-conf: requested format: "<<r<<" Hz, "<<c<<" channels, "<<ao_format_name(f)<<std::endl; _samplerate = r; _format = f; @@ -504,8 +501,7 @@ case SND_PCM_FORMAT_U24_BE: break; case -1: - MSG_ERR("alsa-conf: invalid format (%s) requested - output disabled\n", - ao_format_name(_format)); + mpxp_err<<"alsa-conf: invalid format ("<<ao_format_name(_format)<<") requested - output disabled"<<std::endl; return MPXP_False; default: break; @@ -514,55 +510,47 @@ if ((err = snd_pcm_hw_params_set_format(handler, hwparams, snd_format)) < 0) { - MSG_ERR("alsa-conf: unable to set format(%s): %s\n", - snd_pcm_format_name(snd_format), - snd_strerror(err)); - MSG_HINT("Please try one of: "); + mpxp_err<<"alsa-conf: unable to set format("<<snd_pcm_format_name(snd_format)<<"): "<<snd_strerror(err)<<std::endl; + mpxp_hint<<"Please try one of: "; for(i=0;i<SND_PCM_FORMAT_LAST;i++) if (!(snd_pcm_hw_params_test_format(handler, hwparams, snd_pcm_format_t(i)))) - MSG_HINT("%s ",snd_pcm_format_name(snd_pcm_format_t(i))); - MSG_HINT("\n"); + mpxp_hint<<snd_pcm_format_name(snd_pcm_format_t(i))<<" "; + mpxp_hint<<std::endl; return MPXP_False; } - MSG_DBG2("snd_pcm_hw_params_set_format(%i)\n",snd_format); + mpxp_dbg2<<"snd_pcm_hw_params_set_format("<<snd_format<<")"<<std::endl; if ((err = snd_pcm_hw_params_set_rate_near(handler, hwparams, &_samplerate, 0)) < 0) { - MSG_ERR("alsa-conf: unable to set samplerate %u: %s\n", - _samplerate, - snd_strerror(err)); + mpxp_err<<"alsa-conf: unable to set samplerate "<<_samplerate<<": "<<snd_strerror(err)<<std::endl; return MPXP_False; } - MSG_DBG2("snd_pcm_hw_params_set_rate_near(%i)\n",_samplerate); + mpxp_dbg2<<"snd_pcm_hw_params_set_rate_near("<<_samplerate<<")"<<std::endl; if ((err = snd_pcm_hw_params_set_channels(handler, hwparams, _channels)) < 0) { - MSG_ERR("alsa-conf: unable to set %u channels: %s\n", - _channels, - snd_strerror(err)); + mpxp_err<<"alsa-conf: unable to set "<<_channels<<" channels: "<<snd_strerror(err)<<std::endl; return MPXP_False; } - MSG_DBG2("snd_pcm_hw_params_set_channels(%i)\n",_channels); + mpxp_dbg2<<"snd_pcm_hw_params_set_channels("<<_channels<<")"<<std::endl; #ifdef BUFFERTIME { int dir; unsigned period_time,alsa_buffer_time = 500000; /* buffer time in us */ if ((err = snd_pcm_hw_params_set_buffer_time_near(handler, hwparams, &alsa_buffer_time, &dir)) < 0) { - MSG_ERR("alsa-init: unable to set buffer time near: %s\n", - snd_strerror(err)); + mpxp_err<<"alsa-init: unable to set buffer time near: "<<snd_strerror(err)<<std::endl; return MPXP_False; } - MSG_DBG2("snd_pcm_hw_set_buffer_time_near(%i)\n",alsa_buffer_time); + mpxp_dbg2<<"snd_pcm_hw_set_buffer_time_near("<<alsa_buffer_time<<")"<<std::endl; period_time = alsa_buffer_time/4; if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { /* original: alsa_buffer_time/ao->bps */ - MSG_ERR("alsa-init: unable to set period time: %s\n", - snd_strerror(err)); + mpxp_err<<"alsa-init: unable to set period time: "<<snd_strerror(err)<<std::endl; return MPXP_False; } - MSG_DBG2("snd_pcm_hw_set_period_time_near(%i)\n",period_time); - MSG_V("alsa-init: buffer_time: %d, period_time :%d\n",alsa_buffer_time, period_time); + mpxp_dbg2<<"snd_pcm_hw_set_period_time_near("<<period_time<<")"<<std::endl; + mpxp_v<<"alsa-init: buffer_time: "<<alsa_buffer_time<<", period_time :"<<period_time<<std::endl; } #else { @@ -570,72 +558,70 @@ unsigned period_time=100000; /* period time in us */ snd_pcm_uframes_t size; if ((err = snd_pcm_hw_params_set_period_time_near(handler, hwparams, &period_time, &dir)) < 0) { - MSG_ERR("alsa-init: unable to set period_time: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-init: unable to set period_time: "<<snd_strerror(err)<<std::endl; return MPXP_False; } - MSG_DBG2("snd_pcm_hw_set_period_time(%i)\n",period_time); + mpxp_dbg2<<"snd_pcm_hw_set_period_time("<<period_time<<")"<<std::endl; //get chunksize if ((err = snd_pcm_hw_params_get_period_size(hwparams, &size, &dir)) < 0) { - MSG_ERR("alsa-init: unable to get period_size: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-init: unable to get period_size: "<<snd_strerror(err)<<std::endl; return MPXP_False; } - MSG_DBG2("snd_pcm_hw_get_period_size(%i)\n",size); + mpxp_dbg2<<"snd_pcm_hw_get_period_size("<<size<<")"<<std::endl; chunk_size=size; } #endif // gets buffersize for control_ao if ((err = snd_pcm_hw_params_get_buffer_size(hwparams,&dummy)) < 0) { - MSG_ERR("alsa-conf: unable to get buffersize: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-conf: unable to get buffersize: "<<snd_strerror(err)<<std::endl; return MPXP_False; } else { _buffersize = dummy * bytes_per_sample; - MSG_V("alsa-conf: got buffersize=%i\n", _buffersize); + mpxp_v<<"alsa-conf: got buffersize="<<_buffersize<<std::endl; } - MSG_DBG2("snd_pcm_hw_params_get_buffer_size(%i)\n",dummy); + mpxp_dbg2<<"snd_pcm_hw_params_get_buffer_size("<<dummy<<")"<<std::endl; bits_per_sample = snd_pcm_format_physical_width(snd_format); - MSG_DBG2("%i=snd_pcm_hw_format_pohysical_width()\n",bits_per_sample); + mpxp_dbg2<<bits_per_sample<<"=snd_pcm_hw_format_pohysical_width()"<<std::endl; bits_per_frame = bits_per_sample * _channels; chunk_bytes = chunk_size * bits_per_frame / 8; - MSG_V("alsa-conf: bits per sample (bps)=%i, bits per frame (bpf)=%i, chunk_bytes=%i\n",bits_per_sample,bits_per_frame,chunk_bytes); + mpxp_v<<"alsa-conf: bits per sample (bps)="<<bits_per_sample<<", bits per frame (bpf)="<<bits_per_frame<<", chunk_bytes="<<chunk_bytes<<std::endl; /* finally install hardware parameters */ if ((err = snd_pcm_hw_params(handler, hwparams)) < 0) { - MSG_ERR("alsa-conf: unable to set hw-parameters: %s\n", - snd_strerror(err)); + mpxp_err<<"alsa-conf: unable to set hw-parameters: "<<snd_strerror(err)<<std::endl; return MPXP_False; } - MSG_DBG2("snd_pcm_hw_params()\n"); + mpxp_dbg2<<"snd_pcm_hw_params()"<<std::endl; // setting sw-params (only avail-min) if noblocking mode was choosed if (priv_conf.noblock) { if ((err = snd_pcm_sw_params_current(handler, swparams)) < 0) { - MSG_ERR("alsa-conf: unable to get parameters: %s\n",snd_strerror(err)); + mpxp_err<<"alsa-conf: unable to get parameters: "<<snd_strerror(err)<<std::endl; return MPXP_False; } //set min available frames to consider pcm ready (4) //increased for nonblock-mode should be set dynamically later if ((err = snd_pcm_sw_params_set_avail_min(handler, swparams, 4)) < 0) { - MSG_ERR("alsa-conf: unable to set avail_min %s\n",snd_strerror(err)); + mpxp_err<<"alsa-conf: unable to set avail_min "<<snd_strerror(err)<<std::endl; return MPXP_False; } if ((err = snd_pcm_sw_params(handler, swparams)) < 0) { - MSG_ERR("alsa-conf: unable to install sw-params\n"); + mpxp_err<<"alsa-conf: unable to install sw-params"<<std::endl; return MPXP_False; } }//end swparams if ((err = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-conf: pcm prepare error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-conf: pcm prepare error: "<<snd_strerror(err)<<std::endl; return MPXP_False; } // end setting hw-params - MSG_V("alsa-conf: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n", - _samplerate, _channels, bytes_per_sample, _buffersize, - snd_pcm_format_description(snd_format)); + mpxp_v<<"alsa-conf: "<<_samplerate<<" Hz/"<<_channels<<" channels/" + <<bytes_per_sample<<" bpf/"<<_buffersize<<" bytes buffer/"<<snd_pcm_format_description(snd_format)<<std::endl; return MPXP_Ok; } // end config_ao @@ -645,11 +631,11 @@ if (!priv_conf.noblock) { //drain causes error in nonblock-mode! if ((err = snd_pcm_drain(handler)) < 0) { - MSG_ERR("alsa-pause: pcm drain error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-pause: pcm drain error: "<<snd_strerror(err)<<std::endl; return; } } else { - MSG_V("alsa-pause: paused nonblock\n"); + mpxp_v<<"alsa-pause: paused nonblock"<<std::endl; return; } } @@ -658,7 +644,7 @@ int err; if ((err = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-resume: pcm prepare error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-resume: pcm prepare error: "<<snd_strerror(err)<<std::endl; return; } } @@ -668,11 +654,11 @@ int err; if ((err = snd_pcm_drop(handler)) < 0) { - MSG_ERR("alsa-reset: pcm drop error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-reset: pcm drop error: "<<snd_strerror(err)<<std::endl; return; } if ((err = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-reset: pcm prepare error: %s\n", snd_strerror(err)); + mpxp_err<<"alsa-reset: pcm prepare error: "<<snd_strerror(err)<<std::endl; return; } return; @@ -709,7 +695,7 @@ snd_pcm_status_alloca(&status); if ((err = snd_pcm_status(handler, status))<0) { - MSG_ERR("status error: %s", snd_strerror(err)); + mpxp_err<<"status error: "<<snd_strerror(err)<<std::endl; return 0; } @@ -718,13 +704,11 @@ gettimeofday(&now, 0); snd_pcm_status_get_trigger_tstamp(status, &tstamp); _timersub(&now, &tstamp, &diff); - MSG_V("alsa-%s: xrun of at least %.3f msecs. resetting stream\n", - str_mode, - diff.tv_sec * 1000 + diff.tv_usec / 1000.0); + mpxp_v<<"alsa-"<<str_mode<<": xrun of at least "<<(diff.tv_sec*1000+diff.tv_usec/1000.0)<<" msecs. resetting stream"<<std::endl; } if ((err = snd_pcm_prepare(handler))<0) { - MSG_ERR("xrun: prepare error: %s", snd_strerror(err)); + mpxp_err<<"xrun: prepare error: "<<snd_strerror(err)<<std::endl; return 0; } @@ -734,7 +718,7 @@ unsigned Alsa_AO_Interface::play(const any_t* data, unsigned len, unsigned flags) { unsigned result; UNUSED(flags); - MSG_DBG2("[ao_alsa] %s playing %i bytes\n",priv_conf.mmap?"mmap":"normal",len); + mpxp_dbg2<<"[ao_alsa] "<<(priv_conf.mmap?"mmap":"normal")<<" playing "<<len<<" bytes"<<std::endl; if (priv_conf.mmap) result = play_mmap(data, len); else result = play_normal(data, len); return result; @@ -755,7 +739,7 @@ //fprintf(stderr,"alsa-play: frames=%i, len=%i\n",num_frames,len); if (!handler) { - MSG_ERR("alsa-play: device configuration error"); + mpxp_err<<"alsa-play: device configuration error"<<std::endl; return 0; } @@ -765,16 +749,16 @@ snd_pcm_wait(handler, 1000); } else if (res == -EPIPE) { /* underrun */ if (xrun("play") <= 0) { - MSG_ERR("alsa-play: xrun reset error"); + mpxp_err<<"alsa-play: xrun reset error"<<std::endl; return 0; } } else if (res == -ESTRPIPE) { /* suspend */ - MSG_WARN("alsa-play: pcm in suspend mode. trying to resume\n"); + mpxp_warn<<"alsa-play: pcm in suspend mode. trying to resume"<<std::endl; while ((res = snd_pcm_resume(handler)) == -EAGAIN) ::sleep(1); } else if (res < 0) { - MSG_ERR("alsa-play: unknown status, trying to reset soundcard\n"); + mpxp_err<<"alsa-play: unknown status, trying to reset soundcard"<<std::endl; if ((res = snd_pcm_prepare(handler)) < 0) { - MSG_ERR("alsa-play: snd prepare error"); + mpxp_err<<"alsa-play: snd prepare error"<<std::endl; return 0; break; } @@ -788,7 +772,7 @@ } //end while if (res < 0) { - MSG_ERR("alsa-play: write error %s", snd_strerror(res)); + mpxp_err<<"alsa-play: write error "<<snd_strerror(res)<<std::endl; return 0; } return res < 0 ? 0 : len; @@ -897,12 +881,12 @@ //snd_pcm_sframes_t avail_frames = 0; if ((ret = snd_pcm_status_malloc(&status)) < 0) { - MSG_ERR("alsa-space: memory allocation error: %s\n", snd_strerror(ret)); + mpxp_err<<"alsa-space: memory allocation error: "<<snd_strerror(ret)<<std::endl; return 0; } if ((ret = snd_pcm_status(handler, status)) < 0) { - MSG_ERR("alsa-space: cannot get pcm status: %s\n", snd_strerror(ret)); + mpxp_err<<"alsa-space: cannot get pcm status: "<<snd_strerror(ret)<<std::endl; return 0; } @@ -925,7 +909,7 @@ e_status = GET_SPACE_RUNNING; break; case SND_PCM_STATE_PAUSED: - MSG_V("alsa-space: paused"); + mpxp_v<<"alsa-space: paused"<<std::endl; e_status = GET_SPACE_PAUSED; ret = 0; break; @@ -944,11 +928,11 @@ } if (e_status!=GET_SPACE_RUNNING) - MSG_V("alsa-space: mp_free space = %i, status=%i, %i --\n", ret, st, e_status); + mpxp_v<<"alsa-space: mp_free space = "<<ret<<", status="<<st<<", "<<e_status<<" --"<<std::endl; snd_pcm_status_free(status); if (ret < 0) { - MSG_ERR("negative value!!\n"); + mpxp_err<<"negative value!!"<<std::endl; ret = 0; } @@ -964,12 +948,12 @@ float ret; if ((ret = snd_pcm_status_malloc(&status)) < 0) { - MSG_ERR("alsa-delay: memory allocation error: %s\n", snd_strerror(ret)); + mpxp_err<<"alsa-delay: memory allocation error: "<<snd_strerror(ret)<<std::endl; return 0; } if ((ret = snd_pcm_status(handler, status)) < 0) { - MSG_ERR("alsa-delay: cannot get pcm status: %s\n", snd_strerror(ret)); + mpxp_err<<"alsa-delay: cannot get pcm status: "<<snd_strerror(ret)<<std::endl; return 0; } Modified: mplayerxp/libao3/ao_arts.cpp =================================================================== --- mplayerxp/libao3/ao_arts.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_arts.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -86,11 +86,11 @@ UNUSED(flags); if( (err=arts_init()) ) { - MSG_ERR("[aRts] init failed: %s\n", arts_error_text(err)); + mpxp_err<<"[aRts] init failed: "<<arts_error_text(err)<<std::endl; /*TODO: system("artsd -l0");*/ return MPXP_False; } - MSG_INFO("[aRts] connected to server\n"); + mpxp_info<<"[aRts] connected to server"<<std::endl; return MPXP_Ok; } @@ -138,7 +138,7 @@ stream=arts_play_stream(_samplerate, samplesize*8, _channels, "MPlayerXP"); if(stream == NULL) { - MSG_ERR("[aRts] Can't open stream\n"); + mpxp_err<<"[aRts] Can't open stream"<<std::endl; arts_free(); return MPXP_False; } @@ -149,10 +149,10 @@ frag_spec = ARTS_PACKET_SIZE_LOG2 | ARTS_PACKETS << 16; arts_stream_set(stream, ARTS_P_PACKET_SETTINGS, frag_spec); _buffersize = arts_stream_get(stream, ARTS_P_BUFFER_SIZE); - MSG_INFO("[aRts] Stream opened\n"); + mpxp_info<<"[aRts] Stream opened"<<std::endl; - MSG_V("[aRts] buffersize=%u\n",_buffersize); - MSG_V("[aRts] buffersize=%u\n", arts_stream_get(stream, ARTS_P_PACKET_SIZE)); + mpxp_v<<"[aRts] buffersize="<<_buffersize<<std::endl; + mpxp_v<<"[aRts] buffersize="<<arts_stream_get(stream, ARTS_P_PACKET_SIZE)<<std::endl; return MPXP_Ok; } Modified: mplayerxp/libao3/ao_esd.cpp =================================================================== --- mplayerxp/libao3/ao_esd.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_esd.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -200,7 +200,7 @@ if (fd < 0) { fd = esd_open_sound(subdevice.c_str()); if (fd < 0) { - MSG_ERR("ESD: Can't open sound: %s\n", strerror(errno)); + mpxp_err<<"ESD: Can't open sound: "<<strerror(errno)<<std::endl; return MPXP_False; } } @@ -279,13 +279,13 @@ lag_serv = (latency * 4.0f) / (_bytes_per_sample * _samplerate); lag_seconds = lag_net + lag_serv; audio_delay += lag_seconds; - MSG_INFO("ESD: LatencyInfo: %f %f %f\n",lag_serv, lag_net, lag_seconds); + mpxp_info<<"ESD: LatencyInfo: "<<lag_serv<<" "<<lag_net<<" "<<lag_seconds<<std::endl; } play_fd = esd_play_stream_fallback(esd_fmt, _samplerate, server.c_str(), ESD_CLIENT_NAME); if (play_fd < 0) { - MSG_ERR("ESD: Can't open play stream: %s\n", strerror(errno)); + mpxp_err<<"ESD: Can't open play stream: "<<strerror(errno)<<std::endl; return MPXP_False; } Modified: mplayerxp/libao3/ao_jack.cpp =================================================================== --- mplayerxp/libao3/ao_jack.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_jack.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -231,7 +231,7 @@ UNUSED(f); if (c > MAX_CHANS) { - MSG_FATAL("[JACK] Invalid number of channels: %i\n", c); + mpxp_fatal<<"[JACK] Invalid number of channels: "<<c<<std::endl; goto err_out; } if (!client_name) { @@ -241,7 +241,7 @@ if (!autostart) open_options = jack_options_t(open_options|JackNoStartServer); client = jack_client_open(client_name, open_options, NULL); if (!client) { - MSG_FATAL("[JACK] cannot open server\n"); + mpxp_fatal<<"[JACK] cannot open server"<<std::endl; goto err_out; } buffer = av_fifo_alloc(BUFFSIZE); @@ -251,7 +251,7 @@ if (!port_name) port_flags |= JackPortIsPhysical; matching_ports = jack_get_ports(client, subdevice.c_str(), NULL, port_flags); if (!matching_ports || !matching_ports[0]) { - MSG_FATAL("[JACK] no physical priv->ports available\n"); + mpxp_fatal<<"[JACK] no physical priv->ports available"<<std::endl; goto err_out; } i = 1; @@ -265,17 +265,17 @@ snprintf(pname, 30, "out_%d", i); ports[i] = jack_port_register(client, pname, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); if (!ports[i]) { - MSG_FATAL("[JACK] not enough priv->ports available\n"); + mpxp_fatal<<"[JACK] not enough priv->ports available"<<std::endl; goto err_out; } } if (jack_activate(client)) { - MSG_FATAL("[JACK] activate failed\n"); + mpxp_fatal<<"[JACK] activate failed"<<std::endl; goto err_out; } for (i = 0; i < num_ports; i++) { if (jack_connect(client, jack_port_name(ports[i]), matching_ports[i])) { - MSG_FATAL( "[JACK] connecting failed\n"); + mpxp_fatal<<"[JACK] connecting failed"<<std::endl; goto err_out; } } Modified: mplayerxp/libao3/ao_msg.h =================================================================== --- mplayerxp/libao3/ao_msg.h 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_msg.h 2012-12-21 15:12:47 UTC (rev 593) @@ -1,7 +1,6 @@ #ifndef AO_MSG_H #define AO_MSG_H -#define MSGT_CLASS MSGT_AO #include "mpxp_msg.h" namespace mpxp { Modified: mplayerxp/libao3/ao_nas.cpp =================================================================== --- mplayerxp/libao3/ao_nas.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_nas.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -165,7 +165,7 @@ pthread_create(&event_thread, NULL, &nas_event_thread_start, this); } Nas_AO_Interface::~Nas_AO_Interface() { - MSG_DBG3("ao_nas: uninit()\n"); + mpxp_dbg3<<"ao_nas: uninit()"<<std::endl; expect_underrun = 1; while (state != AuStateStop) yield_timeslice(); @@ -200,20 +200,17 @@ void Nas_AO_Interface::nas_print_error(const char *prefix, AuStatus as) const { char s[100]; AuGetErrorText(aud, as, s, 100); - MSG_ERR("ao_nas: %s: returned status %d (%s)\n", prefix, as, s); + mpxp_err<<"ao_nas: "<<prefix<<": returned status "<<as<<" ("<<s<<")"<<std::endl; } int Nas_AO_Interface::nas_readBuffer(unsigned int num) { AuStatus as; pthread_mutex_lock(&buffer_mutex); - MSG_DBG2("ao_nas: nas_readBuffer(): num=%d client=%d/%d server=%d/%d\n", - num, - client_buffer_used, client_buffer_size, - server_buffer_used, server_buffer_size); + mpxp_dbg2<<"ao_nas: nas_readBuffer(): num="<<num<<" client="<<client_buffer_used<<"/"<<client_buffer_size<<" server="<<server_buffer_used<<"/"<<server_buffer_size<<std::endl; if (client_buffer_used == 0) { - MSG_DBG2("ao_nas: buffer is empty, nothing read.\n"); + mpxp_dbg2<<"ao_nas: buffer is empty, nothing read."<<std::endl; pthread_mutex_unlock(&buffer_mutex); return 0; } @@ -252,9 +249,7 @@ int Nas_AO_Interface::nas_writeBuffer(const any_t*data, unsigned int len) { pthread_mutex_lock(&buffer_mutex); - MSG_DBG2("ao_nas: nas_writeBuffer(): len=%d client=%d/%d server=%d/%d\n", - len, client_buffer_used, client_buffer_size, - server_buffer_used, server_buffer_size); + mpxp_dbg2<<"ao_nas: nas_writeBuffer(): len="<<len<<" client="<<client_buffer_used<<"/"<<client_buffer_size<<" server="<<server_buffer_used<<"/%d"<<server_buffer_size<<std::endl; /* make sure we don't overflow the buffer */ if (len > client_buffer_size - client_buffer_used) @@ -283,9 +278,7 @@ any_t* Nas_AO_Interface::nas_event_thread_start(any_t*data) { Nas_AO_Interface& _this=*reinterpret_cast<Nas_AO_Interface*>(data); do { - MSG_DBG2( - "ao_nas: event thread heartbeat (state=%s)\n", - _this.nas_state(_this.state)); + mpxp_dbg2<<"ao_nas: event thread heartbeat (state="<<_this.nas_state(_this.state)<<")"<<std::endl; _this.nas_empty_event_queue(); yield_timeslice(); } while (!_this.stop_thread); @@ -295,14 +288,10 @@ static AuBool nas_error_handler_callback(AuServer* aud,AuErrorEvent* ev) { char s[100]; AuGetErrorText(aud, ev->error_code, s, 100); - MSG_ERR( "ao_nas: error [%s]\n" - "error_code: %d\n" - "request_code: %d\n" - "minor_code: %d\n", - s, - ev->error_code, - ev->request_code, - ev->minor_code); + mpxp_err<<"ao_nas: error ["<<s<<"]"<<std::endl; + mpxp_err<<"error_code: "<<ev->error_code<<std::endl; + mpxp_err<<"request_code: "<<ev->request_code<<std::endl; + mpxp_err<<"minor_code: "<<ev->minor_code<<std::endl; return AuTrue; } @@ -311,16 +300,13 @@ AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev; Nas_AO_Interface& _this = *reinterpret_cast<Nas_AO_Interface*>(hnd->data); - MSG_DBG2("ao_nas: event_handler(): type %s kind %s state %s->%s reason %s numbytes %d expect_underrun %d\n", - _this.nas_event_type(event->type), - _this.nas_elementnotify_kind(event->kind), - _this.nas_state(event->prev_state), - _this.nas_state(event->cur_state), - _this.nas_reason(event->reason), - (int)event->num_bytes, - _this.expect_underrun); + mpxp_dbg2<<"ao_nas: event_handler(): type "<<_this.nas_event_type(event->type) + <<" kind "<<_this.nas_elementnotify_kind(event->kind) + <<" state "<<_this.nas_state(event->prev_state)<<"->"<<_this.nas_state(event->cur_state) + <<" reason "<<_this.nas_reason(event->reason) + <<" numbytes "<<event->num_bytes<<" expect_underrun"<<_this.expect_underrun<<std::endl; if (event->num_bytes > INT_MAX) { - MSG_ERR( "ao_nas: num_bytes > 2GB, server buggy?\n"); + mpxp_err<<"ao_nas: num_bytes > 2GB, server buggy?"<<std::endl; } if (event->num_bytes > _this.server_buffer_used) @@ -338,20 +324,20 @@ _this.expect_underrun = 0; } else { static int hint = 1; - MSG_WARN("ao_nas: Buffer underrun.\n"); + mpxp_warn<<"ao_nas: Buffer underrun."<<std::endl; if (hint) { hint = 0; - MSG_HINT("Possible reasons are:\n" - "1) Network congestion.\n" - "2) Your NAS server is too slow.\n" - "Try renicing your nasd to e.g. -15.\n"); + mpxp_hint<<"Possible reasons are:"<<std::endl + <<"1) Network congestion."<<std::endl + <<"2) Your NAS server is too slow."<<std::endl + <<"Try renicing your nasd to e.g. -15."<<std::endl; } } if (_this.nas_readBuffer(_this.server_buffer_size - _this.server_buffer_used) != 0) { event->cur_state = AuStateStart; break; } - MSG_DBG2("ao_nas: Can't refill buffer, stopping flow.\n"); + mpxp_dbg2<<"ao_nas: Can't refill buffer, stopping flow."<<std::endl; AuStopFlow(_this.aud, _this.flow, NULL); break; default: @@ -409,7 +395,7 @@ case AOCONTROL_GET_VOLUME: vol->right = (float)gain/AU_FIXED_POINT_SCALE*50; vol->left = vol->right; - MSG_DBG2( "ao_nas: AOCONTROL_GET_VOLUME: %.2f\n", vol->right); + mpxp_dbg2<<"ao_nas: AOCONTROL_GET_VOLUME: "<<vol->right<<std::endl; retval = MPXP_Ok; break; case AOCONTROL_SET_VOLUME: @@ -419,7 +405,7 @@ * so i take the mean of both values. */ g = AU_FIXED_POINT_SCALE*((vol->left+vol->right)/2)/50; - MSG_DBG2( "ao_nas: AOCONTROL_SET_VOLUME: %.2f\n", (vol->left+vol->right)/2); + mpxp_dbg2<<"ao_nas: AOCONTROL_SET_VOLUME: "<<((vol->left+vol->right)/2)<<std::endl; aep.parameters[AuParmsMultiplyConstantConstant]=g; aep.flow = flow; @@ -457,7 +443,7 @@ _outburst = NAS_FRAG_SIZE; buffer_size = bps(); /* buffer 1 second */ - MSG_V("ao3: %d Hz %d chans %s\n",r,c,afmt2str(f)); + mpxp_v<<"ao3: "<<r<<" Hz "<<c<<" chans "<<afmt2str(f)<<std::endl; /* * round up to multiple of NAS_FRAG_SIZE @@ -472,21 +458,21 @@ server_buffer = new char [server_buffer_size]; if (!bytes_per_sample) { - MSG_ERR("ao_nas: init(): Zero bytes per sample -> nosound\n"); + mpxp_err<<"ao_nas: init(): Zero bytes per sample -> nosound"<<std::endl; return MPXP_False; } if (!(server = ::getenv("AUDIOSERVER")) && !(server = ::getenv("DISPLAY"))) { - MSG_ERR("ao_nas: init(): AUDIOSERVER environment variable not set -> nosound\n"); + mpxp_err<<"ao_nas: init(): AUDIOSERVER environment variable not set -> nosound"<<std::endl; return MPXP_False; } - MSG_V("ao_nas: init(): Using audioserver %s\n", server); + mpxp_v<<"ao_nas: init(): Using audioserver "<<server<<std::endl; aud = AuOpenServer(server, 0, NULL, 0, NULL, NULL); if (!aud) { - MSG_ERR("ao_nas: init(): Can't open nas audio server -> nosound\n"); + mpxp_err<<"ao_nas: init(): Can't open nas audio server -> nosound"<<std::endl; return MPXP_False; } @@ -499,7 +485,7 @@ } if (flow == 0) { - MSG_ERR("ao_nas: init(): Can't find a suitable output device -> nosound\n"); + mpxp_err<<"ao_nas: init(): Can't find a suitable output device -> nosound"<<std::endl; AuCloseServer(aud); aud = 0; return MPXP_False; @@ -535,7 +521,7 @@ void Nas_AO_Interface::reset() { AuStatus as; - MSG_DBG3("ao_nas: reset()\n"); + mpxp_dbg3<<"ao_nas: reset()"<<std::endl; pthread_mutex_lock(&buffer_mutex); client_buffer_used = 0; @@ -551,7 +537,7 @@ // stop playing, keep buffers (for pause) void Nas_AO_Interface::pause() { AuStatus as; - MSG_DBG3("ao_nas: audio_pause()\n"); + mpxp_dbg3<<"ao_nas: audio_pause()"<<std::endl; AuStopFlow(aud, flow, &as); } @@ -561,7 +547,7 @@ { AuStatus as; - MSG_DBG3("ao_nas: audio_resume()\n"); + mpxp_dbg3<<"ao_nas: audio_resume()"<<std::endl; AuStartFlow(aud, flow, &as); if (as != AuSuccess) nas_print_error("play(): AuStartFlow", as); @@ -573,7 +559,7 @@ { unsigned result; - MSG_DBG3("ao_nas: get_space()\n"); + mpxp_dbg3<<"ao_nas: get_space()"<<std::endl; pthread_mutex_lock(&buffer_mutex); result = client_buffer_size - client_buffer_used; @@ -589,7 +575,7 @@ unsigned written, maxbursts = 0, playbursts = 0; AuStatus as; UNUSED(flags); - MSG_DBG3("ao_nas: play(%p, %d, %d)\n", data, len, flags); + mpxp_dbg3<<"ao_nas: play("<<data<<", "<<len<<", "<<flags<<")"<<std::endl; if (len == 0) return 0; /* @@ -602,7 +588,7 @@ if (state != AuStateStart && (maxbursts == playbursts /*|| flags & AOPLAY_FINAL_CHUNK*/)) { - MSG_DBG2("ao_nas: play(): Starting flow.\n"); + mpxp_dbg2<<"ao_nas: play(): Starting flow."<<std::endl; expect_underrun = 1; AuStartFlow(aud, flow, &as); if (as != AuSuccess) nas_print_error("play(): AuStartFlow", as); @@ -614,7 +600,7 @@ float Nas_AO_Interface::get_delay() { float result; - MSG_DBG3( "ao_nas: get_delay()\n"); + mpxp_dbg3<<"ao_nas: get_delay()"<<std::endl; pthread_mutex_lock(&buffer_mutex); result = ((float)(client_buffer_used + server_buffer_used)) / (float)bps(); Modified: mplayerxp/libao3/ao_null.cpp =================================================================== --- mplayerxp/libao3/ao_null.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_null.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -224,7 +224,7 @@ buffer += bursts * _outburst; UNUSED(flags); if(fd && len) { - MSG_DBG2("writing %u bytes into file\n",len); + mpxp_dbg2<<"writing "<<len<<" bytes into file"<<std::endl; ::fwrite(data,len,1,fd); wavhdr.data_length += len; } Modified: mplayerxp/libao3/ao_openal.cpp =================================================================== --- mplayerxp/libao3/ao_openal.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_openal.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -120,7 +120,7 @@ UNUSED(flags); alc_dev = alcOpenDevice(NULL); if (!alc_dev) { - MSG_ERR("[OpenAL] could not open device\n"); + mpxp_err<<"[OpenAL] could not open device"<<std::endl; return MPXP_False; } return MPXP_Ok; @@ -142,7 +142,7 @@ unsigned i; _format=f; if (c > MAX_CHANS) { - MSG_ERR("[OpenAL] Invalid number of channels: %i\n", c); + mpxp_err<<"[OpenAL] Invalid number of channels: "<<c<<std::endl; goto err_out; } ctx = alcCreateContext(alc_dev, attribs); Modified: mplayerxp/libao3/ao_oss.cpp =================================================================== --- mplayerxp/libao3/ao_oss.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_oss.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -108,28 +108,28 @@ int rval; rval=0; if (::ioctl (fd, SNDCTL_DSP_GETFMTS, &rval) != -1) { - MSG_INFO("AO-INFO: List of supported formats: "); - if(rval & AFMT_MU_LAW) MSG_INFO("AFMT_MU_LAW "); - if(rval & AFMT_A_LAW) MSG_INFO("AFMT_A_LAW "); - if(rval & AFMT_IMA_ADPCM) MSG_INFO("AFMT_IMA_ADPCM "); - if(rval & AFMT_U8) MSG_INFO("AFMT_U8 "); - if(rval & AFMT_S16_LE) MSG_INFO("AFMT_S16_LE "); - if(rval & AFMT_S16_BE) MSG_INFO("AFMT_S16_BE "); - if(rval & AFMT_S8) MSG_INFO("AFMT_S8 "); - if(rval & AFMT_U16_LE) MSG_INFO("AFMT_U16_LE "); + mpxp_info<<"AO-INFO: List of supported formats: "; + if(rval & AFMT_MU_LAW) mpxp_info<<"AFMT_MU_LAW "; + if(rval & AFMT_A_LAW) mpxp_info<<"AFMT_A_LAW "; + if(rval & AFMT_IMA_ADPCM) mpxp_info<<"AFMT_IMA_ADPCM "; + if(rval & AFMT_U8) mpxp_info<<"AFMT_U8 "; + if(rval & AFMT_S16_LE) mpxp_info<<"AFMT_S16_LE "; + if(rval & AFMT_S16_BE) mpxp_info<<"AFMT_S16_BE "; + if(rval & AFMT_S8) mpxp_info<<"AFMT_S8 "; + if(rval & AFMT_U16_LE) mpxp_info<<"AFMT_U16_LE "; - if(rval & AFMT_U16_BE) MSG_INFO("AFMT_U16_BE "); - if(rval & AFMT_MPEG) MSG_INFO("AFMT_MPEG "); - if(rval & AFMT_AC3) MSG_INFO("AFMT_AC3 "); - if(rval & AFMT_S24_LE) MSG_INFO("AFMT_S24_LE "); - if(rval & AFMT_S24_BE) MSG_INFO("AFMT_S24_BE "); - if(rval & AFMT_U24_LE) MSG_INFO("AFMT_U24_LE "); - if(rval & AFMT_U24_BE) MSG_INFO("AFMT_U24_LE "); - if(rval & AFMT_S32_LE) MSG_INFO("AFMT_S32_LE "); - if(rval & AFMT_S32_BE) MSG_INFO("AFMT_S32_BE "); - if(rval & AFMT_U32_LE) MSG_INFO("AFMT_U32_LE "); - if(rval & AFMT_U32_BE) MSG_INFO("AFMT_U32_LE "); - MSG_INFO("\n"); + if(rval & AFMT_U16_BE) mpxp_info<<"AFMT_U16_BE "; + if(rval & AFMT_MPEG) mpxp_info<<"AFMT_MPEG "; + if(rval & AFMT_AC3) mpxp_info<<"AFMT_AC3 "; + if(rval & AFMT_S24_LE) mpxp_info<<"AFMT_S24_LE "; + if(rval & AFMT_S24_BE) mpxp_info<<"AFMT_S24_BE "; + if(rval & AFMT_U24_LE) mpxp_info<<"AFMT_U24_LE "; + if(rval & AFMT_U24_BE) mpxp_info<<"AFMT_U24_LE "; + if(rval & AFMT_S32_LE) mpxp_info<<"AFMT_S32_LE "; + if(rval & AFMT_S32_BE) mpxp_info<<"AFMT_S32_BE "; + if(rval & AFMT_U32_LE) mpxp_info<<"AFMT_U32_LE "; + if(rval & AFMT_U32_BE) mpxp_info<<"AFMT_U32_LE "; + mpxp_info<<std::endl; } } @@ -142,23 +142,23 @@ fd=::open(dsp.c_str(), O_WRONLY); #endif if(fd<0){ - MSG_ERR("Can't open audio device %s: %s\n",dsp.c_str(), strerror(errno)); + mpxp_err<<"Can't open audio device "<<dsp<<": "<<strerror(errno)<<std::endl; return; } show_fmts(); rval=0; if (::ioctl (fd, SNDCTL_DSP_GETCAPS, &rval) != -1) { - MSG_INFO("AO-INFO: Capabilities: "); - MSG_INFO("rev-%u ",rval & DSP_CAP_REVISION); - if(rval & DSP_CAP_DUPLEX) MSG_INFO("duplex "); - if(rval & DSP_CAP_REALTIME) MSG_INFO("realtime "); - if(rval & DSP_CAP_BATCH) MSG_INFO("batch "); - if(rval & DSP_CAP_COPROC) MSG_INFO("coproc "); - if(rval & DSP_CAP_TRIGGER) MSG_INFO("trigger "); - if(rval & DSP_CAP_MMAP) MSG_INFO("mmap "); - if(rval & DSP_CAP_MULTI) MSG_INFO("multiopen "); - if(rval & DSP_CAP_BIND) MSG_INFO("bind "); - MSG_INFO("\n"); + mpxp_info<<"AO-INFO: Capabilities: "; + mpxp_info<<"rev-"<<(rval & DSP_CAP_REVISION)<<" "; + if(rval & DSP_CAP_DUPLEX) mpxp_info<<"duplex "; + if(rval & DSP_CAP_REALTIME) mpxp_info<<"realtime "; + if(rval & DSP_CAP_BATCH) mpxp_info<<"batch "; + if(rval & DSP_CAP_COPROC) mpxp_info<<"coproc "; + if(rval & DSP_CAP_TRIGGER) mpxp_info<<"trigger "; + if(rval & DSP_CAP_MMAP) mpxp_info<<"mmap "; + if(rval & DSP_CAP_MULTI) mpxp_info<<"multiopen "; + if(rval & DSP_CAP_BIND) mpxp_info<<"bind "; + mpxp_info<<std::endl; } ::close(fd); } @@ -181,8 +181,8 @@ if(p=="-1") { show_caps(); return MPXP_False; } } } - MSG_V("audio_setup: using '%s' dsp device\n", dsp.c_str()); - MSG_V("audio_setup: using '%s'(%s) mixer device\n", mixer_device,mixer_channels[mixer_channel]); + mpxp_v<<"audio_setup: using '"<<dsp<<"' dsp device"<<std::endl; + mpxp_v<<"audio_setup: using '"<<mixer_device<<"'("<<mixer_channels[mixer_channel]<<") mixer device"<<std::endl; #ifdef __linux__ fd=::open(dsp.c_str(), O_WRONLY | O_NONBLOCK); @@ -190,14 +190,14 @@ fd=::open(dsp.c_str(), O_WRONLY); #endif if(fd<0){ - MSG_ERR("Can't open audio device %s: %s\n", dsp.c_str(), strerror(errno)); + mpxp_err<<"Can't open audio device "<<dsp<<": "<<strerror(errno)<<std::endl; return MPXP_False; } #ifdef __linux__ /* Remove the non-blocking flag */ if(::fcntl(fd, F_SETFL, 0) < 0) { - MSG_ERR("Can't make filedescriptor non-blocking: %s\n", strerror(errno)); + mpxp_err<<"Can't make filedescriptor non-blocking: "<<strerror(errno)<<std::endl; return MPXP_False; } #endif @@ -209,7 +209,7 @@ MPXP_Rc Oss_AO_Interface::configure(unsigned r,unsigned c,unsigned f) { - MSG_V("ao3: %d Hz %d chans %s\n",r,c,ao_format_name(f)); + mpxp_v<<"ao3: "<<r<<" Hz "<<c<<" chans "<<ao_format_name(f)<<std::endl; if(f == AFMT_AC3) { _samplerate=r; @@ -220,7 +220,7 @@ _format=f; if( ::ioctl(fd, SNDCTL_DSP_SETFMT, &_format)<0 || _format != f) { if(_format == AFMT_AC3){ - MSG_WARN("OSS-CONF: Can't set audio device %s to AC3 output, trying S16...\n", dsp.c_str()); + mpxp_warn<<"OSS-CONF: Can't set audio device "<<dsp<<" to AC3 output, trying S16..."<<std::endl; #ifdef WORDS_BIGENDIAN _format=AFMT_S16_BE; #else @@ -228,7 +228,7 @@ #endif goto ac3_retry; } else { - MSG_ERR("OSS-CONF: Can't config_ao for: %s\n",ao_format_name(_format)); + mpxp_err<<"OSS-CONF: Can't config_ao for: "<<ao_format_name(_format)<<std::endl; show_fmts(); _format=f; return MPXP_False; @@ -239,36 +239,35 @@ // We only use SNDCTL_DSP_CHANNELS for >2 channels, in case some drivers don't have it if (_channels > 2) { if (::ioctl(fd, SNDCTL_DSP_CHANNELS, &_channels) == -1 || _channels != c ) { - MSG_ERR("OSS-CONF: Failed to set audio device to %d channels\n", _channels); + mpxp_err<<"OSS-CONF: Failed to set audio device to "<<_channels<<" channels"<<std::endl; return MPXP_False; } } else { int _c = _channels-1; if (::ioctl(fd, SNDCTL_DSP_STEREO, &_c) == -1) { - MSG_ERR("OSS-CONF: Failed to set audio device to %d channels\n", _channels); + mpxp_err<<"OSS-CONF: Failed to set audio device to "<<_channels<<" channels"<<std::endl; return MPXP_False; } _channels=_c+1; } - MSG_V("OSS-CONF: using %d channels (requested: %d)\n", _channels, c); + mpxp_v<<"OSS-CONF: using "<<_channels<<" channels (requested: "<<c<<")"<<std::endl; // set rate _samplerate=r; ::ioctl (fd, SNDCTL_DSP_SPEED, &_samplerate); - MSG_V("OSS-CONF: using %d Hz samplerate (requested: %d)\n",_samplerate,r); + mpxp_v<<"OSS-CONF: using "<<_samplerate<<" Hz samplerate (requested: "<<r<<")"<<std::endl; } if(::ioctl(fd, SNDCTL_DSP_GETOSPACE, &zz)==-1){ int _r=0; - MSG_WARN("OSS-CONF: driver doesn't support SNDCTL_DSP_GETOSPACE :-(\n"); + mpxp_warn<<"OSS-CONF: driver doesn't support SNDCTL_DSP_GETOSPACE"<<std::endl; if(::ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &_r)==-1){ - MSG_V("OSS-CONF: %d bytes/frag (mpxp_config.h)\n",_outburst); + mpxp_v<<"OSS-CONF: "<<_outburst<<" bytes/frag (mpxp_config.h)"<<std::endl; } else { _outburst=r; - MSG_V("OSS-CONF: %d bytes/frag (GETBLKSIZE)\n",_outburst); + mpxp_v<<"OSS-CONF: "<<_outburst<<" bytes/frag (GETBLKSIZE)"<<std::endl; } } else { - MSG_V("OSS-CONF: frags: %3d/%d (%d bytes/frag) mp_free: %6d\n", - zz.fragments, zz.fragstotal, zz.fragsize, zz.bytes); + mpxp_v<<"OSS-CONF: frags: "<<zz.fragments<<"/"<<zz.fragstotal<<" ("<<zz.fragsize<<" bytes/frag) mp_free: "<<zz.bytes<<std::endl; if(_buffersize==0) _buffersize=zz.bytes; _outburst=zz.fragsize; } @@ -290,8 +289,8 @@ } delete data; if(_buffersize==0){ - MSG_ERR("\n *** OSS-CONF: Your audio driver DOES NOT support select() ***\n" - "Recompile mplayerxp with #undef HAVE_AUDIO_SELECT in mpxp_config.h !\n\n"); + mpxp_err<<std::endl<<"*** OSS-CONF: Your audio driver DOES NOT support select() ***"<<std::endl; + mpxp_err<<"Recompile mplayerxp with #undef HAVE_AUDIO_SELECT in mpxp_config.h!"<<std::endl; return MPXP_False; } #endif @@ -307,7 +306,7 @@ ::close(fd); fd=::open(dsp.c_str(), O_WRONLY); if(fd < 0){ - MSG_FATAL("\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno)); + mpxp_fatal<<std::endl<<"Fatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** "<<strerror(errno)<<std::endl; return; } Modified: mplayerxp/libao3/ao_sdl.cpp =================================================================== --- mplayerxp/libao3/ao_sdl.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_sdl.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -13,6 +13,7 @@ * */ #include <algorithm> +#include <iomanip> #include <stdio.h> #include <stdlib.h> @@ -76,7 +77,7 @@ :AO_Interface(_subdevice),volume(new unsigned) {} SDL_AO_Interface::~SDL_AO_Interface() { - MSG_V("SDL: Audio Subsystem shutting down!\n"); + mpxp_v<<"SDL: Audio Subsystem shutting down!"<<std::endl; SDL_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); delete volume; @@ -210,7 +211,7 @@ aspec.format = AUDIO_U16MSB; break; default: - MSG_ERR("SDL: Unsupported audio format: 0x%x.\n", _format); + mpxp_err<<"SDL: Unsupported audio format: 0x"<<std::hex<<_format<<std::endl; return MPXP_False; } @@ -232,13 +233,13 @@ /* initialize the SDL Audio system */ if (SDL_Init (SDL_INIT_AUDIO/*|SDL_INIT_NOPARACHUTE*/)) { - MSG_ERR("SDL: Initializing of SDL Audio failed: %s.\n", SDL_GetError()); + mpxp_err<<"SDL: Initializing of SDL Audio failed: "<<SDL_GetError()<<std::endl; return MPXP_False; } /* Open the audio device and start playing sound! */ if(SDL_OpenAudio(&aspec, &obtained) < 0) { - MSG_ERR("SDL: Unable to open audio: %s\n", SDL_GetError()); + mpxp_err<<"SDL: Unable to open audio: "<<SDL_GetError()<<std::endl; return MPXP_False; } @@ -266,19 +267,15 @@ _format = AFMT_U16_BE; break; default: - MSG_WARN("SDL: Unsupported SDL audio format: 0x%x.\n", obtained.format); + mpxp_warn<<"SDL: Unsupported SDL audio format: 0x"<<std::hex<<obtained.format<<std::endl; return MPXP_False; } - MSG_V("SDL: buf size = %d\n",aspec.size); + mpxp_v<<"SDL: buf size = "<<aspec.size<<std::endl; _buffersize=obtained.size; SDL_AudioDriverName(drv_name, sizeof(drv_name)); - MSG_OK("SDL: using %s audio driver (%iHz %s \"%s\")\n" - ,drv_name - ,_samplerate - ,_channels>4?"Surround":_channels>2?"Quadro":_channels>1?"Stereo":"Mono" - ,ao_format_name(_format)); + mpxp_ok<<"SDL: using "<<drv_name<<" audio driver ("<<_samplerate<<"Hz "<<(_channels>4?"Surround":_channels>2?"Quadro":_channels>1?"Stereo":"Mono")<<" \""<<ao_format_name(_format)<<"\")"<<std::endl; /* unsilence audio, if callback is ready */ SDL_PauseAudio(0); Modified: mplayerxp/libao3/ao_wav.cpp =================================================================== --- mplayerxp/libao3/ao_wav.cpp 2012-12-21 14:05:31 UTC (rev 592) +++ mplayerxp/libao3/ao_wav.cpp 2012-12-21 15:12:47 UTC (rev 593) @@ -109,9 +109,9 @@ broken_seek = GetFileType((HANDLE)_get_osfhandle(_fileno(fp))) != FILE_TYPE_DISK; #endif if (broken_seek || fseek(fp, 0, SEEK_SET) != 0) - MSG_ERR("Could not seek to start, WAV size headers not updated!\n"); + mpxp_err<<"Could not seek to start, WAV size headers not updated!"<<std::endl; else if (data_length > 0x7ffff000) - MSG_ERR("File larger than allowed for WAV files, may play truncated!\n"); + mpxp_err<<"File larger than allowed for WAV files, may play truncated!"<<std::endl; else { wavhdr.file_length = data_length + sizeof(wavhdr) - 8; wavhdr.file_length = le2me_32(wavhdr.file_length); @@ -188,12 +188,7 @@ wavhdr.data_length=le2me_32(0x7ffff000); wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8; - MSG_INFO("ao_wav: %s %d-%s %s\n" - ,out_filename.c_str() - ,_samplerate - ,(_channels > 1) ? "Stereo" : "Mono" - ,afmt2str(_format)); - + mpxp_info<<"ao_wav: "<<out_filename<<" "<<_samplerate<<"-"<<((_channels > 1) ? "Stereo" : "Mono")<<" "<<afmt2str(_format)<<std::endl; fp = ::fopen(out_filename.c_str(), "wb"); if(fp) { if(pcm_waveheader){ /* Reserve space for wave header */ @@ -201,7 +196,7 @@ } return MPXP_Ok; } - MSG_ERR("ao_wav: can't open output file: %s\n", out_filename.c_str()); + mpxp_err<<"ao_wav: can't open output file: "<<out_filename<<std::endl; return MPXP_False; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |