FFmpeg  1.2.12
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 FFmpeg.
7  *
8  * FFmpeg 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  * FFmpeg 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 FFmpeg; 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 "libavutil/log.h"
36 #include "timefilter.h"
37 #include "avdevice.h"
38 
39 /* XXX: we make the assumption that the soundcard accepts this format */
40 /* XXX: find better solution with "preinit" method, needed also in
41  other formats */
42 #define DEFAULT_CODEC_ID AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)
43 
44 typedef void (*ff_reorder_func)(const void *, void *, int);
45 
46 #define ALSA_BUFFER_SIZE_MAX 65536
47 
48 typedef struct AlsaData {
49  AVClass *class;
50  snd_pcm_t *h;
51  int frame_size;
54  int channels;
57  void (*reorder_func)(const void *, void *, int);
58  void *reorder_buf;
60 } AlsaData;
61 
76 int ff_alsa_open(AVFormatContext *s, snd_pcm_stream_t mode,
77  unsigned int *sample_rate,
78  int channels, enum AVCodecID *codec_id);
79 
88 
98 
100 
101 #endif /* AVDEVICE_ALSA_AUDIO_H */