28 #include <pulse/simple.h>
29 #include <pulse/rtclock.h>
30 #include <pulse/error.h>
31 #include "libavformat/avformat.h"
33 #include "libavutil/opt.h"
36 #define DEFAULT_CODEC_ID AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)
64 pa_buffer_attr attr = { -1 };
112 if ((pa_simple_read(pd->
s, pkt->
data, pkt->
size, &res)) < 0) {
119 if ((latency = pa_simple_get_latency(pd->
s, &res)) == (pa_usec_t) -1) {
139 pa_simple_free(pd->
s);
143 #define OFFSET(a) offsetof(PulseData, a)
144 #define D AV_OPT_FLAG_DECODING_PARAM
151 {
"channels",
"set number of audio channels",
OFFSET(channels),
AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX,
D },
153 {
"fragment_size",
"set buffering size, affects latency and cpu usage",
OFFSET(fragment_size),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
D },
172 .priv_class = &pulse_demuxer_class,
void av_free_packet(AVPacket *pkt)
Free a packet.
#define LIBAVUTIL_VERSION_INT
AVCodecContext * codec
Codec context associated with this stream.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
static av_cold int pulse_close(AVFormatContext *s)
AVInputFormat ff_pulse_demuxer
static const AVClass pulse_demuxer_class
const char * av_default_item_name(void *ctx)
Return the context name.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static av_cold int read_close(AVFormatContext *ctx)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
const OptionDef options[]
static const uint8_t frame_size[4]
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
void * priv_data
Format private data.
char filename[1024]
input or output filename
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVCodecID audio_codec_id
Forced audio codec_id.
pa_sample_format_t av_cold codec_id_to_pulse_format(int codec_id)
static int read_header(FFV1Context *f)
enum AVMediaType codec_type
static av_cold int pulse_read_header(AVFormatContext *s)
int sample_rate
samples per second
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Describe the class of an AVClass context structure.
int channels
number of audio channels
static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt)
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.