alsa-audio-dec.c File Reference

ALSA input and output: input. More...

#include <alsa/asoundlib.h>
#include "libavformat/internal.h"
#include "libavutil/opt.h"
#include "libavutil/mathematics.h"
#include "libavutil/time.h"
#include "avdevice.h"
#include "alsa-audio.h"
Include dependency graph for alsa-audio-dec.c:

Go to the source code of this file.

Functions

static av_cold int audio_read_header (AVFormatContext *s1)
 
static int audio_read_packet (AVFormatContext *s1, AVPacket *pkt)
 

Variables

static const AVOption options []
 
static const AVClass alsa_demuxer_class
 
AVInputFormat ff_alsa_demuxer
 

Detailed Description

ALSA input and output: input.

Author
Luca Abeni ( lucabe72 email it )
Benoit Fouet ( benoit fouet free fr )
Nicolas George ( nicolas george normalesup org )

This avdevice decoder allows to capture audio from an ALSA (Advanced Linux Sound Architecture) device.

The filename parameter is the name of an ALSA PCM device capable of capture, for example "default" or "plughw:1"; see the ALSA documentation for naming conventions. The empty string is equivalent to "default".

The capture period is set to the lower value available for the device, which gives a low latency suitable for real-time capture.

The PTS are an Unix time in microsecond.

Due to a bug in the ALSA library (https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4308), this decoder does not work with certain ALSA plugins, especially the dsnoop plugin.

Definition in file alsa-audio-dec.c.

Function Documentation

static av_cold int audio_read_header ( AVFormatContext s1)
static

Definition at line 57 of file alsa-audio-dec.c.

static int audio_read_packet ( AVFormatContext s1,
AVPacket pkt 
)
static

Definition at line 97 of file alsa-audio-dec.c.

Variable Documentation

const AVClass alsa_demuxer_class
static
Initial value:
= {
.class_name = "ALSA demuxer",
.item_name = av_default_item_name,
.option = options,
}
av_default_item_name
static const AVOption options[]
LIBAVUTIL_VERSION_INT
Definition: eval.c:55

Definition at line 141 of file alsa-audio-dec.c.

AVInputFormat ff_alsa_demuxer
Initial value:
= {
.name = "alsa",
.long_name = NULL_IF_CONFIG_SMALL("ALSA audio input"),
.priv_data_size = sizeof(AlsaData),
.priv_class = &alsa_demuxer_class,
}
av_cold int ff_alsa_close(AVFormatContext *s1)
Close the ALSA PCM.
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
static av_cold int audio_read_header(AVFormatContext *s1)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:517
static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Definition: libcdio.c:114
static const AVClass alsa_demuxer_class
struct AlsaData AlsaData
static int flags
Definition: cpu.c:23
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:345

Definition at line 148 of file alsa-audio-dec.c.

const AVOption options[]
static
Initial value:
= {
{ "sample_rate", "", offsetof(AlsaData, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ "channels", "", offsetof(AlsaData, channels), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
}
NULL
Definition: eval.c:55
sample_rate
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:282

Definition at line 135 of file alsa-audio-dec.c.