48 #include <alsa/asoundlib.h>
61 snd_pcm_sw_params_t *sw_params;
77 if (snd_pcm_type(s->
h) != SND_PCM_TYPE_HW)
79 "capture with some ALSA plugins, especially dsnoop, "
82 ret = snd_pcm_sw_params_malloc(&sw_params);
89 snd_pcm_sw_params_current(s->
h, sw_params);
90 snd_pcm_sw_params_set_tstamp_mode(s->
h, sw_params, SND_PCM_TSTAMP_ENABLE);
92 ret = snd_pcm_sw_params(s->
h, sw_params);
93 snd_pcm_sw_params_free(sw_params);
119 snd_htimestamp_t timestamp;
120 snd_pcm_uframes_t ts_delay;
127 if (res == -EAGAIN) {
141 snd_pcm_htimestamp(s->
h, &ts_delay, ×tamp);
143 pkt->
pts = timestamp.tv_sec * 1000000LL
174 .priv_class = &alsa_demuxer_class,
void av_free_packet(AVPacket *pkt)
Free a packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
AVStream ** streams
A list of all streams in the file.
av_cold int ff_alsa_close(AVFormatContext *s1)
Close the ALSA PCM.
static av_cold int read_close(AVFormatContext *ctx)
static av_cold int audio_read_header(AVFormatContext *s1)
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.
static const AVOption options[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
AVCodecContext * codec
Codec context associated with this stream.
enum AVCodecID audio_codec_id
Forced audio codec_id.
int channels
number of channels set by user
av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode, unsigned int *sample_rate, int channels, enum AVCodecID *codec_id)
Open an ALSA PCM.
static int read_header(FFV1Context *f)
AVInputFormat ff_alsa_demuxer
enum AVMediaType codec_type
int sample_rate
samples per second
static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
static const AVClass alsa_demuxer_class
Describe the class of an AVClass context structure.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
int ff_alsa_xrun_recover(AVFormatContext *s1, int err)
Try to recover from ALSA buffer underrun.
int period_size
bytes per sample * channels
int channels
number of audio channels
void * priv_data
Format private data.
int frame_size
preferred size for reads and writes
int sample_rate
sample rate set by user
ALSA input and output: definitions and structures.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...