31#include <sys/soundcard.h>
74 struct audio_buf_info abufi;
83 if (ret<0)
return AVERROR(errno);
91 if (ioctl(
s->fd, SNDCTL_DSP_GETISPACE, &abufi) == 0) {
92 bdelay += abufi.bytes;
95 cur_time -= (bdelay * 1000000LL) / (
s->sample_rate *
s->sample_size *
s->channels);
100 if (
s->flip_left &&
s->channels == 2) {
102 short *p = (
short *)
pkt->data;
104 for (
i = 0;
i < ret;
i += 4) {
127 .class_name =
"OSS indev",
const FFInputFormat ff_oss_demuxer
static av_cold int audio_read_header(AVFormatContext *s1)
static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
Main libavdevice API header.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static uint32_t BS_FUNC read(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 0-32 range.
#define i(width, name, range_min, range_max)
static int read_header(FFV1Context *f, RangeCoder *c)
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
static int audio_read_close(AVFormatContext *context)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT
int ff_oss_audio_open(AVFormatContext *s1, int is_output, const char *audio_device)
int ff_oss_audio_close(OSSAudioData *s)
static int audio_read_header(AVFormatContext *s1)
static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
static int audio_read_close(AVFormatContext *s1)
static const AVClass oss_demuxer_class
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
AVChannelLayout ch_layout
The channel layout and number of channels.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
char * url
input or output URL.
void * priv_data
Format private data.
This structure stores compressed data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int64_t av_gettime(void)
Get the current time in microseconds.