29 #include <soundcard.h>
31 #include <sys/soundcard.h>
35 #include <sys/ioctl.h>
44 #define AUDIO_BLOCK_SIZE 4096
53 unsigned int flip_left : 1;
63 char *
flip = getenv(
"AUDIO_FLIP_LEFT");
66 audio_fd = open(audio_device, O_WRONLY);
68 audio_fd = open(audio_device, O_RDONLY);
74 if (flip && *flip ==
'1') {
80 if (fcntl(audio_fd, F_SETFL, O_NONBLOCK) < 0) {
81 av_log(s1,
AV_LOG_WARNING,
"%s: Could not enable non block mode (%s)\n", audio_device, strerror(errno));
88 err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
91 if (tmp & AFMT_S16_BE) {
93 }
else if (tmp & AFMT_S16_LE) {
99 if (tmp & AFMT_S16_LE) {
101 }
else if (tmp & AFMT_S16_BE) {
120 err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp);
127 err = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
134 err = ioctl(audio_fd, SNDCTL_DSP_SPEED, &tmp);
188 if (ret < 0 && (errno != EAGAIN && errno != EINTR))
240 struct audio_buf_info abufi;
249 if (ret<0)
return AVERROR(errno);
257 if (ioctl(s->
fd, SNDCTL_DSP_GETISPACE, &abufi) == 0) {
258 bdelay += abufi.bytes;
268 short *p = (
short *) pkt->
data;
270 for (i = 0; i < ret; i += 4) {
293 static const AVClass oss_demuxer_class = {
308 .priv_class = &oss_demuxer_class,
312 #if CONFIG_OSS_OUTDEV