Mercurial > mplayer.hg
annotate libao2/ao_v4l2.c @ 29597:ab9cec67f2a9
Move OpenGL test below CoreVideo. This ensures -lGL will come after -framework OpenGL which
resolves vo_corevideo crashes due to namespace conflicts (e.g. glEnable, glBegin, ...).
author | reimar |
---|---|
date | Fri, 04 Sep 2009 07:57:06 +0000 |
parents | 0f1b5b68af32 |
children | 6fc02905e992 |
rev | line source |
---|---|
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
1 /* |
26743
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
2 * audio output for V4L2 hardware MPEG decoders |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
3 * |
26743
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
4 * WARNING: You need to force -ac hwmpa for audio output to work. |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
5 * |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
6 * Copyright (C) 2007 Benjamin Zores |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
7 * |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
8 * This file is part of MPlayer. |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
9 * |
26743
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
10 * MPlayer is free software; you can redistribute it and/or modify |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
13 * (at your option) any later version. |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
14 * |
26743
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
15 * MPlayer is distributed in the hope that it will be useful, |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
18 * GNU General Public License for more details. |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
19 * |
26743
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
20 * You should have received a copy of the GNU General Public License along |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
21 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23905
diff
changeset
|
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
23 */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
24 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
25 #include <inttypes.h> |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
26 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
27 #include "config.h" |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
28 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
29 #include "mp_msg.h" |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
30 #include "help_mp.h" |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
31 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
32 #include "audio_out.h" |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
33 #include "audio_out_internal.h" |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
34 #include "libaf/af_format.h" |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
35 #include "libmpdemux/mpeg_packetizer.h" |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
36 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
37 #define MPEG_AUDIO_ID 0x1C0 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
38 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
39 static int freq = 0; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
40 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28823
diff
changeset
|
41 static const ao_info_t info = |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
42 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
43 "V4L2 MPEG Audio Decoder output", |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
44 "v4l2", |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
45 "Benjamin Zores", |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
46 "" |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
47 }; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
48 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
49 LIBAO_EXTERN (v4l2) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
50 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
51 /* to set/get/query special features/parameters */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
52 static int |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
53 control (int cmd,void *arg) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
54 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
55 return CONTROL_UNKNOWN; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
56 } |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
57 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
58 /* open & setup audio device */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
59 static int |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
60 init (int rate, int channels, int format, int flags) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
61 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
62 extern int v4l2_fd; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
63 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
64 if (v4l2_fd < 0) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
65 return 0; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
66 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
67 if (format != AF_FORMAT_MPEG2) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
68 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
69 mp_msg (MSGT_AO, MSGL_FATAL, |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
70 "AO: [v4l2] can only handle MPEG audio streams.\n"); |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
71 return 0; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
72 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28823
diff
changeset
|
73 |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
74 ao_data.outburst = 2048; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
75 ao_data.samplerate = rate; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
76 ao_data.channels = channels; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
77 ao_data.format = AF_FORMAT_MPEG2; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
78 ao_data.buffersize = 2048; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
79 ao_data.bps = rate * 2 * 2; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
80 ao_data.pts = 0; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
81 freq = rate; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
82 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
83 /* check for supported audio rate */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
84 if (rate != 32000 || rate != 41000 || rate != 48000) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
85 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
86 mp_msg (MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_UnsupSamplerate, rate); |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
87 rate = 48000; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
88 } |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
89 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
90 return 1; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
91 } |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
92 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
93 /* close audio device */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
94 static void |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
95 uninit (int immed) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
96 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
97 /* nothing to do */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
98 } |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
99 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
100 /* stop playing and empty buffers (for seeking/pause) */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
101 static void |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
102 reset (void) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
103 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
104 /* nothing to do */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
105 } |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
106 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
107 /* stop playing, keep buffers (for pause) */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
108 static void |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
109 audio_pause (void) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
110 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
111 reset (); |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
112 } |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
113 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
114 /* resume playing, after audio_pause() */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
115 static void |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
116 audio_resume (void) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
117 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
118 /* nothing to do */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
119 } |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
120 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
121 /* how many bytes can be played without blocking */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
122 static int |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
123 get_space (void) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
124 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
125 extern int vo_pts; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
126 float x; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
127 int y; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
128 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
129 x = (float) (vo_pts - ao_data.pts) / 90000.0; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
130 if (x <= 0) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
131 return 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28823
diff
changeset
|
132 |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
133 y = freq * 4 * x; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
134 y /= ao_data.outburst; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
135 y *= ao_data.outburst; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28823
diff
changeset
|
136 |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
137 if (y > 32000) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
138 y = 32000; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
139 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
140 return y; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
141 } |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
142 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
143 /* number of bytes played */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
144 static int |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
145 play (void *data, int len, int flags) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
146 { |
28051 | 147 int v4l2_write (unsigned char *data, int len); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28823
diff
changeset
|
148 |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
149 if (ao_data.format != AF_FORMAT_MPEG2) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
150 return 0; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
151 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
152 send_mpeg_pes_packet (data, len, MPEG_AUDIO_ID, ao_data.pts, 2, v4l2_write); |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
153 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
154 return len; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
155 } |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
156 |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
157 /* delay in seconds between first and last sample in buffer */ |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
158 static float |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
159 get_delay (void) |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
160 { |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
161 return 0.0; |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff
changeset
|
162 } |