diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:36:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:36:56 +0000 |
commit | 51de1d8436100f725f3576aefa24a2bd2057bc28 (patch) | |
tree | c6d1d5264b6d40a8d7ca34129f36b7d61e188af3 /audio/format.h | |
parent | Initial commit. (diff) | |
download | mpv-0a581925d1e517e0dd867d02641216b9f5c51c5d.tar.xz mpv-0a581925d1e517e0dd867d02641216b9f5c51c5d.zip |
Adding upstream version 0.37.0.upstream/0.37.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'audio/format.h')
-rw-r--r-- | audio/format.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/audio/format.h b/audio/format.h new file mode 100644 index 0000000..bdd4744 --- /dev/null +++ b/audio/format.h @@ -0,0 +1,77 @@ +/* + * This file is part of mpv. + * + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * mpv is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef MPLAYER_AF_FORMAT_H +#define MPLAYER_AF_FORMAT_H + +#include <stddef.h> +#include <stdbool.h> + +enum af_format { + AF_FORMAT_UNKNOWN = 0, + + AF_FORMAT_U8, + AF_FORMAT_S16, + AF_FORMAT_S32, + AF_FORMAT_S64, + AF_FORMAT_FLOAT, + AF_FORMAT_DOUBLE, + + // Planar variants + AF_FORMAT_U8P, + AF_FORMAT_S16P, + AF_FORMAT_S32P, + AF_FORMAT_S64P, + AF_FORMAT_FLOATP, + AF_FORMAT_DOUBLEP, + + // All of these use IEC61937 framing, and otherwise pretend to be like PCM. + AF_FORMAT_S_AAC, + AF_FORMAT_S_AC3, + AF_FORMAT_S_DTS, + AF_FORMAT_S_DTSHD, + AF_FORMAT_S_EAC3, + AF_FORMAT_S_MP3, + AF_FORMAT_S_TRUEHD, + + AF_FORMAT_COUNT +}; + +const char *af_fmt_to_str(int format); + +int af_fmt_to_bytes(int format); + +bool af_fmt_is_valid(int format); +bool af_fmt_is_unsigned(int format); +bool af_fmt_is_float(int format); +bool af_fmt_is_int(int format); +bool af_fmt_is_planar(int format); +bool af_fmt_is_spdif(int format); +bool af_fmt_is_pcm(int format); + +int af_fmt_to_planar(int format); +int af_fmt_from_planar(int format); + +void af_fill_silence(void *dst, size_t bytes, int format); + +void af_get_best_sample_formats(int src_format, int *out_formats); +int af_format_conversion_score(int dst_format, int src_format); +int af_select_best_samplerate(int src_sampelrate, const int *available); + +int af_format_sample_alignment(int format); + +#endif /* MPLAYER_AF_FORMAT_H */ |