FFmpeg
Functions | Variables
alsa_enc.c File Reference
#include <alsa/asoundlib.h>
#include "libavutil/internal.h"
#include "libavutil/time.h"
#include "libavformat/internal.h"
#include "libavformat/mux.h"
#include "avdevice.h"
#include "alsa.h"

Go to the source code of this file.

Functions

static av_cold int audio_write_header (AVFormatContext *s1)
 
static int audio_write_packet (AVFormatContext *s1, AVPacket *pkt)
 
static int audio_write_frame (AVFormatContext *s1, int stream_index, AVFrame **frame, unsigned flags)
 
static void audio_get_output_timestamp (AVFormatContext *s1, int stream, int64_t *dts, int64_t *wall)
 
static int audio_get_device_list (AVFormatContext *h, AVDeviceInfoList *device_list)
 

Variables

static const AVClass alsa_muxer_class
 
const AVOutputFormat ff_alsa_muxer
 

Detailed Description

ALSA input and output: output

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

This avdevice encoder can play audio to 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 playback period is set to the lower value available for the device, which gives a low latency suitable for real-time playback.

Definition in file alsa_enc.c.

Function Documentation

◆ audio_write_header()

static av_cold int audio_write_header ( AVFormatContext s1)
static

Definition at line 51 of file alsa_enc.c.

◆ audio_write_packet()

static int audio_write_packet ( AVFormatContext s1,
AVPacket pkt 
)
static

Definition at line 84 of file alsa_enc.c.

Referenced by audio_write_frame().

◆ audio_write_frame()

static int audio_write_frame ( AVFormatContext s1,
int  stream_index,
AVFrame **  frame,
unsigned  flags 
)
static

Definition at line 120 of file alsa_enc.c.

◆ audio_get_output_timestamp()

static void audio_get_output_timestamp ( AVFormatContext s1,
int  stream,
int64_t *  dts,
int64_t *  wall 
)
static

Definition at line 139 of file alsa_enc.c.

◆ audio_get_device_list()

static int audio_get_device_list ( AVFormatContext h,
AVDeviceInfoList device_list 
)
static

Definition at line 149 of file alsa_enc.c.

Variable Documentation

◆ alsa_muxer_class

const AVClass alsa_muxer_class
static
Initial value:
= {
.class_name = "ALSA outdev",
.item_name = av_default_item_name,
}

Definition at line 154 of file alsa_enc.c.

◆ ff_alsa_muxer

const AVOutputFormat ff_alsa_muxer
Initial value:
= {
.name = "alsa",
.long_name = NULL_IF_CONFIG_SMALL("ALSA audio output"),
.priv_data_size = sizeof(AlsaData),
.audio_codec = DEFAULT_CODEC_ID,
.video_codec = AV_CODEC_ID_NONE,
.write_uncoded_frame = audio_write_frame,
.get_device_list = audio_get_device_list,
.get_output_timestamp = audio_get_output_timestamp,
.priv_class = &alsa_muxer_class,
}

Definition at line 161 of file alsa_enc.c.

audio_write_frame
static int audio_write_frame(AVFormatContext *s1, int stream_index, AVFrame **frame, unsigned flags)
Definition: alsa_enc.c:120
audio_get_output_timestamp
static void audio_get_output_timestamp(AVFormatContext *s1, int stream, int64_t *dts, int64_t *wall)
Definition: alsa_enc.c:139
DEFAULT_CODEC_ID
#define DEFAULT_CODEC_ID
Definition: alsa.h:42
audio_write_packet
static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
Definition: alsa_enc.c:84
alsa_muxer_class
static const AVClass alsa_muxer_class
Definition: alsa_enc.c:154
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
write_trailer
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:100
AlsaData
Definition: alsa.h:48
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
ff_alsa_close
av_cold int ff_alsa_close(AVFormatContext *s1)
Close the ALSA PCM.
Definition: alsa.c:308
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:470
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:48
AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT
Definition: log.h:42
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
write_packet
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
Definition: v4l2enc.c:92
write_header
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:346
audio_write_header
static av_cold int audio_write_header(AVFormatContext *s1)
Definition: alsa_enc.c:51
audio_get_device_list
static int audio_get_device_list(AVFormatContext *h, AVDeviceInfoList *device_list)
Definition: alsa_enc.c:149