29 #include <soundcard.h>
31 #include <sys/soundcard.h>
35 #include <sys/ioctl.h>
45 #define AUDIO_BLOCK_SIZE 4096
54 unsigned int flip_left : 1;
64 char *
flip = getenv(
"AUDIO_FLIP_LEFT");
75 if (flip && *flip ==
'1') {
81 if (fcntl(audio_fd, F_SETFL, O_NONBLOCK) < 0) {
82 av_log(s1,
AV_LOG_WARNING,
"%s: Could not enable non block mode (%s)\n", audio_device, strerror(errno));
89 err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
92 if (tmp & AFMT_S16_BE) {
94 }
else if (tmp & AFMT_S16_LE) {
100 if (tmp & AFMT_S16_LE) {
102 }
else if (tmp & AFMT_S16_BE) {
121 err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp);
128 err = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
135 err = ioctl(audio_fd, SNDCTL_DSP_SPEED, &tmp);
189 if (ret < 0 && (errno != EAGAIN && errno != EINTR))
241 struct audio_buf_info abufi;
250 if (ret<0)
return AVERROR(errno);
258 if (ioctl(s->
fd, SNDCTL_DSP_GETISPACE, &abufi) == 0) {
259 bdelay += abufi.bytes;
269 short *p = (
short *) pkt->
data;
271 for (i = 0; i <
ret; i += 4) {
294 static const AVClass oss_demuxer_class = {
309 .priv_class = &oss_demuxer_class,
313 #if CONFIG_OSS_OUTDEV