alsa-audio.h
Go to the documentation of this file.
1 /*
2  * ALSA input and output
3  * Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
4  * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
5  *
6  * This file is part of Libav.
7  *
8  * Libav is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * Libav is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with Libav; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
30 #ifndef AVDEVICE_ALSA_AUDIO_H
31 #define AVDEVICE_ALSA_AUDIO_H
32 
33 #include <alsa/asoundlib.h>
34 #include "config.h"
35 #include "libavformat/avformat.h"
36 #include "libavutil/log.h"
37 
38 /* XXX: we make the assumption that the soundcard accepts this format */
39 /* XXX: find better solution with "preinit" method, needed also in
40  other formats */
41 #define DEFAULT_CODEC_ID AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE)
42 
43 #define ALSA_BUFFER_SIZE_MAX 32768
44 
45 typedef struct {
46  AVClass *class;
47  snd_pcm_t *h;
48  int frame_size;
51  int channels;
52  void (*reorder_func)(const void *, void *, int);
53  void *reorder_buf;
55 } AlsaData;
56 
71 int ff_alsa_open(AVFormatContext *s, snd_pcm_stream_t mode,
72  unsigned int *sample_rate,
73  int channels, enum CodecID *codec_id);
74 
83 
93 
95 
96 #endif /* AVDEVICE_ALSA_AUDIO_H */