path: root/audio/format.h
diff options
authorwm4 <wm4@nowhere>2015-06-26 23:06:37 +0200
committerwm4 <wm4@nowhere>2015-06-26 23:06:37 +0200
commit6147bcce359358855ad02d8d5cbd6575d39b0449 (patch)
tree5cb8bafc418cd71b68f95766ad01b3312feed518 /audio/format.h
parentd6737c5fab489964558b1eed934969c4f151912d (diff)
audio: fix format function consistency issues
Replace all the check macros with function calls. Give them all the same case and naming schema. Drop af_fmt2bits(). Only af_fmt2bps() survives as af_fmt_to_bytes(). Introduce af_fmt_is_pcm(), and use it in situations that used !AF_FORMAT_IS_SPECIAL. Nobody really knew what a "special" format was. It simply meant "not PCM".
Diffstat (limited to 'audio/format.h')
1 files changed, 5 insertions, 11 deletions
diff --git a/audio/format.h b/audio/format.h
index 83da59cf61..ea17a44766 100644
--- a/audio/format.h
+++ b/audio/format.h
@@ -54,22 +54,18 @@ enum af_format {
-#define AF_FORMAT_IS_IEC61937(f) af_fmt_is_spdif(f)
-#define AF_FORMAT_IS_SPECIAL(f) af_fmt_is_spdif(f)
-#define AF_FORMAT_IS_FLOAT(f) af_fmt_is_float(f)
-#define AF_FORMAT_IS_PLANAR(f) af_fmt_is_planar(f)
const char *af_fmt_to_str(int format);
-int af_fmt2bps(int format);
-int af_fmt2bits(int format);
-int af_fmt_change_bits(int format, int bits);
+int af_fmt_to_bytes(int format);
+int af_fmt_change_bytes(int format, int bytes);
-bool af_fmt_unsigned(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);
@@ -77,8 +73,6 @@ int af_fmt_from_planar(int format);
// Amount of bytes that contain audio of the given duration, aligned to frames.
int af_fmt_seconds_to_bytes(int format, float seconds, int channels, int samplerate);
-bool af_fmt_is_valid(int format);
void af_fill_silence(void *dst, size_t bytes, int format);
int af_format_conversion_score(int dst_format, int src_format);