annotate libao2/ao_v4l2.c @ 31313:b080b729c958

Indentation fix.
author reimar
date Sun, 13 Jun 2010 11:38:18 +0000
parents 6fc02905e992
children a3890036b137
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
30650
6fc02905e992 Add header for v4l2_write() instead of forward declaring it.
diego
parents: 29263
diff changeset
36 #include "libvo/vo_v4l2.h"
23905
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
37
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
38 #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
39
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
40 static int freq = 0;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
41
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28823
diff changeset
42 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
43 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
44 "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
45 "v4l2",
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
46 "Benjamin Zores",
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
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
50 LIBAO_EXTERN (v4l2)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
51
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
52 /* 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
53 static int
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
54 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
55 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
56 return CONTROL_UNKNOWN;
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
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
59 /* open & setup audio device */
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
60 static int
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
61 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
62 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
63 extern int v4l2_fd;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
64
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
65 if (v4l2_fd < 0)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
66 return 0;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
67
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
68 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
69 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
70 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
71 "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
72 return 0;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
73 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28823
diff changeset
74
23905
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
75 ao_data.outburst = 2048;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
76 ao_data.samplerate = rate;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
77 ao_data.channels = channels;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
78 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
79 ao_data.buffersize = 2048;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
80 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
81 ao_data.pts = 0;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
82 freq = rate;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
83
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
84 /* 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
85 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
86 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
87 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
88 rate = 48000;
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
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
91 return 1;
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
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
94 /* close audio device */
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
95 static void
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
96 uninit (int immed)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
97 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
98 /* nothing to do */
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
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
101 /* 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
102 static void
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
103 reset (void)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
104 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
105 /* nothing to do */
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
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
108 /* 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
109 static void
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
110 audio_pause (void)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
111 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
112 reset ();
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
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
115 /* 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
116 static void
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
117 audio_resume (void)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
118 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
119 /* nothing to do */
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
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
122 /* 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
123 static int
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
124 get_space (void)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
125 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
126 extern int vo_pts;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
127 float x;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
128 int y;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
129
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
130 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
131 if (x <= 0)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
132 return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28823
diff changeset
133
23905
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
134 y = freq * 4 * x;
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;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
136 y *= ao_data.outburst;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28823
diff changeset
137
23905
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
138 if (y > 32000)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
139 y = 32000;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
140
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
141 return y;
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
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
144 /* number of bytes played */
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
145 static int
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
146 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
147 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
148 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
149 return 0;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
150
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
151 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
152
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
153 return len;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
154 }
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 /* 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
157 static float
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
158 get_delay (void)
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
159 {
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
160 return 0.0;
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
diff changeset
161 }