summaryrefslogtreecommitdiff
path: root/src/internal/audio/kitaudio.c
diff options
context:
space:
mode:
authorTuomas Virtanen <katajakasa@gmail.com>2018-03-29 21:44:00 +0300
committerTuomas Virtanen <katajakasa@gmail.com>2018-03-29 21:46:49 +0300
commit591f359765045e68dc3e69742a63377b2b05525f (patch)
tree73bb23ca6868b01edc985ccf793636f1457189d0 /src/internal/audio/kitaudio.c
parentcd9cdcb9fbc6bbea56e28eb9e4e13f7036004266 (diff)
Cleanups
Diffstat (limited to 'src/internal/audio/kitaudio.c')
-rw-r--r--src/internal/audio/kitaudio.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/internal/audio/kitaudio.c b/src/internal/audio/kitaudio.c
index 447a74d..f31e582 100644
--- a/src/internal/audio/kitaudio.c
+++ b/src/internal/audio/kitaudio.c
@@ -43,8 +43,7 @@ enum AVSampleFormat _FindAVSampleFormat(int format) {
case AUDIO_U8: return AV_SAMPLE_FMT_U8;
case AUDIO_S16SYS: return AV_SAMPLE_FMT_S16;
case AUDIO_S32SYS: return AV_SAMPLE_FMT_S32;
- default:
- return AV_SAMPLE_FMT_NONE;
+ default: return AV_SAMPLE_FMT_NONE;
}
}
@@ -58,22 +57,13 @@ int64_t _FindAVChannelLayout(int channels) {
}
}
-void _FindChannelLayout(uint64_t channel_layout, int *channels) {
+int _FindChannelLayout(uint64_t channel_layout) {
switch(channel_layout) {
- case AV_CH_LAYOUT_MONO:
- *channels = 1;
- break;
- case AV_CH_LAYOUT_STEREO:
- *channels = 2;
- break;
- case AV_CH_LAYOUT_QUAD:
- *channels = 4;
- break;
- case AV_CH_LAYOUT_5POINT1:
- *channels = 6;
- break;
- default:
- *channels = 2;
+ case AV_CH_LAYOUT_MONO: return 1;
+ case AV_CH_LAYOUT_STEREO: return 2;
+ case AV_CH_LAYOUT_QUAD: return 4;
+ case AV_CH_LAYOUT_5POINT1: return 6;
+ default: return 2;
}
}
@@ -209,7 +199,7 @@ Kit_Decoder* Kit_CreateAudioDecoder(const Kit_Source *src, Kit_AudioFormat *form
format->samplerate = dec->codec_ctx->sample_rate;
format->is_enabled = true;
format->stream_index = src->audio_stream_index;
- _FindChannelLayout(dec->codec_ctx->channel_layout, &format->channels);
+ format->channels = _FindChannelLayout(dec->codec_ctx->channel_layout);
_FindAudioFormat(dec->codec_ctx->sample_fmt, &format->bytes, &format->is_signed, &format->format);
// ... then allocate the audio decoder