mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 07:33:46 +01:00
added audio_out_format_bits to calc len alignment
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6027 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
7151c375c4
commit
98f2828d5a
@ -45,3 +45,40 @@ char *audio_out_format_name(int format)
|
||||
}
|
||||
return("Unknown");
|
||||
}
|
||||
|
||||
// return number of bits for 1 sample in one channel, or 8 bits for compressed
|
||||
int audio_out_format_bits(int format){
|
||||
switch (format)
|
||||
{
|
||||
/*
|
||||
the following two formats are not available with old linux kernel
|
||||
headers (e.g. in 2.2.16)
|
||||
*/
|
||||
#ifdef AFMT_S32_LE
|
||||
case AFMT_S32_LE:
|
||||
return 32;
|
||||
#endif
|
||||
#ifdef AFMT_S32_BE
|
||||
case AFMT_S32_BE:
|
||||
return 32;
|
||||
#endif
|
||||
|
||||
case AFMT_U16_LE:
|
||||
case AFMT_U16_BE:
|
||||
case AFMT_S16_LE:
|
||||
case AFMT_S16_BE:
|
||||
return 16;//16 bits
|
||||
|
||||
case AFMT_MU_LAW:
|
||||
case AFMT_A_LAW:
|
||||
case AFMT_IMA_ADPCM:
|
||||
case AFMT_S8:
|
||||
case AFMT_U8:
|
||||
case AFMT_MPEG:
|
||||
case AFMT_AC3:
|
||||
default:
|
||||
return 8;//default 1 byte
|
||||
|
||||
}
|
||||
return 8;
|
||||
}
|
@ -42,6 +42,7 @@ extern ao_data_t ao_data;
|
||||
|
||||
// prototypes
|
||||
extern char *audio_out_format_name(int format);
|
||||
extern int audio_out_format_bits(int format);
|
||||
|
||||
// NULL terminated array of all drivers
|
||||
extern ao_functions_t* audio_out_drivers[];
|
||||
|
Loading…
Reference in New Issue
Block a user