Libav 0.7.1
|
00001 /* 00002 * ALSA input and output 00003 * Copyright (c) 2007 Luca Abeni ( lucabe72 email it ) 00004 * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr ) 00005 * 00006 * This file is part of Libav. 00007 * 00008 * Libav is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * Libav is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with Libav; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00030 #ifndef AVDEVICE_ALSA_AUDIO_H 00031 #define AVDEVICE_ALSA_AUDIO_H 00032 00033 #include <alsa/asoundlib.h> 00034 #include "config.h" 00035 #include "libavformat/avformat.h" 00036 #include "libavutil/log.h" 00037 00038 /* XXX: we make the assumption that the soundcard accepts this format */ 00039 /* XXX: find better solution with "preinit" method, needed also in 00040 other formats */ 00041 #define DEFAULT_CODEC_ID AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE) 00042 00043 #define ALSA_BUFFER_SIZE_MAX 32768 00044 00045 typedef struct { 00046 AVClass *class; 00047 snd_pcm_t *h; 00048 int frame_size; 00049 int period_size; 00050 int sample_rate; 00051 int channels; 00052 } AlsaData; 00053 00068 int ff_alsa_open(AVFormatContext *s, snd_pcm_stream_t mode, 00069 unsigned int *sample_rate, 00070 int channels, enum CodecID *codec_id); 00071 00079 int ff_alsa_close(AVFormatContext *s1); 00080 00089 int ff_alsa_xrun_recover(AVFormatContext *s1, int err); 00090 00091 #endif /* AVDEVICE_ALSA_AUDIO_H */