annotate libmpdemux/ai_oss.c @ 17409:8429927f02fc

sync to 1.218
author kraymer
date Mon, 16 Jan 2006 22:57:56 +0000
parents dfbe8cd0e081
children d2d9d011203f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7213
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
1 #include <stdio.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
2 #include <stdlib.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
3
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
4 #include "config.h"
7091
2459fcc7baaf Martin Olschewski <olschewski@zpr.uni-koeln.de>: [PATCH] ai_oss.c should check for USE_OSS_AUDIO
alex
parents: 7066
diff changeset
5
10537
31f12f99118b v4l2 support
henry
parents: 7528
diff changeset
6 #if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)) && defined(USE_OSS_AUDIO)
7213
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
7
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
8 #include <string.h> /* strerror */
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
9 #include <fcntl.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
10 #include <errno.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
11 #include <sys/ioctl.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
12
7066
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
13 #ifdef HAVE_SYS_SOUNDCARD_H
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
14 #include <sys/soundcard.h>
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
15 #else
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
16 #ifdef HAVE_SOUNDCARD_H
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
17 #include <soundcard.h>
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
18 #else
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
19 #include <linux/soundcard.h>
7066
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
20 #endif
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
21 #endif
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
22
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
23 #include "audio_in.h"
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
24 #include "mp_msg.h"
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
25 #include "help_mp.h"
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
26
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
27 int ai_oss_set_samplerate(audio_in_t *ai)
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
28 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
29 int tmp = ai->req_samplerate;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
30 if (ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &tmp) == -1) return -1;
11772
henry
parents: 10537
diff changeset
31 ai->samplerate = tmp;
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
32 return 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
33 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
34
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
35 int ai_oss_set_channels(audio_in_t *ai)
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
36 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
37 int err;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
38 int ioctl_param;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
39
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
40 if (ai->req_channels > 2)
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
41 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
42 ioctl_param = ai->req_channels;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
43 mp_msg(MSGT_TV, MSGL_V, "ioctl dsp channels: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
44 err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_CHANNELS, &ioctl_param));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
45 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
46 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetChanCount,
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
47 ai->req_channels);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
48 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
49 }
11878
10fb7a24b4fb fix some 10ls in sample rate handlin
attila
parents: 11772
diff changeset
50 ai->channels = ioctl_param;
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
51 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
52 else
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
53 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
54 ioctl_param = (ai->req_channels == 2);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
55 mp_msg(MSGT_TV, MSGL_V, "ioctl dsp stereo: %d (req: %d)\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
56 err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_STEREO, &ioctl_param),
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
57 ioctl_param);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
58 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
59 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetStereo,
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
60 ai->req_channels == 2);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
61 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
62 }
11878
10fb7a24b4fb fix some 10ls in sample rate handlin
attila
parents: 11772
diff changeset
63 ai->channels = ioctl_param ? 2 : 1;
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
64 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
65 return 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
66 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
67
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
68 int ai_oss_init(audio_in_t *ai)
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
69 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
70 int err;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
71 int ioctl_param;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
72
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
73 ai->oss.audio_fd = open(ai->oss.device, O_RDONLY);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
74 if (ai->oss.audio_fd < 0)
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
75 {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
76 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2Open,
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
77 ai->oss.device, strerror(errno));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
78 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
79 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
80
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
81 ioctl_param = 0 ;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
82 mp_msg(MSGT_TV, MSGL_V, "ioctl dsp getfmt: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
83 ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETFMTS, &ioctl_param));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
84
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
85 mp_msg(MSGT_TV, MSGL_V, "Supported formats: %x\n", ioctl_param);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
86 if (!(ioctl_param & AFMT_S16_LE))
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
87 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_UnsupportedFmt);
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
88
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
89 ioctl_param = AFMT_S16_LE;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
90 mp_msg(MSGT_TV, MSGL_V, "ioctl dsp setfmt: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
91 err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETFMT, &ioctl_param));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
92 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
93 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetAudioFmt);
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
94 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
95 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
96
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
97 if (ai_oss_set_channels(ai) < 0) return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
98
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
99 ioctl_param = ai->req_samplerate;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
100 mp_msg(MSGT_TV, MSGL_V, "ioctl dsp speed: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
101 err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &ioctl_param));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
102 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
103 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetSamplerate,
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
104 ai->req_samplerate);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
105 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
106 }
11878
10fb7a24b4fb fix some 10ls in sample rate handlin
attila
parents: 11772
diff changeset
107 ai->samplerate = ioctl_param;
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
108
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
109 mp_msg(MSGT_TV, MSGL_V, "ioctl dsp trigger: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
110 ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETTRIGGER, &ioctl_param));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
111 mp_msg(MSGT_TV, MSGL_V, "trigger: %x\n", ioctl_param);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
112 ioctl_param = PCM_ENABLE_INPUT;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
113 mp_msg(MSGT_TV, MSGL_V, "ioctl dsp trigger: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
114 err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETTRIGGER, &ioctl_param));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
115 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
116 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetTrigger,
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
117 PCM_ENABLE_INPUT);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
118 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
119
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
120 ai->blocksize = 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
121 mp_msg(MSGT_TV, MSGL_V, "ioctl dsp getblocksize: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
122 err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETBLKSIZE, &ai->blocksize));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
123 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
124 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2GetBlockSize);
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
125 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
126 mp_msg(MSGT_TV, MSGL_V, "blocksize: %d\n", ai->blocksize);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
127
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
128 // correct the blocksize to a reasonable value
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
129 if (ai->blocksize <= 0) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
130 ai->blocksize = 4096*ai->channels*2;
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
131 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_AudioBlockSizeZero, ai->blocksize);
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
132 } else if (ai->blocksize < 4096*ai->channels*2) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
133 ai->blocksize *= 4096*ai->channels*2/ai->blocksize;
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
134 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_AudioBlockSize2Low, ai->blocksize);
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
135 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
136
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
137 ai->samplesize = 16;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
138 ai->bytes_per_sample = 2;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
139
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
140 return 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
141 }
7091
2459fcc7baaf Martin Olschewski <olschewski@zpr.uni-koeln.de>: [PATCH] ai_oss.c should check for USE_OSS_AUDIO
alex
parents: 7066
diff changeset
142
2459fcc7baaf Martin Olschewski <olschewski@zpr.uni-koeln.de>: [PATCH] ai_oss.c should check for USE_OSS_AUDIO
alex
parents: 7066
diff changeset
143 #endif /* USE_OSS_AUDIO */