FFmpeg
Data Structures | Macros | Functions | Variables
pulse_audio_dec.c File Reference
#include <pulse/rtclock.h>
#include <pulse/error.h>
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libavformat/demux.h"
#include "libavformat/internal.h"
#include "libavformat/version.h"
#include "pulse_audio_common.h"
#include "timefilter.h"

Go to the source code of this file.

Data Structures

struct  PulseData
 

Macros

#define DEFAULT_CODEC_ID   AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)
 
#define CHECK_SUCCESS_GOTO(rerror, expression, label)
 
#define CHECK_DEAD_GOTO(p, rerror, label)
 
#define OFFSET(a)   offsetof(PulseData, a)
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define DEPR   AV_OPT_FLAG_DEPRECATED
 

Functions

static void context_state_cb (pa_context *c, void *userdata)
 
static void stream_state_cb (pa_stream *s, void *userdata)
 
static void stream_request_cb (pa_stream *s, size_t length, void *userdata)
 
static void stream_latency_update_cb (pa_stream *s, void *userdata)
 
static av_cold int pulse_close (AVFormatContext *s)
 
static av_cold int pulse_read_header (AVFormatContext *s)
 
static int pulse_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int pulse_get_device_list (AVFormatContext *h, AVDeviceInfoList *device_list)
 

Variables

static const AVOption options []
 
static const AVClass pulse_demuxer_class
 
const FFInputFormat ff_pulse_demuxer
 

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 38 of file pulse_audio_dec.c.

◆ CHECK_SUCCESS_GOTO

#define CHECK_SUCCESS_GOTO (   rerror,
  expression,
  label 
)
Value:
do { \
if (!(expression)) { \
rerror = AVERROR_EXTERNAL; \
goto label; \
} \
} while (0)

Definition at line 61 of file pulse_audio_dec.c.

◆ CHECK_DEAD_GOTO

#define CHECK_DEAD_GOTO (   p,
  rerror,
  label 
)
Value:
do { \
if (!(p)->context || !PA_CONTEXT_IS_GOOD(pa_context_get_state((p)->context)) || \
!(p)->stream || !PA_STREAM_IS_GOOD(pa_stream_get_state((p)->stream))) { \
rerror = AVERROR_EXTERNAL; \
goto label; \
} \
} while (0)

Definition at line 69 of file pulse_audio_dec.c.

◆ OFFSET

#define OFFSET (   a)    offsetof(PulseData, a)

Definition at line 373 of file pulse_audio_dec.c.

◆ D

Definition at line 374 of file pulse_audio_dec.c.

◆ DEPR

#define DEPR   AV_OPT_FLAG_DEPRECATED

Definition at line 375 of file pulse_audio_dec.c.

Function Documentation

◆ context_state_cb()

static void context_state_cb ( pa_context *  c,
void *  userdata 
)
static

Definition at line 78 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

◆ stream_state_cb()

static void stream_state_cb ( pa_stream *  s,
void *  userdata 
)
static

Definition at line 90 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

◆ stream_request_cb()

static void stream_request_cb ( pa_stream *  s,
size_t  length,
void *  userdata 
)
static

Definition at line 102 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

◆ stream_latency_update_cb()

static void stream_latency_update_cb ( pa_stream *  s,
void *  userdata 
)
static

Definition at line 108 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

◆ pulse_close()

static av_cold int pulse_close ( AVFormatContext s)
static

Definition at line 114 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

◆ pulse_read_header()

static av_cold int pulse_read_header ( AVFormatContext s)
static

Definition at line 141 of file pulse_audio_dec.c.

◆ pulse_read_packet()

static int pulse_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 289 of file pulse_audio_dec.c.

◆ pulse_get_device_list()

static int pulse_get_device_list ( AVFormatContext h,
AVDeviceInfoList device_list 
)
static

Definition at line 367 of file pulse_audio_dec.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "server", "set PulseAudio server", OFFSET(server), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D },
{ "name", "set application name", OFFSET(name), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, D },
{ "stream_name", "set stream description", OFFSET(stream_name), AV_OPT_TYPE_STRING, {.str = "record"}, 0, 0, D },
{ "sample_rate", "set sample rate in Hz", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, D },
{ "channels", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, D },
{ "frame_size", "set number of bytes per frame", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX, D | DEPR },
{ "fragment_size", "set buffering size, affects latency and cpu usage", OFFSET(fragment_size), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D },
{ "wallclock", "set the initial pts using the current time", OFFSET(wallclock), AV_OPT_TYPE_INT, {.i64 = 1}, -1, 1, D },
{ NULL },
}

Definition at line 377 of file pulse_audio_dec.c.

◆ pulse_demuxer_class

const AVClass pulse_demuxer_class
static
Initial value:
= {
.class_name = "Pulse indev",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 389 of file pulse_audio_dec.c.

◆ ff_pulse_demuxer

const FFInputFormat ff_pulse_demuxer
Initial value:
= {
.p.name = "pulse",
.p.long_name = NULL_IF_CONFIG_SMALL("Pulse audio input"),
.p.flags = AVFMT_NOFILE,
.p.priv_class = &pulse_demuxer_class,
.priv_data_size = sizeof(PulseData),
.get_device_list = pulse_get_device_list,
}

Definition at line 397 of file pulse_audio_dec.c.

DEPR
#define DEPR
Definition: pulse_audio_dec.c:375
options
static const AVOption options[]
Definition: pulse_audio_dec.c:377
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
LIBAVFORMAT_IDENT
#define LIBAVFORMAT_IDENT
Definition: version.h:45
pulse_get_device_list
static int pulse_get_device_list(AVFormatContext *h, AVDeviceInfoList *device_list)
Definition: pulse_audio_dec.c:367
sample_rate
sample_rate
Definition: ffmpeg_filter.c:425
PulseData
Definition: pulse_audio_dec.c:40
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT
Definition: log.h:43
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:41
frame_size
int frame_size
Definition: mxfenc.c:2422
channels
channels
Definition: aptx.h:31
context
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
Definition: writing_filters.txt:91
pulse_close
static av_cold int pulse_close(AVFormatContext *s)
Definition: pulse_audio_dec.c:114
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:550
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
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:106
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
pulse_read_packet
static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: pulse_audio_dec.c:289
pulse_read_header
static av_cold int pulse_read_header(AVFormatContext *s)
Definition: pulse_audio_dec.c:141
D
#define D
Definition: pulse_audio_dec.c:374
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
pulse_demuxer_class
static const AVClass pulse_demuxer_class
Definition: pulse_audio_dec.c:389
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
OFFSET
#define OFFSET(a)
Definition: pulse_audio_dec.c:373