annotate stream/ai_oss.c @ 35136:9d2c691272aa

Be more verbose if the pullup filter fails on initialisation.
author cehoyos
date Fri, 05 Oct 2012 08:24:13 +0000
parents ce0122361a39
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30426
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
1 /*
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
2 * This file is part of MPlayer.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
3 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
5 * it under the terms of the GNU General Public License as published by
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
7 * (at your option) any later version.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
8 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
12 * GNU General Public License for more details.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
13 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
14 * You should have received a copy of the GNU General Public License along
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
17 */
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 29263
diff changeset
18
7213
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
19 #include <stdio.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
20 #include <stdlib.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
21
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
22 #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
23
7213
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
24 #include <string.h> /* strerror */
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
25 #include <fcntl.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
26 #include <errno.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
27 #include <sys/ioctl.h>
13fcab6fde41 audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents: 7091
diff changeset
28
7066
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
29 #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
30 #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
31 #else
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
32 #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
33 #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
34 #else
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
35 #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
36 #endif
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
37 #endif
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
38
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
39 #include "audio_in.h"
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
40 #include "mp_msg.h"
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
41 #include "help_mp.h"
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
42
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
43 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
44 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
45 int tmp = ai->req_samplerate;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
46 if (ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &tmp) == -1) return -1;
11772
henry
parents: 10537
diff changeset
47 ai->samplerate = tmp;
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
48 return 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
49 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
50
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
51 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
52 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
53 int err;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
54 int ioctl_param;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
55
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
56 if (ai->req_channels > 2)
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
57 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
58 ioctl_param = ai->req_channels;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
59 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
60 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
61 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
62 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
63 ai->req_channels);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
64 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
65 }
11878
10fb7a24b4fb fix some 10ls in sample rate handlin
attila
parents: 11772
diff changeset
66 ai->channels = ioctl_param;
7060
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 else
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 ioctl_param = (ai->req_channels == 2);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
71 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
72 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
73 ioctl_param);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
74 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
75 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
76 ai->req_channels == 2);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
77 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
78 }
11878
10fb7a24b4fb fix some 10ls in sample rate handlin
attila
parents: 11772
diff changeset
79 ai->channels = ioctl_param ? 2 : 1;
7060
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 return 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
82 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
83
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
84 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
85 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
86 int err;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
87 int ioctl_param;
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 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
90 if (ai->oss.audio_fd < 0)
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
91 {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
92 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
93 ai->oss.device, strerror(errno));
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 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 19271
diff changeset
96
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
97 ioctl_param = 0 ;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
98 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
99 ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETFMTS, &ioctl_param));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 19271
diff changeset
100
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
101 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
102 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
103 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
104
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
105 ioctl_param = AFMT_S16_LE;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
106 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
107 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
108 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
109 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
110 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
111 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
112
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
113 if (ai_oss_set_channels(ai) < 0) return -1;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 19271
diff changeset
114
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
115 ioctl_param = ai->req_samplerate;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
116 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
117 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
118 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
119 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
120 ai->req_samplerate);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
121 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
122 }
11878
10fb7a24b4fb fix some 10ls in sample rate handlin
attila
parents: 11772
diff changeset
123 ai->samplerate = ioctl_param;
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
124
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
125 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
126 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
127 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
128 ioctl_param = PCM_ENABLE_INPUT;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
129 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
130 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
131 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
132 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
133 PCM_ENABLE_INPUT);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
134 }
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 ai->blocksize = 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
137 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
138 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
139 if (err < 0) {
16882
dfbe8cd0e081 libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents: 11878
diff changeset
140 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
141 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
142 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
143
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
144 // correct the blocksize to a reasonable value
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
145 if (ai->blocksize <= 0) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
146 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
147 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
148 } 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
149 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
150 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
151 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
152
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
153 ai->samplesize = 16;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
154 ai->bytes_per_sample = 2;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
155
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
156 return 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
157 }