diff options
Diffstat (limited to 'audio/format.h')
-rw-r--r-- | audio/format.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/audio/format.h b/audio/format.h index 95e792340c..9b855e4689 100644 --- a/audio/format.h +++ b/audio/format.h @@ -23,6 +23,7 @@ #ifndef MPLAYER_AF_FORMAT_H #define MPLAYER_AF_FORMAT_H +#include <stdbool.h> #include <sys/types.h> #include "config.h" #include "mpvcore/bstr.h" @@ -64,9 +65,15 @@ #define AF_FORMAT_F (2<<9) // Foating point #define AF_FORMAT_POINT_MASK (3<<9) -#define AF_FORMAT_MASK ((1<<11)-1) +// Interleaving (planar formats have data for each channel in separate planes) +#define AF_FORMAT_INTERLEAVED (0<<11) // must be 0 +#define AF_FORMAT_PLANAR (1<<11) +#define AF_FORMAT_INTERLEAVING_MASK (1<<11) -// PREDEFINED formats +#define AF_FORMAT_MASK ((1<<12)-1) + +#define AF_INTP (AF_FORMAT_I|AF_FORMAT_PLANAR) +#define AF_FLTP (AF_FORMAT_F|AF_FORMAT_PLANAR) // actual sample formats enum af_format { @@ -101,6 +108,13 @@ enum af_format { AF_FORMAT_MPEG2 = (AF_FORMAT_S_MPEG2), + // Planar variants + AF_FORMAT_U8P = (AF_INTP|AF_FORMAT_US|AF_FORMAT_8BIT|AF_FORMAT_NE), + AF_FORMAT_S16P = (AF_INTP|AF_FORMAT_SI|AF_FORMAT_16BIT|AF_FORMAT_NE), + AF_FORMAT_S32P = (AF_INTP|AF_FORMAT_US|AF_FORMAT_32BIT|AF_FORMAT_NE), + AF_FORMAT_FLOATP = (AF_FLTP|AF_FORMAT_32BIT|AF_FORMAT_NE), + AF_FORMAT_DOUBLEP = (AF_FLTP|AF_FORMAT_32BIT|AF_FORMAT_NE), + // Native endian variants AF_FORMAT_U16 = AF_SELECT_LE_BE(AF_FORMAT_U16_LE, AF_FORMAT_U16_BE), AF_FORMAT_S16 = AF_SELECT_LE_BE(AF_FORMAT_S16_LE, AF_FORMAT_S16_BE), @@ -150,6 +164,10 @@ const char *af_fmt_to_str(int format); int af_fmt2bits(int format); int af_fmt_change_bits(int format, int bits); +int af_fmt_to_planar(int format); +int af_fmt_from_planar(int format); +bool af_fmt_is_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); |