mirror of https://github.com/mpv-player/mpv
changed spdif default from "hw:0,2" to general alias "iec958"
based on a patch by Benedikt Hunz <hunz@hunz.org> corrected typo in ugly spdif-warning message added 32/20bit modes for 'high-end'-soundcards disabled hw-mixer-access for big-endian machines (mplayer seems to screw up hw-mixer on LinuxPPC running ALSA needs more testing, but its safer to disable it for now.) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7051 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d092fae808
commit
89ed1748ae
|
@ -140,17 +140,9 @@ snd_pcm_t *spdif_init(char *pcm_name)
|
|||
}
|
||||
if ((err = snd_ctl_elem_write(ctl_handler, ctl)) < 0) {
|
||||
//fprintf(stderr, "Unable to update the IEC958 control: %s\n", snd_strerror(err));
|
||||
printf("alsa-spdif-init: cant set spdif-trough automatically\n");
|
||||
printf("alsa-spdif-init: cant set spdif-through automatically\n");
|
||||
goto __diga_end;
|
||||
}
|
||||
//test area
|
||||
/* elem_device = snd_ctl_elem_id_get_device(elem_id); */
|
||||
/* elem_name = snd_ctl_elem_value_get_name(ctl); */
|
||||
/* snd_ctl_elem_value_get_iec958(ctl, &spdif); */
|
||||
/* printf("spdif = %i, device = %i\n", &spdif, elem_device); */
|
||||
/* printf("name = %s\n", elem_name); */
|
||||
//end test area
|
||||
|
||||
|
||||
snd_ctl_close(ctl_handler);
|
||||
__diga_end:
|
||||
|
@ -211,6 +203,8 @@ static int control(int cmd, int arg)
|
|||
return CONTROL_TRUE;
|
||||
case AOCONTROL_GET_VOLUME:
|
||||
case AOCONTROL_SET_VOLUME:
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
{ //seems to be a problem on macs?
|
||||
{
|
||||
ao_control_vol_t *vol = (ao_control_vol_t *)arg;
|
||||
|
||||
|
@ -303,7 +297,17 @@ static int control(int cmd, int arg)
|
|||
snd_mixer_close(handle);
|
||||
return CONTROL_OK;
|
||||
}
|
||||
}// end big-endian
|
||||
#endif
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
{
|
||||
{
|
||||
return (CONTROL_UNKNOWN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} //end witch
|
||||
return(CONTROL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
@ -369,6 +373,13 @@ static int init(int rate_hz, int channels, int format, int flags)
|
|||
case AFMT_S16_BE:
|
||||
alsa_format = SND_PCM_FORMAT_S16_BE;
|
||||
break;
|
||||
case AFMT_S32_LE:
|
||||
alsa_format = SND_PCM_FORMAT_S32_LE;
|
||||
break;
|
||||
case AFMT_S32_BE:
|
||||
alsa_format = SND_PCM_FORMAT_S32_BE;
|
||||
break;
|
||||
|
||||
default:
|
||||
alsa_format = SND_PCM_FORMAT_MPEG;
|
||||
break;
|
||||
|
@ -380,6 +391,10 @@ static int init(int rate_hz, int channels, int format, int flags)
|
|||
case SND_PCM_FORMAT_U16_LE:
|
||||
ao_data.bps *= 2;
|
||||
break;
|
||||
case SND_PCM_FORMAT_S32_LE:
|
||||
case SND_PCM_FORMAT_S32_BE:
|
||||
ao_data.bps *= 4;
|
||||
break;
|
||||
case -1:
|
||||
printf("alsa-init: invalid format (%s) requested - output disabled\n",
|
||||
audio_out_format_name(format));
|
||||
|
@ -498,7 +513,7 @@ static int init(int rate_hz, int channels, int format, int flags)
|
|||
if (device_set)
|
||||
alsa_handler = spdif_init(alsa_device);
|
||||
else
|
||||
alsa_handler = spdif_init("hw:0,2");
|
||||
alsa_handler = spdif_init("iec958");
|
||||
}
|
||||
|
||||
//setting modes for block or nonblock-mode
|
||||
|
@ -512,7 +527,7 @@ static int init(int rate_hz, int channels, int format, int flags)
|
|||
set_block_mode = 0;
|
||||
str_block_mode = "block-mode";
|
||||
}
|
||||
//cvs cosmetics fix
|
||||
|
||||
//sets buff/chunksize if its set manually
|
||||
if (ao_data.buffersize) {
|
||||
switch (ao_data.buffersize)
|
||||
|
|
|
@ -140,17 +140,9 @@ snd_pcm_t *spdif_init(char *pcm_name)
|
|||
}
|
||||
if ((err = snd_ctl_elem_write(ctl_handler, ctl)) < 0) {
|
||||
//fprintf(stderr, "Unable to update the IEC958 control: %s\n", snd_strerror(err));
|
||||
printf("alsa-spdif-init: cant set spdif-trough automatically\n");
|
||||
printf("alsa-spdif-init: cant set spdif-through automatically\n");
|
||||
goto __diga_end;
|
||||
}
|
||||
//test area
|
||||
/* elem_device = snd_ctl_elem_id_get_device(elem_id); */
|
||||
/* elem_name = snd_ctl_elem_value_get_name(ctl); */
|
||||
/* snd_ctl_elem_value_get_iec958(ctl, &spdif); */
|
||||
/* printf("spdif = %i, device = %i\n", &spdif, elem_device); */
|
||||
/* printf("name = %s\n", elem_name); */
|
||||
//end test area
|
||||
|
||||
|
||||
snd_ctl_close(ctl_handler);
|
||||
__diga_end:
|
||||
|
@ -211,6 +203,8 @@ static int control(int cmd, int arg)
|
|||
return CONTROL_TRUE;
|
||||
case AOCONTROL_GET_VOLUME:
|
||||
case AOCONTROL_SET_VOLUME:
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
{ //seems to be a problem on macs?
|
||||
{
|
||||
ao_control_vol_t *vol = (ao_control_vol_t *)arg;
|
||||
|
||||
|
@ -303,7 +297,17 @@ static int control(int cmd, int arg)
|
|||
snd_mixer_close(handle);
|
||||
return CONTROL_OK;
|
||||
}
|
||||
}// end big-endian
|
||||
#endif
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
{
|
||||
{
|
||||
return (CONTROL_UNKNOWN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} //end witch
|
||||
return(CONTROL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
@ -369,6 +373,13 @@ static int init(int rate_hz, int channels, int format, int flags)
|
|||
case AFMT_S16_BE:
|
||||
alsa_format = SND_PCM_FORMAT_S16_BE;
|
||||
break;
|
||||
case AFMT_S32_LE:
|
||||
alsa_format = SND_PCM_FORMAT_S32_LE;
|
||||
break;
|
||||
case AFMT_S32_BE:
|
||||
alsa_format = SND_PCM_FORMAT_S32_BE;
|
||||
break;
|
||||
|
||||
default:
|
||||
alsa_format = SND_PCM_FORMAT_MPEG;
|
||||
break;
|
||||
|
@ -380,6 +391,10 @@ static int init(int rate_hz, int channels, int format, int flags)
|
|||
case SND_PCM_FORMAT_U16_LE:
|
||||
ao_data.bps *= 2;
|
||||
break;
|
||||
case SND_PCM_FORMAT_S32_LE:
|
||||
case SND_PCM_FORMAT_S32_BE:
|
||||
ao_data.bps *= 4;
|
||||
break;
|
||||
case -1:
|
||||
printf("alsa-init: invalid format (%s) requested - output disabled\n",
|
||||
audio_out_format_name(format));
|
||||
|
@ -498,7 +513,7 @@ static int init(int rate_hz, int channels, int format, int flags)
|
|||
if (device_set)
|
||||
alsa_handler = spdif_init(alsa_device);
|
||||
else
|
||||
alsa_handler = spdif_init("hw:0,2");
|
||||
alsa_handler = spdif_init("iec958");
|
||||
}
|
||||
|
||||
//setting modes for block or nonblock-mode
|
||||
|
@ -512,7 +527,7 @@ static int init(int rate_hz, int channels, int format, int flags)
|
|||
set_block_mode = 0;
|
||||
str_block_mode = "block-mode";
|
||||
}
|
||||
//cvs cosmetics fix
|
||||
|
||||
//sets buff/chunksize if its set manually
|
||||
if (ao_data.buffersize) {
|
||||
switch (ao_data.buffersize)
|
||||
|
|
Loading…
Reference in New Issue