mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 18:05:21 +00:00
audio/out: reject non-interleaved formats
No AO can handle these, so it would be a problem if they get added later, and non-interleaved formats get accepted erroneously. Let them gracefully fall back to other formats. Most AOs actually would fall back, but to an unrelated formats. This is covered by this commit too, and if possible they should pick the interleaved variant if a non-interleaved format is requested.
This commit is contained in:
parent
d2e7467eb2
commit
bf60281ffb
@ -436,6 +436,8 @@ static int init(struct ao *ao)
|
||||
(p->alsa, alsa_hwparams, SND_PCM_ACCESS_RW_INTERLEAVED);
|
||||
CHECK_ALSA_ERROR("Unable to set access type");
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
p->alsa_fmt = find_alsa_format(ao->format);
|
||||
if (p->alsa_fmt == SND_PCM_FORMAT_UNKNOWN) {
|
||||
p->alsa_fmt = SND_PCM_FORMAT_S16;
|
||||
|
@ -285,6 +285,8 @@ static int init(struct ao *ao)
|
||||
// Save selected device id
|
||||
p->device = selected_device;
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
bool supports_digital = false;
|
||||
/* Probe whether device support S/PDIF stream output if input is AC3 stream. */
|
||||
if (AF_FORMAT_IS_AC3(ao->format)) {
|
||||
|
@ -388,7 +388,7 @@ static int init(struct ao *ao)
|
||||
WAVEFORMATEXTENSIBLE wformat;
|
||||
DSBUFFERDESC dsbpridesc;
|
||||
DSBUFFERDESC dsbdesc;
|
||||
int format = ao->format;
|
||||
int format = af_fmt_from_planar(ao->format);
|
||||
int rate = ao->samplerate;
|
||||
|
||||
if (AF_FORMAT_IS_AC3(format))
|
||||
|
@ -105,6 +105,7 @@ static int init(struct ao *ao)
|
||||
ac->stream->codec->channel_layout = mp_chmap_to_lavc(&ao->channels);
|
||||
|
||||
ac->stream->codec->sample_fmt = AV_SAMPLE_FMT_NONE;
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
{
|
||||
// first check if the selected format is somewhere in the list of
|
||||
|
@ -51,6 +51,8 @@ static int init(struct ao *ao)
|
||||
struct priv *priv = talloc_zero(ao, struct priv);
|
||||
ao->priv = priv;
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
struct mp_chmap_sel sel = {0};
|
||||
mp_chmap_sel_add_any(&sel);
|
||||
if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels))
|
||||
|
@ -261,6 +261,8 @@ static int init(struct ao *ao)
|
||||
fcntl(p->audio_fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
if (AF_FORMAT_IS_AC3(ao->format)) {
|
||||
ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &ao->samplerate);
|
||||
}
|
||||
|
@ -118,6 +118,9 @@ static int init(struct ao *ao)
|
||||
if (!priv->outputfilename)
|
||||
priv->outputfilename =
|
||||
talloc_strdup(priv, priv->waveheader ? "audiodump.wav" : "audiodump.pcm");
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
if (priv->waveheader) {
|
||||
// WAV files must have one of the following formats
|
||||
|
||||
|
@ -242,6 +242,8 @@ static int init(struct ao *ao)
|
||||
= Pa_GetDeviceInfo(pa_device)->defaultHighOutputLatency,
|
||||
};
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
const struct format_map *fmt = format_maps;
|
||||
while (fmt->pa_format) {
|
||||
if (fmt->mp_format == ao->format) {
|
||||
|
@ -286,6 +286,8 @@ static int init(struct ao *ao)
|
||||
ss.channels = ao->channels.num;
|
||||
ss.rate = ao->samplerate;
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
const struct format_map *fmt_map = format_maps;
|
||||
while (fmt_map->mp_format != ao->format) {
|
||||
if (fmt_map->mp_format == AF_FORMAT_UNKNOWN) {
|
||||
|
@ -114,6 +114,8 @@ static int init(struct ao *ao)
|
||||
rsd_set_param(priv->rd, RSD_SAMPLERATE, &ao->samplerate);
|
||||
rsd_set_param(priv->rd, RSD_CHANNELS, &ao->channels.num);
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
int rsd_format = set_format(ao);
|
||||
rsd_set_param(priv->rd, RSD_FORMAT, &rsd_format);
|
||||
|
||||
|
@ -144,6 +144,8 @@ static int init(struct ao *ao)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
SDL_AudioSpec desired, obtained;
|
||||
|
||||
switch (ao->format) {
|
||||
|
@ -130,6 +130,9 @@ static int init(struct ao *ao)
|
||||
MP_ERR(ao, "can't open sndio %s\n", p->dev);
|
||||
goto error;
|
||||
}
|
||||
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
|
||||
sio_initpar(&p->par);
|
||||
for (i = 0, ap = af_to_par;; i++, ap++) {
|
||||
if (i == sizeof(af_to_par) / sizeof(struct af_to_par)) {
|
||||
|
@ -1231,6 +1231,7 @@ static void uninit(struct ao *ao, bool immed)
|
||||
static int init(struct ao *ao)
|
||||
{
|
||||
mp_msg(MSGT_AO, MSGL_V, "ao-wasapi: init!\n");
|
||||
ao->format = af_fmt_from_planar(ao->format);
|
||||
struct mp_chmap_sel sel = {0};
|
||||
mp_chmap_sel_add_waveext(&sel);
|
||||
if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels))
|
||||
|
Loading…
Reference in New Issue
Block a user