1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-04 23:40:47 +00:00

cosmetics: reindent ad_pcm.c

This commit is contained in:
Uoti Urpala 2010-05-15 05:45:02 +03:00
parent 9e02b2db40
commit 584b43e9f8

View File

@ -26,8 +26,7 @@
#include "libaf/af_format.h" #include "libaf/af_format.h"
#include "libaf/reorder_ch.h" #include "libaf/reorder_ch.h"
static const ad_info_t info = static const ad_info_t info = {
{
"Uncompressed PCM audio decoder", "Uncompressed PCM audio decoder",
"pcm", "pcm",
"Nick Kurshev", "Nick Kurshev",
@ -73,13 +72,15 @@ static int init(sh_audio_t *sh_audio)
/* case 0x2000: sh_audio->sample_format=AFMT_AC3; */ /* case 0x2000: sh_audio->sample_format=AFMT_AC3; */
case 0x20776172: // 'raw ' case 0x20776172: // 'raw '
sh_audio->sample_format = AF_FORMAT_S16_BE; sh_audio->sample_format = AF_FORMAT_S16_BE;
if(sh_audio->samplesize==1) sh_audio->sample_format=AF_FORMAT_U8; if (sh_audio->samplesize == 1)
sh_audio->sample_format = AF_FORMAT_U8;
break; break;
case 0x736F7774: // 'twos' case 0x736F7774: // 'twos'
sh_audio->sample_format = AF_FORMAT_S16_BE; sh_audio->sample_format = AF_FORMAT_S16_BE;
// intended fall-through // intended fall-through
case 0x74776F73: // 'sowt' case 0x74776F73: // 'sowt'
if(sh_audio->samplesize==1) sh_audio->sample_format=AF_FORMAT_S8; if (sh_audio->samplesize == 1)
sh_audio->sample_format = AF_FORMAT_S8;
break; break;
case 0x32336c66: // 'fl32', bigendian float32 case 0x32336c66: // 'fl32', bigendian float32
sh_audio->sample_format = AF_FORMAT_FLOAT_BE; sh_audio->sample_format = AF_FORMAT_FLOAT_BE;
@ -113,7 +114,9 @@ static int init(sh_audio_t *sh_audio)
sh_audio->sample_format = AF_FORMAT_S32_LE; sh_audio->sample_format = AF_FORMAT_S32_LE;
sh_audio->samplesize = 4; sh_audio->samplesize = 4;
break; break;
default: if(sh_audio->samplesize!=2) sh_audio->sample_format=AF_FORMAT_U8; default:
if (sh_audio->samplesize != 2)
sh_audio->sample_format = AF_FORMAT_U8;
} }
if (!sh_audio->samplesize) // this would cause MPlayer to hang later if (!sh_audio->samplesize) // this would cause MPlayer to hang later
sh_audio->samplesize = 2; sh_audio->samplesize = 2;
@ -135,8 +138,7 @@ static void uninit(sh_audio_t *sh)
static int control(sh_audio_t * sh, int cmd, void *arg, ...) static int control(sh_audio_t * sh, int cmd, void *arg, ...)
{ {
int skip; int skip;
switch(cmd) switch (cmd) {
{
case ADCTRL_SKIP_FRAME: case ADCTRL_SKIP_FRAME:
skip = sh->i_bps / 16; skip = sh->i_bps / 16;
skip = skip & (~3); skip = skip & (~3);
@ -146,7 +148,8 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...)
return CONTROL_UNKNOWN; return CONTROL_UNKNOWN;
} }
static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) static int decode_audio(sh_audio_t * sh_audio, unsigned char *buf, int minlen,
int maxlen)
{ {
unsigned len = sh_audio->channels * sh_audio->samplesize; unsigned len = sh_audio->channels * sh_audio->samplesize;
minlen = (minlen + len - 1) / len * len; minlen = (minlen + len - 1) / len * len;
@ -183,8 +186,8 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m
if (len > 0 && sh_audio->channels >= 5) { if (len > 0 && sh_audio->channels >= 5) {
reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT, reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT,
AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
sh_audio->channels, sh_audio->channels, len / sh_audio->samplesize,
len / sh_audio->samplesize, sh_audio->samplesize); sh_audio->samplesize);
} }
return len; return len;
} }