diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-04-05 10:15:03 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-04-05 11:03:19 +0200 |
commit | efec2d7b35db96014ad33e43383b93d42acd8829 (patch) | |
tree | 1569048b055bfcc194dd7839a114d7b7bceec8aa /libavdevice | |
parent | 9c09dead87cafaef12640ac8d9a009912c367022 (diff) | |
download | ffmpeg-efec2d7b35db96014ad33e43383b93d42acd8829.tar.gz |
Template alsa reordering functions.
Diffstat (limited to 'libavdevice')
-rw-r--r-- | libavdevice/alsa-audio-common.c | 69 |
1 files changed, 37 insertions, 32 deletions
diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c index bbe2c87720..ce1d75043a 100644 --- a/libavdevice/alsa-audio-common.c +++ b/libavdevice/alsa-audio-common.c @@ -43,42 +43,47 @@ static av_cold snd_pcm_format_t codec_id_to_pcm_format(int codec_id) } } -static void alsa_reorder_s16_out_51(const void *in_v, void *out_v, int n) -{ - const int16_t *in = in_v; - int16_t *out = out_v; - - while (n-- > 0) { - out[0] = in[0]; - out[1] = in[1]; - out[2] = in[4]; - out[3] = in[5]; - out[4] = in[2]; - out[5] = in[3]; - in += 6; - out += 6; - } +#define REORDER_OUT_51(NAME, TYPE) \ +static void alsa_reorder_ ## NAME ## _out_51(const void *in_v, void *out_v, int n) \ +{ \ + const TYPE *in = in_v; \ + TYPE * out = out_v; \ +\ + while (n-- > 0) { \ + out[0] = in[0]; \ + out[1] = in[1]; \ + out[2] = in[4]; \ + out[3] = in[5]; \ + out[4] = in[2]; \ + out[5] = in[3]; \ + in += 6; \ + out += 6; \ + } \ } -static void alsa_reorder_s16_out_71(const void *in_v, void *out_v, int n) -{ - const int16_t *in = in_v; - int16_t *out = out_v; - - while (n-- > 0) { - out[0] = in[0]; - out[1] = in[1]; - out[2] = in[4]; - out[3] = in[5]; - out[4] = in[2]; - out[5] = in[3]; - out[6] = in[6]; - out[7] = in[7]; - in += 8; - out += 8; - } +#define REORDER_OUT_71(NAME, TYPE) \ +static void alsa_reorder_ ## NAME ## _out_71(const void *in_v, void *out_v, int n) \ +{ \ + const TYPE *in = in_v; \ + TYPE * out = out_v; \ +\ + while (n-- > 0) { \ + out[0] = in[0]; \ + out[1] = in[1]; \ + out[2] = in[4]; \ + out[3] = in[5]; \ + out[4] = in[2]; \ + out[5] = in[3]; \ + out[6] = in[6]; \ + out[7] = in[7]; \ + in += 8; \ + out += 8; \ + } \ } +REORDER_OUT_51(s16, int16_t) +REORDER_OUT_71(s16, int16_t) + #define REORDER_DUMMY ((void *)1) static av_cold ff_reorder_func find_reorder_func(int codec_id, |