48 #include <alsa/asoundlib.h> 64 snd_pcm_sw_params_t *sw_params;
80 if (snd_pcm_type(s->
h) != SND_PCM_TYPE_HW)
82 "capture with some ALSA plugins, especially dsnoop, " 85 ret = snd_pcm_sw_params_malloc(&sw_params);
92 snd_pcm_sw_params_current(s->
h, sw_params);
93 snd_pcm_sw_params_set_tstamp_mode(s->
h, sw_params, SND_PCM_TSTAMP_ENABLE);
95 ret = snd_pcm_sw_params(s->
h, sw_params);
96 snd_pcm_sw_params_free(sw_params);
122 snd_htimestamp_t timestamp;
123 snd_pcm_uframes_t ts_delay;
130 if (res == -EAGAIN) {
144 snd_pcm_htimestamp(s->
h, &ts_delay, ×tamp);
146 pkt->
pts = timestamp.tv_sec * 1000000LL
158 {
"channels",
"", offsetof(
AlsaData, channels),
AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
177 .priv_class = &alsa_demuxer_class,
#define AV_LOG_WARNING
Something somehow does not look correct.
static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
ALSA input and output: definitions and structures.
static const AVOption options[]
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 * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
static av_cold int read_close(AVFormatContext *ctx)
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.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVMediaType codec_type
General type of the encoded data.
common internal API header
enum AVCodecID audio_codec_id
Forced audio codec_id.
int channels
number of channels set by user
static int read_header(FFV1Context *f)
int ff_alsa_xrun_recover(AVFormatContext *s1, int err)
Try to recover from ALSA buffer underrun.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
av_cold int ff_alsa_close(AVFormatContext *s1)
Close the ALSA PCM.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
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 period_size
bytes per sample * channels
int sample_rate
Audio only.
void * priv_data
Format private data.
static av_cold int audio_read_header(AVFormatContext *s1)
int frame_size
preferred size for reads and writes
int sample_rate
sample rate set by user
AVCodecParameters * codecpar
static const AVClass alsa_demuxer_class
AVInputFormat ff_alsa_demuxer
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
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.