FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
pulse_audio_dec.c File Reference
#include <pulse/rtclock.h>
#include <pulse/error.h>
#include "libavformat/avformat.h"
#include "libavformat/internal.h"
#include "libavutil/opt.h"
#include "libavutil/time.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
 

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
 
AVInputFormat ff_pulse_demuxer
 

Macro Definition Documentation

#define DEFAULT_CODEC_ID   AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)

Definition at line 33 of file pulse_audio_dec.c.

Referenced by pulse_read_header(), and pulse_read_packet().

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

Definition at line 54 of file pulse_audio_dec.c.

Referenced by pulse_read_packet().

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

Referenced by pulse_read_packet().

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

Definition at line 338 of file pulse_audio_dec.c.

Definition at line 339 of file pulse_audio_dec.c.

Function Documentation

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

Definition at line 71 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

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

Definition at line 83 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

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

Definition at line 95 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

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

Definition at line 101 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

static av_cold int pulse_close ( AVFormatContext s)
static

Definition at line 107 of file pulse_audio_dec.c.

Referenced by pulse_read_header().

static av_cold int pulse_read_header ( AVFormatContext s)
static

Definition at line 134 of file pulse_audio_dec.c.

static int pulse_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 264 of file pulse_audio_dec.c.

static int pulse_get_device_list ( AVFormatContext h,
AVDeviceInfoList device_list 
)
static

Definition at line 332 of file pulse_audio_dec.c.

Variable Documentation

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 },
{ "fragment_size", "set buffering size, affects latency and cpu usage", OFFSET(fragment_size), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D },
{ NULL },
}

Definition at line 341 of file pulse_audio_dec.c.

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

Definition at line 352 of file pulse_audio_dec.c.

AVInputFormat ff_pulse_demuxer
Initial value:
= {
.name = "pulse",
.long_name = NULL_IF_CONFIG_SMALL("Pulse audio input"),
.priv_data_size = sizeof(PulseData),
.priv_class = &pulse_demuxer_class,
}

Definition at line 360 of file pulse_audio_dec.c.