mirror of https://github.com/mpv-player/mpv
audio: add double sample format
To make this easier, get rid of the direct mapping of the AF_FORMAT_BITS_MASK bit field to number of bytes. This way we can throw away the unused AF_FORMAT_48BIT and don't have to add ..._56BIT.
This commit is contained in:
parent
f5aec5a2a7
commit
9dd9ccbd8d
|
@ -30,6 +30,7 @@ static const struct {
|
|||
{AV_SAMPLE_FMT_S16, AF_FORMAT_S16_NE},
|
||||
{AV_SAMPLE_FMT_S32, AF_FORMAT_S32_NE},
|
||||
{AV_SAMPLE_FMT_FLT, AF_FORMAT_FLOAT_NE},
|
||||
{AV_SAMPLE_FMT_DBL, AF_FORMAT_DOUBLE_NE},
|
||||
|
||||
{AV_SAMPLE_FMT_NONE, 0},
|
||||
};
|
||||
|
|
|
@ -31,24 +31,15 @@ int af_fmt2bits(int format)
|
|||
if (AF_FORMAT_IS_AC3(format)) return 16;
|
||||
if (format == AF_FORMAT_UNKNOWN)
|
||||
return 0;
|
||||
return (format & AF_FORMAT_BITS_MASK)+8;
|
||||
// return (((format & AF_FORMAT_BITS_MASK)>>3)+1) * 8;
|
||||
#if 0
|
||||
switch(format & AF_FORMAT_BITS_MASK)
|
||||
{
|
||||
case AF_FORMAT_8BIT: return 8;
|
||||
case AF_FORMAT_16BIT: return 16;
|
||||
case AF_FORMAT_24BIT: return 24;
|
||||
case AF_FORMAT_32BIT: return 32;
|
||||
case AF_FORMAT_48BIT: return 48;
|
||||
case AF_FORMAT_64BIT: return 64;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
int af_bits2fmt(int bits)
|
||||
{
|
||||
return (bits/8 - 1) << 3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Convert format to str input str is a buffer for the
|
||||
|
@ -96,6 +87,9 @@ const struct af_fmt_entry af_fmtstr_table[] = {
|
|||
{ "floatle", AF_FORMAT_FLOAT_LE },
|
||||
{ "floatbe", AF_FORMAT_FLOAT_BE },
|
||||
{ "floatne", AF_FORMAT_FLOAT_NE },
|
||||
{ "doublele", AF_FORMAT_DOUBLE_LE },
|
||||
{ "doublebe", AF_FORMAT_DOUBLE_BE },
|
||||
{ "doublene", AF_FORMAT_DOUBLE_NE },
|
||||
|
||||
{0}
|
||||
};
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
#define AF_FORMAT_16BIT (1<<3)
|
||||
#define AF_FORMAT_24BIT (2<<3)
|
||||
#define AF_FORMAT_32BIT (3<<3)
|
||||
#define AF_FORMAT_40BIT (4<<3)
|
||||
#define AF_FORMAT_48BIT (5<<3)
|
||||
#define AF_FORMAT_64BIT (4<<3)
|
||||
#define AF_FORMAT_BITS_MASK (7<<3)
|
||||
|
||||
// Special flags refering to non pcm data (note: 1<<6, 2<<6, 5<<6 unused)
|
||||
|
@ -85,6 +84,9 @@
|
|||
#define AF_FORMAT_FLOAT_LE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_LE)
|
||||
#define AF_FORMAT_FLOAT_BE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_BE)
|
||||
|
||||
#define AF_FORMAT_DOUBLE_LE (AF_FORMAT_F|AF_FORMAT_64BIT|AF_FORMAT_LE)
|
||||
#define AF_FORMAT_DOUBLE_BE (AF_FORMAT_F|AF_FORMAT_64BIT|AF_FORMAT_BE)
|
||||
|
||||
#define AF_FORMAT_AC3_LE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_LE)
|
||||
#define AF_FORMAT_AC3_BE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_BE)
|
||||
|
||||
|
@ -99,6 +101,7 @@
|
|||
#define AF_FORMAT_U32_NE AF_FORMAT_U32_BE
|
||||
#define AF_FORMAT_S32_NE AF_FORMAT_S32_BE
|
||||
#define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_BE
|
||||
#define AF_FORMAT_DOUBLE_NE AF_FORMAT_DOUBLE_BE
|
||||
#define AF_FORMAT_AC3_NE AF_FORMAT_AC3_BE
|
||||
#define AF_FORMAT_IEC61937_NE AF_FORMAT_IEC61937_BE
|
||||
#else
|
||||
|
@ -109,6 +112,7 @@
|
|||
#define AF_FORMAT_U32_NE AF_FORMAT_U32_LE
|
||||
#define AF_FORMAT_S32_NE AF_FORMAT_S32_LE
|
||||
#define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_LE
|
||||
#define AF_FORMAT_DOUBLE_NE AF_FORMAT_DOUBLE_LE
|
||||
#define AF_FORMAT_AC3_NE AF_FORMAT_AC3_LE
|
||||
#define AF_FORMAT_IEC61937_NE AF_FORMAT_IEC61937_LE
|
||||
#endif
|
||||
|
@ -127,7 +131,6 @@ extern const struct af_fmt_entry af_fmtstr_table[];
|
|||
|
||||
int af_str2fmt_short(bstr str);
|
||||
int af_fmt2bits(int format);
|
||||
int af_bits2fmt(int bits);
|
||||
char* af_fmt2str(int format, char* str, int size);
|
||||
const char* af_fmt2str_short(int format);
|
||||
|
||||
|
|
Loading…
Reference in New Issue