FFmpeg
Loading...
Searching...
No Matches
alsa.h File Reference

ALSA input and output: definitions and structures. More...

#include <alsa/asoundlib.h>
#include "config.h"
#include "libavutil/log.h"
#include "timefilter.h"
#include "avdevice.h"
#include "version.h"

Go to the source code of this file.

Data Structures

struct  AlsaData
 

Macros

#define DEFAULT_CODEC_ID   AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)
 
#define ALSA_BUFFER_SIZE_MAX   131072
 

Typedefs

typedef void(* ff_reorder_func) (const void *, void *, int)
 

Functions

av_warn_unused_result int ff_alsa_open (AVFormatContext *s, snd_pcm_stream_t mode, unsigned int *sample_rate, AVChannelLayout *layout, enum AVCodecID *codec_id)
 Open an ALSA PCM.
 
int ff_alsa_close (AVFormatContext *s1)
 Close the ALSA PCM.
 
av_warn_unused_result int ff_alsa_xrun_recover (AVFormatContext *s1, int err)
 Try to recover from ALSA buffer underrun.
 
av_warn_unused_result int ff_alsa_extend_reorder_buf (AlsaData *s, int size)
 
av_warn_unused_result int ff_alsa_get_device_list (AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type)
 

Detailed Description

ALSA input and output: definitions and structures.

Author
Luca Abeni ( lucabe72 email it )
Benoit Fouet ( benoit fouet free fr )

Definition in file alsa.h.

Macro Definition Documentation

◆ DEFAULT_CODEC_ID

#define DEFAULT_CODEC_ID   AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)

Definition at line 43 of file alsa.h.

Referenced by ff_alsa_open(), and pulse_read_header().

◆ ALSA_BUFFER_SIZE_MAX

#define ALSA_BUFFER_SIZE_MAX   131072

Definition at line 47 of file alsa.h.

Referenced by ff_alsa_open().

Typedef Documentation

◆ ff_reorder_func

typedef void(* ff_reorder_func) (const void *, void *, int)

Definition at line 45 of file alsa.h.

Function Documentation

◆ ff_alsa_open()

av_warn_unused_result int ff_alsa_open ( AVFormatContext * s,
snd_pcm_stream_t mode,
unsigned int * sample_rate,
AVChannelLayout * layout,
enum AVCodecID * codec_id )

Open an ALSA PCM.

Parameters
smedia file handle
modeeither SND_PCM_STREAM_CAPTURE or SND_PCM_STREAM_PLAYBACK
sample_ratein: requested sample rate; out: actually selected sample rate
layoutin: requested channel layout, or nb_channels=0 for auto-detect; out: actually selected channel layout
codec_idin: requested AVCodecID or AV_CODEC_ID_NONE; out: actually selected AVCodecID, changed only if AV_CODEC_ID_NONE was requested
Returns
0 if OK, AVERROR_xxx on error

Definition at line 256 of file alsa.c.

Referenced by audio_read_header(), and audio_write_header().

◆ ff_alsa_close()

int ff_alsa_close ( AVFormatContext * s1)

Close the ALSA PCM.

Parameters
s1media file handle
Returns
0

Definition at line 421 of file alsa.c.

◆ ff_alsa_xrun_recover()

av_warn_unused_result int ff_alsa_xrun_recover ( AVFormatContext * s1,
int err )

Try to recover from ALSA buffer underrun.

Parameters
s1media file handle
errerror code reported by the previous ALSA call
Returns
0 if OK, AVERROR_xxx on error

Definition at line 437 of file alsa.c.

Referenced by audio_read_packet(), and audio_write_packet().

◆ ff_alsa_extend_reorder_buf()

av_warn_unused_result int ff_alsa_extend_reorder_buf ( AlsaData * s,
int size )

Definition at line 460 of file alsa.c.

Referenced by audio_write_packet().

◆ ff_alsa_get_device_list()

av_warn_unused_result int ff_alsa_get_device_list ( AVDeviceInfoList * device_list,
snd_pcm_stream_t stream_type )

Definition at line 477 of file alsa.c.

Referenced by audio_get_device_list(), and audio_get_device_list().