]> git.sesse.net Git - ffmpeg/blob - libavdevice/pulse_audio_common.c
Merge commit '8eeacf31c5ea37baf6b222dc38d20cf4fd33c455'
[ffmpeg] / libavdevice / pulse_audio_common.c
1 /*
2  * Pulseaudio input
3  * Copyright (c) 2011 Luca Barbato <lu_zero@gentoo.org>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 #include "pulse_audio_common.h"
23 #include "libavutil/attributes.h"
24
25 pa_sample_format_t av_cold ff_codec_id_to_pulse_format(enum AVCodecID codec_id)
26 {
27     switch (codec_id) {
28     case AV_CODEC_ID_PCM_U8:    return PA_SAMPLE_U8;
29     case AV_CODEC_ID_PCM_ALAW:  return PA_SAMPLE_ALAW;
30     case AV_CODEC_ID_PCM_MULAW: return PA_SAMPLE_ULAW;
31     case AV_CODEC_ID_PCM_S16LE: return PA_SAMPLE_S16LE;
32     case AV_CODEC_ID_PCM_S16BE: return PA_SAMPLE_S16BE;
33     case AV_CODEC_ID_PCM_F32LE: return PA_SAMPLE_FLOAT32LE;
34     case AV_CODEC_ID_PCM_F32BE: return PA_SAMPLE_FLOAT32BE;
35     case AV_CODEC_ID_PCM_S32LE: return PA_SAMPLE_S32LE;
36     case AV_CODEC_ID_PCM_S32BE: return PA_SAMPLE_S32BE;
37     case AV_CODEC_ID_PCM_S24LE: return PA_SAMPLE_S24LE;
38     case AV_CODEC_ID_PCM_S24BE: return PA_SAMPLE_S24BE;
39     default:                    return PA_SAMPLE_INVALID;
40     }
41 }