mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 07:33:46 +01:00
af_fmt2str_short
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14265 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
e8739c6d92
commit
14a29762f2
@ -334,7 +334,7 @@ static int init(int rate_hz, int channels, int format, int flags)
|
||||
ao_data.bps *= 4;
|
||||
break;
|
||||
case -1:
|
||||
mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: invalid format (%x) requested - output disabled\n",format);
|
||||
mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: invalid format (%s) requested - output disabled\n",af_fmt2str_short(format));
|
||||
return(0);
|
||||
break;
|
||||
default:
|
||||
@ -586,7 +586,7 @@ static int init(int rate_hz, int channels, int format, int flags)
|
||||
alsa_format)) < 0)
|
||||
{
|
||||
mp_msg(MSGT_AO,MSGL_INFO,
|
||||
"alsa-init: format %x are not supported by hardware, trying default\n", format);
|
||||
"alsa-init: format %s are not supported by hardware, trying default\n", af_fmt2str_short(format));
|
||||
alsa_format = SND_PCM_FORMAT_S16_LE;
|
||||
ao_data.format = AF_FORMAT_S16_LE;
|
||||
ao_data.bps = channels * rate_hz * 2;
|
||||
|
@ -50,10 +50,9 @@ static int init(int rate_hz, int channels, int format, int flags)
|
||||
snd_pcm_channel_setup_t setup;
|
||||
snd_pcm_info_t info;
|
||||
snd_pcm_channel_info_t chninfo;
|
||||
char buf[128];
|
||||
|
||||
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ALSA5_InitInfo, rate_hz,
|
||||
channels, af_fmt2str(format, buf, 128));
|
||||
channels, af_fmt2str_short(format));
|
||||
|
||||
alsa_handler = NULL;
|
||||
|
||||
@ -112,7 +111,7 @@ static int init(int rate_hz, int channels, int format, int flags)
|
||||
ao_data.bps *= 2;
|
||||
break;
|
||||
case -1:
|
||||
mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_InvalidFormatReq,af_fmt2str(format,buf,128));
|
||||
mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_InvalidFormatReq,af_fmt2str_short(format));
|
||||
return(0);
|
||||
default:
|
||||
break;
|
||||
|
@ -372,7 +372,7 @@ static int init(int rate, int channels, int format, int flags)
|
||||
case AF_FORMAT_S8:
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_dsound: format %x not supported defaulting to Signed 16-bit Little-Endian\n",format);
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_dsound: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str_short(format));
|
||||
format=AF_FORMAT_S16_LE;
|
||||
}
|
||||
//fill global ao_data
|
||||
@ -381,7 +381,7 @@ static int init(int rate, int channels, int format, int flags)
|
||||
ao_data.format = format;
|
||||
ao_data.bps = channels * rate * (af_fmt2bits(format)>>3);
|
||||
if(ao_data.buffersize==-1) ao_data.buffersize = ao_data.bps; // space for 1 sec
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_dsound: Samplerate:%iHz Channels:%i Format:%x\n", rate, channels, format);
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_dsound: Samplerate:%iHz Channels:%i Format:%s\n", rate, channels, af_fmt2str_short(format));
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_dsound: Buffersize:%d bytes (%d msec)\n", ao_data.buffersize, ao_data.buffersize / ao_data.bps * 1000);
|
||||
|
||||
//fill waveformatex
|
||||
|
@ -387,13 +387,12 @@ static int init(int rate,int channels,int format,int flags)
|
||||
int bytes_per_sample = channels * AuSizeofFormat(auformat);
|
||||
int buffer_size;
|
||||
char *server;
|
||||
char buf[128];
|
||||
|
||||
nas_data=malloc(sizeof(struct ao_nas_data));
|
||||
memset(nas_data, 0, sizeof(struct ao_nas_data));
|
||||
|
||||
mp_msg(MSGT_AO, MSGL_V, "ao2: %d Hz %d chans %s\n",rate,channels,
|
||||
af_fmt2str(format,buf,128));
|
||||
af_fmt2str_short(format));
|
||||
|
||||
ao_data.format = format;
|
||||
ao_data.samplerate = rate;
|
||||
|
@ -184,8 +184,8 @@ static int init(int rate,int channels,int format,int flags){
|
||||
char *mixer_channels [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
|
||||
int oss_format;
|
||||
|
||||
// mp_msg(MSGT_AO,MSGL_V,"ao2: %d Hz %d chans %s\n",rate,channels,
|
||||
// audio_out_format_name(format));
|
||||
mp_msg(MSGT_AO,MSGL_V,"ao2: %d Hz %d chans %s\n",rate,channels,
|
||||
af_fmt2str_short(format));
|
||||
|
||||
if (ao_subdevice)
|
||||
dsp = ao_subdevice;
|
||||
@ -275,8 +275,6 @@ ac3_retry:
|
||||
#endif
|
||||
goto ac3_retry;
|
||||
}
|
||||
// mp_msg(MSGT_AO,MSGL_V,"audio_setup: sample format: %s (requested: %s)\n",
|
||||
// audio_out_format_name(ao_data.format), audio_out_format_name(format));
|
||||
#if 0
|
||||
if(oss_format!=format2oss(format))
|
||||
mp_msg(MSGT_AO,MSGL_WARN,"WARNING! Your soundcard does NOT support %s sample format! Broken audio or bad playback speed are possible! Try with '-aop list=format'\n",audio_out_format_name(format));
|
||||
@ -284,6 +282,9 @@ ac3_retry:
|
||||
|
||||
ao_data.format = oss2format(oss_format);
|
||||
if (ao_data.format == -1) return 0;
|
||||
|
||||
mp_msg(MSGT_AO,MSGL_V,"audio_setup: sample format: %s (requested: %s)\n",
|
||||
af_fmt2str_short(ao_data.format), af_fmt2str_short(format));
|
||||
|
||||
ao_data.channels = channels;
|
||||
if(format != AF_FORMAT_AC3) {
|
||||
|
@ -114,9 +114,9 @@ static int init(int rate,int channels,int format,int flags){
|
||||
wavhdr.data_length=le2me_32(0x7ffff000);
|
||||
wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8;
|
||||
|
||||
// mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_FileInfo, ao_outputfilename,
|
||||
// (ao_pcm_waveheader?"WAVE":"RAW PCM"), rate,
|
||||
// (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format));
|
||||
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_FileInfo, ao_outputfilename,
|
||||
(ao_pcm_waveheader?"WAVE":"RAW PCM"), rate,
|
||||
(channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
|
||||
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_HintInfo);
|
||||
|
||||
fp = fopen(ao_outputfilename, "wb");
|
||||
|
@ -181,7 +181,7 @@ static int init(int rate,int channels,int format,int flags){
|
||||
/* Allocate ring-buffer memory */
|
||||
buffer = (unsigned char *) malloc(BUFFSIZE);
|
||||
|
||||
// mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format));
|
||||
mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
|
||||
|
||||
if(ao_subdevice) {
|
||||
setenv("SDL_AUDIODRIVER", ao_subdevice, 1);
|
||||
|
@ -42,8 +42,7 @@ static int control(int cmd, void *arg){
|
||||
// return: 1=success 0=fail
|
||||
static int init(int rate, int channels, int format, int flags) {
|
||||
|
||||
char buf[128];
|
||||
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_InitInfo, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str(format, buf, 128));
|
||||
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_InitInfo, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
|
||||
|
||||
{ /* from /usr/share/src/dmedia/audio/setrate.c */
|
||||
|
||||
|
@ -466,8 +466,8 @@ static int init(int rate,int channels,int format,int flags){
|
||||
enable_sample_timing = realtime_samplecounter_available(audio_dev);
|
||||
}
|
||||
|
||||
// printf("ao2: %d Hz %d chans %s [0x%X]\n",
|
||||
// rate,channels,audio_out_format_name(format),format);
|
||||
printf("ao2: %d Hz %d chans %s [0x%X]\n",
|
||||
rate,channels,af_fmt2str_short(format),format);
|
||||
|
||||
audio_fd=open(audio_dev, O_WRONLY);
|
||||
if(audio_fd<0){
|
||||
|
@ -147,7 +147,6 @@ static int init(int rate,int channels,int format,int flags)
|
||||
MMRESULT result;
|
||||
unsigned char* buffer;
|
||||
int i;
|
||||
char buf[128];
|
||||
|
||||
switch(format){
|
||||
case AF_FORMAT_AC3:
|
||||
@ -156,7 +155,7 @@ static int init(int rate,int channels,int format,int flags)
|
||||
case AF_FORMAT_S8:
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str(format, &buf, 128));
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str_short(format));
|
||||
format=AF_FORMAT_S16_LE;
|
||||
}
|
||||
//fill global ao_data
|
||||
@ -168,11 +167,11 @@ static int init(int rate,int channels,int format,int flags)
|
||||
ao_data.bps*=2;
|
||||
if(ao_data.buffersize==-1)
|
||||
{
|
||||
ao_data.buffersize=audio_out_format_bits(format)/8;
|
||||
ao_data.buffersize=af_fmt2bits(format)/8;
|
||||
ao_data.buffersize*= channels;
|
||||
ao_data.buffersize*= SAMPLESIZE;
|
||||
}
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_win32: Samplerate:%iHz Channels:%i Format:%s\n",rate, channels, audio_out_format_name(format));
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_win32: Samplerate:%iHz Channels:%i Format:%s\n",rate, channels, af_fmt2str_short(format));
|
||||
mp_msg(MSGT_AO, MSGL_V,"ao_win32: Buffersize:%d\n",ao_data.buffersize);
|
||||
|
||||
//fill waveformatex
|
||||
@ -189,14 +188,14 @@ static int init(int rate,int channels,int format,int flags)
|
||||
else
|
||||
{
|
||||
wformat.Format.wFormatTag = (channels>2)?WAVE_FORMAT_EXTENSIBLE:WAVE_FORMAT_PCM;
|
||||
wformat.Format.wBitsPerSample = audio_out_format_bits(format);
|
||||
wformat.Format.wBitsPerSample = af_fmt2bits(format);
|
||||
wformat.Format.nBlockAlign = wformat.Format.nChannels * (wformat.Format.wBitsPerSample >> 3);
|
||||
}
|
||||
if(channels>2)
|
||||
{
|
||||
wformat.dwChannelMask = channel_mask[channels-3];
|
||||
wformat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
|
||||
wformat.Samples.wValidBitsPerSample=audio_out_format_bits(format);
|
||||
wformat.Samples.wValidBitsPerSample=af_fmt2bits(format);
|
||||
}
|
||||
|
||||
wformat.Format.nAvgBytesPerSec = wformat.Format.nSamplesPerSec * wformat.Format.nBlockAlign;
|
||||
|
Loading…
Reference in New Issue
Block a user