FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pulse_audio_common.c
Go to the documentation of this file.
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 "libavutil/attributes.h"
23 #include "libavcodec/avcodec.h"
24 #include "pulse_audio_common.h"
25 
26 pa_sample_format_t av_cold codec_id_to_pulse_format(int codec_id)
27 {
28  switch (codec_id) {
29  case AV_CODEC_ID_PCM_U8: return PA_SAMPLE_U8;
30  case AV_CODEC_ID_PCM_ALAW: return PA_SAMPLE_ALAW;
31  case AV_CODEC_ID_PCM_MULAW: return PA_SAMPLE_ULAW;
32  case AV_CODEC_ID_PCM_S16LE: return PA_SAMPLE_S16LE;
33  case AV_CODEC_ID_PCM_S16BE: return PA_SAMPLE_S16BE;
34  case AV_CODEC_ID_PCM_F32LE: return PA_SAMPLE_FLOAT32LE;
35  case AV_CODEC_ID_PCM_F32BE: return PA_SAMPLE_FLOAT32BE;
36  case AV_CODEC_ID_PCM_S32LE: return PA_SAMPLE_S32LE;
37  case AV_CODEC_ID_PCM_S32BE: return PA_SAMPLE_S32BE;
38  case AV_CODEC_ID_PCM_S24LE: return PA_SAMPLE_S24LE;
39  case AV_CODEC_ID_PCM_S24BE: return PA_SAMPLE_S24BE;
40  default: return PA_SAMPLE_INVALID;
41  }
42 }