Mercurial > mplayer.hg
annotate stream/ai_oss.c @ 24425:85ac033b16ef
Add support for FFmpeg Monkey's Audio decoder
author | uau |
---|---|
date | Thu, 13 Sep 2007 13:47:22 +0000 |
parents | 64d82a45a05d |
children | 0f1b5b68af32 |
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 |
7213
13fcab6fde41
audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents:
7091
diff
changeset
|
6 #include <string.h> /* strerror */ |
13fcab6fde41
audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents:
7091
diff
changeset
|
7 #include <fcntl.h> |
13fcab6fde41
audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents:
7091
diff
changeset
|
8 #include <errno.h> |
13fcab6fde41
audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents:
7091
diff
changeset
|
9 #include <sys/ioctl.h> |
13fcab6fde41
audio in layer is used only bu tvi_v4l, don't compile for others.
arpi
parents:
7091
diff
changeset
|
10 |
7066
e0255720a67c
fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents:
7060
diff
changeset
|
11 #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
|
12 #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
|
13 #else |
e0255720a67c
fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents:
7060
diff
changeset
|
14 #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
|
15 #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
|
16 #else |
7060
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
17 #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
|
18 #endif |
e0255720a67c
fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents:
7060
diff
changeset
|
19 #endif |
7060
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
20 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
21 #include "audio_in.h" |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
22 #include "mp_msg.h" |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
11878
diff
changeset
|
23 #include "help_mp.h" |
7060
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
24 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
25 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
|
26 { |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
27 int tmp = ai->req_samplerate; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
28 if (ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &tmp) == -1) return -1; |
11772 | 29 ai->samplerate = tmp; |
7060
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
30 return 0; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
31 } |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
32 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
33 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
|
34 { |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
35 int err; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
36 int ioctl_param; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
37 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
38 if (ai->req_channels > 2) |
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 ioctl_param = ai->req_channels; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
41 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
|
42 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
|
43 if (err < 0) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
11878
diff
changeset
|
44 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
|
45 ai->req_channels); |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
46 return -1; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
47 } |
11878 | 48 ai->channels = ioctl_param; |
7060
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 else |
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 ioctl_param = (ai->req_channels == 2); |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
53 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
|
54 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
|
55 ioctl_param); |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
56 if (err < 0) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
11878
diff
changeset
|
57 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
|
58 ai->req_channels == 2); |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
59 return -1; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
60 } |
11878 | 61 ai->channels = ioctl_param ? 2 : 1; |
7060
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
62 } |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
63 return 0; |
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 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
66 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
|
67 { |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
68 int err; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
69 int ioctl_param; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
70 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
71 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
|
72 if (ai->oss.audio_fd < 0) |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
73 { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
11878
diff
changeset
|
74 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
|
75 ai->oss.device, strerror(errno)); |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
76 return -1; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
77 } |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
78 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
79 ioctl_param = 0 ; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
80 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
|
81 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
|
82 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
83 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
|
84 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
|
85 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
|
86 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
87 ioctl_param = AFMT_S16_LE; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
88 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
|
89 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
|
90 if (err < 0) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
11878
diff
changeset
|
91 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
|
92 return -1; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
93 } |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
94 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
95 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
|
96 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
97 ioctl_param = ai->req_samplerate; |
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 speed: %d\n", |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
99 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
|
100 if (err < 0) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
11878
diff
changeset
|
101 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
|
102 ai->req_samplerate); |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
103 return -1; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
104 } |
11878 | 105 ai->samplerate = ioctl_param; |
7060
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
106 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
107 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
|
108 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
|
109 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
|
110 ioctl_param = PCM_ENABLE_INPUT; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
111 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
|
112 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
|
113 if (err < 0) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
11878
diff
changeset
|
114 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
|
115 PCM_ENABLE_INPUT); |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
116 } |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
117 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
118 ai->blocksize = 0; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
119 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
|
120 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
|
121 if (err < 0) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
11878
diff
changeset
|
122 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
|
123 } |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
124 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
|
125 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
126 // correct the blocksize to a reasonable value |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
127 if (ai->blocksize <= 0) { |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
128 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
|
129 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
|
130 } 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
|
131 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
|
132 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
|
133 } |
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 ai->samplesize = 16; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
136 ai->bytes_per_sample = 2; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
137 |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
138 return 0; |
b14880a6cccb
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff
changeset
|
139 } |