annotate stream/audio_in.h @ 29691:183ea012e25b

Change grow_array argument from void ** to void *, this avoids a aliasing violation (thus making gcc 4.4.x compile the code correctly) and allows to get rid of some casts at the expense of making the code less clear.
author reimar
date Wed, 30 Sep 2009 07:27:43 +0000
parents 0f1b5b68af32
children ce0122361a39
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 23689
diff changeset
1 #ifndef MPLAYER_AUDIO_IN_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 23689
diff changeset
2 #define MPLAYER_AUDIO_IN_H
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
3
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
4 #define AUDIO_IN_ALSA 1
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
5 #define AUDIO_IN_OSS 2
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
6
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
7 #include "config.h"
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
8
27390
9d95dc936e66 Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents: 27387
diff changeset
9 #ifdef CONFIG_ALSA
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
10 #include <alsa/asoundlib.h>
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
11
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
12 typedef struct {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
13 char *device;
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 snd_pcm_t *handle;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
16 snd_output_t *log;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
17 int buffer_time, period_time, chunk_size;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
18 size_t bits_per_sample, bits_per_frame;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
19 } ai_alsa_t;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
20 #endif
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
21
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26029
diff changeset
22 #ifdef CONFIG_OSS_AUDIO
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
23 typedef struct {
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
24 char *device;
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 audio_fd;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
27 } ai_oss_t;
8600
54eac4cf587c Lots of functions and variables specific to OSS audio are used without
arpi
parents: 7584
diff changeset
28 #endif
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
29
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27390
diff changeset
30 typedef struct
7060
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 int type;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
33 int setup;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27390
diff changeset
34
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
35 /* requested values */
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
36 int req_channels;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
37 int req_samplerate;
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 /* real values read-only */
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
40 int channels;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
41 int samplerate;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
42 int blocksize;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
43 int bytes_per_sample;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
44 int samplesize;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27390
diff changeset
45
27390
9d95dc936e66 Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents: 27387
diff changeset
46 #ifdef CONFIG_ALSA
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
47 ai_alsa_t alsa;
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
48 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26029
diff changeset
49 #ifdef CONFIG_OSS_AUDIO
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
50 ai_oss_t oss;
8600
54eac4cf587c Lots of functions and variables specific to OSS audio are used without
arpi
parents: 7584
diff changeset
51 #endif
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
52 } audio_in_t;
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 int audio_in_init(audio_in_t *ai, int type);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
55 int audio_in_setup(audio_in_t *ai);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
56 int audio_in_set_device(audio_in_t *ai, char *device);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
57 int audio_in_set_samplerate(audio_in_t *ai, int rate);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
58 int audio_in_set_channels(audio_in_t *ai, int channels);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
59 int audio_in_uninit(audio_in_t *ai);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
60 int audio_in_start_capture(audio_in_t *ai);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
61 int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
62
27390
9d95dc936e66 Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents: 27387
diff changeset
63 #ifdef CONFIG_ALSA
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
64 int ai_alsa_setup(audio_in_t *ai);
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
65 int ai_alsa_init(audio_in_t *ai);
7584
838ee1b00853 this patch adds an ability to recover from audio buffer cross-run by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
alex
parents: 7060
diff changeset
66 int ai_alsa_xrun(audio_in_t *ai);
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
67 #endif
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
68
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26029
diff changeset
69 #ifdef CONFIG_OSS_AUDIO
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
70 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
71 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
72 int ai_oss_init(audio_in_t *ai);
8600
54eac4cf587c Lots of functions and variables specific to OSS audio are used without
arpi
parents: 7584
diff changeset
73 #endif
7060
b14880a6cccb new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
diff changeset
74
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 23689
diff changeset
75 #endif /* MPLAYER_AUDIO_IN_H */