annotate libmpdemux/ai_oss.c @ 7081:66c2e2d0504f

- changed re-muxed packet structure (see struct dp_hdr_t) now the packets can be encapsulated into avi or other file formats - skip redundant/resent fragments (bit 0x20 set of first byte of frag)
author arpi
date Sat, 24 Aug 2002 22:39:27 +0000
parents e0255720a67c
children 2459fcc7baaf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
1 #include "config.h"
7066
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
2 #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
3 #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
4 #else
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
5 #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
6 #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
7 #else
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
8 #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
9 #endif
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
10 #endif
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
11 #include <fcntl.h>
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
12 #include <errno.h>
7066
e0255720a67c fix ai_oss.c compilation on non linux systems - by Bernd Ernesti <mplayer@lists.veego.de>
jaf
parents: 7060
diff changeset
13 #include <sys/ioctl.h>
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
14
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
15 #include "audio_in.h"
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
16 #include "mp_msg.h"
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
17
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
18 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
19 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
20 int tmp = ai->req_samplerate;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
21 if (ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &tmp) == -1) return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
22 ai->samplerate = ai->req_samplerate;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
23 return 0;
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
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
26 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
27 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
28 int err;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
29 int ioctl_param;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
30
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
31 if (ai->req_channels > 2)
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 ioctl_param = ai->req_channels;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
34 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
35 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
36 if (err < 0) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
37 mp_msg(MSGT_TV, MSGL_ERR, "Unable to set channel count: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
38 ai->req_channels);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
39 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
40 }
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 else
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
43 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
44 ioctl_param = (ai->req_channels == 2);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
45 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
46 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
47 ioctl_param);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
48 if (err < 0) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
49 mp_msg(MSGT_TV, MSGL_ERR, "Unable to set stereo: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
50 ai->req_channels == 2);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
51 return -1;
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 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
54 ai->channels = ai->req_channels;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
55 return 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
56 }
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 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
59 {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
60 int err;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
61 int ioctl_param;
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 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
64 if (ai->oss.audio_fd < 0)
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 mp_msg(MSGT_TV, MSGL_ERR, "unable to open '%s': %s\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
67 ai->oss.device, strerror(errno));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
68 return -1;
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
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
71 ioctl_param = 0 ;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
72 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
73 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
74
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
75 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
76 if (!(ioctl_param & AFMT_S16_LE))
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
77 mp_msg(MSGT_TV, MSGL_ERR, "notsupported format\n");
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 = AFMT_S16_LE;
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 setfmt: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
81 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
82 if (err < 0) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
83 mp_msg(MSGT_TV, MSGL_ERR, "Unable to set audio format.");
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
84 return -1;
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
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
87 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
88
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
89 ioctl_param = ai->req_samplerate;
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 speed: %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_SPEED, &ioctl_param));
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
92 if (err < 0) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
93 mp_msg(MSGT_TV, MSGL_ERR, "Unable to set samplerate: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
94 ai->req_samplerate);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
95 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 ai->samplerate = ai->req_samplerate;
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 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
100 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
101 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
102 ioctl_param = PCM_ENABLE_INPUT;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
103 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
104 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
105 if (err < 0) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
106 mp_msg(MSGT_TV, MSGL_ERR, "Unable to set trigger: %d\n",
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
107 PCM_ENABLE_INPUT);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
108 return -1;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
109 }
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
110
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
111 ai->blocksize = 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
112 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
113 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
114 if (err < 0) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
115 mp_msg(MSGT_TV, MSGL_ERR, "Unable to get block size!\n");
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 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
118
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
119 // correct the blocksize to a reasonable value
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
120 if (ai->blocksize <= 0) {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
121 ai->blocksize = 4096*ai->channels*2;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
122 mp_msg(MSGT_TV, MSGL_ERR, "audio block size is zero, setting to %d!\n", ai->blocksize);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
123 } 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
124 ai->blocksize *= 4096*ai->channels*2/ai->blocksize;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
125 mp_msg(MSGT_TV, MSGL_ERR, "audio block size too low, setting to %d!\n", ai->blocksize);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
126 }
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 ai->samplesize = 16;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
129 ai->bytes_per_sample = 2;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
130
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
131 return 0;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
132 }