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 FFmpeg. 00007 * 00008 * FFmpeg 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 * FFmpeg 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 FFmpeg; 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 00037 /* XXX: we make the assumption that the soundcard accepts this format */ 00038 /* XXX: find better solution with "preinit" method, needed also in 00039 other formats */ 00040 #if HAVE_BIGENDIAN 00041 #define DEFAULT_CODEC_ID CODEC_ID_PCM_S16BE 00042 #else 00043 #define DEFAULT_CODEC_ID CODEC_ID_PCM_S16LE 00044 #endif 00045 00046 typedef struct { 00047 snd_pcm_t *h; 00048 int frame_size; 00049 int period_size; 00050 } AlsaData; 00051 00066 int ff_alsa_open(AVFormatContext *s, snd_pcm_stream_t mode, 00067 unsigned int *sample_rate, 00068 int channels, enum CodecID *codec_id); 00069 00077 int ff_alsa_close(AVFormatContext *s1); 00078 00087 int ff_alsa_xrun_recover(AVFormatContext *s1, int err); 00088 00089 #endif /* AVDEVICE_ALSA_AUDIO_H */