summaryrefslogtreecommitdiffstats
path: root/audio/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-16 20:57:43 +0200
committerwm4 <wm4@nowhere>2015-06-16 21:11:59 +0200
commit831d7c3c400b554484561bf912c1f9657f8192cd (patch)
tree7c3abe2dadd826f58ac316f9c35b56d9e869d760 /audio/out
parent488ebdb0d57b4e822e8dac4fac18dfe460b61ac6 (diff)
downloadmpv-831d7c3c400b554484561bf912c1f9657f8192cd.tar.bz2
mpv-831d7c3c400b554484561bf912c1f9657f8192cd.tar.xz
audio: remove S8, U16, U24, U32 formats
They are useless. Not only are they actually rarely in use; but libavcodec doesn't even output them, as libavcodec has no such sample formats for decoded audio. Even if it should happen that we actually still need them (e.g. if doing direct hardware output), there are better solutions. Swapping the sign is a fast and lossless operation and can be done inplace, so AO actually needing it could do this directly. If you wonder why we keep U8 instead of S8: because libavcodec does it.
Diffstat (limited to 'audio/out')
-rw-r--r--audio/out/ao_alsa.c5
-rw-r--r--audio/out/ao_coreaudio_utils.c2
-rw-r--r--audio/out/ao_oss.c20
-rw-r--r--audio/out/ao_rsound.c17
-rw-r--r--audio/out/ao_sdl.c2
-rw-r--r--audio/out/ao_sndio.c20
6 files changed, 9 insertions, 57 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index 6ff39ffcb2..1c4eaec139 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -204,14 +204,9 @@ alsa_error:
}
static const int mp_to_alsa_format[][2] = {
- {AF_FORMAT_S8, SND_PCM_FORMAT_S8},
{AF_FORMAT_U8, SND_PCM_FORMAT_U8},
- {AF_FORMAT_U16, SND_PCM_FORMAT_U16},
{AF_FORMAT_S16, SND_PCM_FORMAT_S16},
- {AF_FORMAT_U32, SND_PCM_FORMAT_U32},
{AF_FORMAT_S32, SND_PCM_FORMAT_S32},
- {AF_FORMAT_U24,
- MP_SELECT_LE_BE(SND_PCM_FORMAT_U24_3LE, SND_PCM_FORMAT_U24_3BE)},
{AF_FORMAT_S24,
MP_SELECT_LE_BE(SND_PCM_FORMAT_S24_3LE, SND_PCM_FORMAT_S24_3BE)},
{AF_FORMAT_FLOAT, SND_PCM_FORMAT_FLOAT},
diff --git a/audio/out/ao_coreaudio_utils.c b/audio/out/ao_coreaudio_utils.c
index b861fa3686..52b0e32194 100644
--- a/audio/out/ao_coreaudio_utils.c
+++ b/audio/out/ao_coreaudio_utils.c
@@ -177,7 +177,7 @@ static void ca_fill_asbd_raw(AudioStreamBasicDescription *asbd, int mp_format,
if ((mp_format & AF_FORMAT_TYPE_MASK) == AF_FORMAT_F) {
asbd->mFormatFlags |= kAudioFormatFlagIsFloat;
- } else if ((mp_format & AF_FORMAT_SIGN_MASK) == AF_FORMAT_SI) {
+ } else if (!af_fmt_unsigned(mp_format)) {
asbd->mFormatFlags |= kAudioFormatFlagIsSignedInteger;
}
diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c
index bf320e9b65..bcb21aeffd 100644
--- a/audio/out/ao_oss.c
+++ b/audio/out/ao_oss.c
@@ -94,40 +94,20 @@ static const struct mp_chmap oss_layouts[MP_NUM_CHANNELS + 1] = {
#define AFMT_S16_NE MP_SELECT_LE_BE(AFMT_S16_LE, AFMT_S16_BE)
#endif
-#if !defined(AFMT_U16_NE) && defined(AFMT_U16_LE) && defined(AFMT_U16_BE)
-#define AFMT_U16_NE MP_SELECT_LE_BE(AFMT_U16_LE, AFMT_U16_BE)
-#endif
-
-#if !defined(AFMT_U24_NE) && defined(AFMT_U24_LE) && defined(AFMT_U24_BE)
-#define AFMT_U24_NE MP_SELECT_LE_BE(AFMT_U24_LE, AFMT_U24_BE)
-#endif
-
#if !defined(AFMT_S24_NE) && defined(AFMT_S24_LE) && defined(AFMT_S24_BE)
#define AFMT_S24_NE MP_SELECT_LE_BE(AFMT_S24_LE, AFMT_S24_BE)
#endif
-#if !defined(AFMT_U32_NE) && defined(AFMT_U32_LE) && defined(AFMT_U32_BE)
-#define AFMT_U32_NE AFMT_U32MP_SELECT_LE_BE(AFMT_U32_LE, AFMT_U32_BE)
-#endif
-
#if !defined(AFMT_S32_NE) && defined(AFMT_S32_LE) && defined(AFMT_S32_BE)
#define AFMT_S32_NE AFMT_S32MP_SELECT_LE_BE(AFMT_S32_LE, AFMT_S32_BE)
#endif
static const int format_table[][2] = {
{AFMT_U8, AF_FORMAT_U8},
- {AFMT_S8, AF_FORMAT_S8},
- {AFMT_U16_NE, AF_FORMAT_U16},
{AFMT_S16_NE, AF_FORMAT_S16},
-#ifdef AFMT_U24_NE
- {AFMT_U24_NE, AF_FORMAT_U24},
-#endif
#ifdef AFMT_S24_NE
{AFMT_S24_NE, AF_FORMAT_S24},
#endif
-#ifdef AFMT_U32_NE
- {AFMT_U32_NE, AF_FORMAT_U32},
-#endif
#ifdef AFMT_S32_NE
{AFMT_S32_NE, AF_FORMAT_S32},
#endif
diff --git a/audio/out/ao_rsound.c b/audio/out/ao_rsound.c
index ef1a00111a..0385b09cb8 100644
--- a/audio/out/ao_rsound.c
+++ b/audio/out/ao_rsound.c
@@ -48,26 +48,9 @@ static int set_format(struct ao *ao)
case AF_FORMAT_U8:
rsd_format = RSD_U8;
break;
- case AF_FORMAT_S8:
- rsd_format = RSD_S8;
- break;
- case AF_FORMAT_S16:
- rsd_format = RSD_S16_NE;
- break;
- case AF_FORMAT_U16:
- rsd_format = RSD_U16_NE;
- break;
- case AF_FORMAT_S24:
- case AF_FORMAT_U24:
- rsd_format = RSD_S32_NE;
- ao->format = AF_FORMAT_S32;
- break;
case AF_FORMAT_S32:
rsd_format = RSD_S32_NE;
break;
- case AF_FORMAT_U32:
- rsd_format = RSD_U32_NE;
- break;
default:
rsd_format = RSD_S16_NE;
ao->format = AF_FORMAT_S16;
diff --git a/audio/out/ao_sdl.c b/audio/out/ao_sdl.c
index c1ecff8f24..bf65a4a4d8 100644
--- a/audio/out/ao_sdl.c
+++ b/audio/out/ao_sdl.c
@@ -39,8 +39,6 @@ struct priv
static const int fmtmap[][2] = {
{AF_FORMAT_U8, AUDIO_U8},
- {AF_FORMAT_S8, AUDIO_S8},
- {AF_FORMAT_U16, AUDIO_U16SYS},
{AF_FORMAT_S16, AUDIO_S16SYS},
#ifdef AUDIO_S32SYS
{AF_FORMAT_S32, AUDIO_S32SYS},
diff --git a/audio/out/ao_sndio.c b/audio/out/ao_sndio.c
index abce0efd36..f192ef98b5 100644
--- a/audio/out/ao_sndio.c
+++ b/audio/out/ao_sndio.c
@@ -116,12 +116,8 @@ static int init(struct ao *ao)
};
static const struct af_to_par af_to_par[] = {
{AF_FORMAT_U8, 8, 0},
- {AF_FORMAT_S8, 8, 1},
- {AF_FORMAT_U16, 16, 0},
{AF_FORMAT_S16, 16, 1},
- {AF_FORMAT_U24, 24, 0},
{AF_FORMAT_S24, 24, 1},
- {AF_FORMAT_U32, 32, 0},
{AF_FORMAT_S32, 32, 1},
};
const struct af_to_par *ap;
@@ -178,14 +174,14 @@ static int init(struct ao *ao)
MP_ERR(ao, "swapped endian output not supported\n");
goto error;
}
- if (p->par.bits == 8 && p->par.bps == 1) {
- ao->format = p->par.sig ? AF_FORMAT_S8 : AF_FORMAT_U8;
- } else if (p->par.bits == 16 && p->par.bps == 2) {
- ao->format = p->par.sig ? AF_FORMAT_S16 : AF_FORMAT_U16;
- } else if ((p->par.bits == 24 || p->par.msb) && p->par.bps == 3) {
- ao->format = p->par.sig ? AF_FORMAT_S24 : AF_FORMAT_U24;
- } else if ((p->par.bits == 32 || p->par.msb) && p->par.bps == 4) {
- ao->format = p->par.sig ? AF_FORMAT_S32 : AF_FORMAT_U32;
+ if (p->par.bits == 8 && p->par.bps == 1 && !p->par.sig) {
+ ao->format = AF_FORMAT_U8;
+ } else if (p->par.bits == 16 && p->par.bps == 2 && p->par.sig) {
+ ao->format = AF_FORMAT_S16;
+ } else if ((p->par.bits == 24 || p->par.msb) && p->par.bps == 3 && p->par.sig) {
+ ao->format = AF_FORMAT_S24;
+ } else if ((p->par.bits == 32 || p->par.msb) && p->par.bps == 4 && p->par.sig) {
+ ao->format = AF_FORMAT_S32;
} else {
MP_ERR(ao, "couldn't set format\n");
goto error;