LiVES
2.8.3
Main Page
Namespaces
Data Structures
Files
File List
Globals
src
pulse.h
Go to the documentation of this file.
1
// pulse.h
2
// LiVES (lives-exe)
3
// (c) G. Finch 2005 - 2012
4
// Released under the GPL 3 or later
5
// see file ../COPYING for licensing details
6
7
#ifdef HAVE_PULSE_AUDIO
8
9
#include <pulse/context.h>
10
#include <pulse/thread-mainloop.h>
11
#include <pulse/introspect.h>
12
#include <pulse/stream.h>
13
#include <pulse/proplist.h>
14
#include <pulse/error.h>
15
16
#define PULSE_MAX_OUTPUT_CHANS PA_CHANNEL_POSITION_MAX
17
18
#define LIVES_PA_BUFF_MAXLEN 16384
19
#define LIVES_PA_BUFF_TARGET 1024
20
#define LIVES_PA_BUFF_FRAGSIZE 1024
21
22
typedef
struct
{
23
size_t
size;
24
size_t
max_size;
25
void
*data;
26
} audio_buffer_t;
27
28
29
typedef
struct
{
30
pa_threaded_mainloop *mloop;
31
pa_context *con;
32
pa_stream *pstream;
33
pa_proplist *pa_props;
34
35
pa_usec_t usec_start;
36
37
int
str_idx;
38
39
pa_context_state_t state;
40
41
// app side
42
int64_t in_arate;
43
uint64_t in_achans;
44
uint64_t in_asamps;
45
46
// server side
47
int64_t out_arate;
48
uint64_t out_achans;
49
uint64_t out_asamps;
50
51
uint64_t out_chans_available;
52
53
int
in_signed;
54
int
in_endian;
55
56
int
out_signed;
57
int
out_endian;
58
59
uint64_t num_calls;
61
audio_buffer_t *aPlayPtr;
62
lives_audio_loop_t
loop;
63
64
uint8_t *sound_buffer;
65
66
float
volume[PULSE_MAX_OUTPUT_CHANS];
67
68
boolean
in_use;
69
boolean
mute;
70
72
volatile
aserver_message_t
*msgq;
73
74
volatile
uint64_t frames_written;
75
76
boolean
is_paused;
77
78
volatile
int64_t audio_ticks;
79
80
int
fd;
81
boolean
is_opening;
82
volatile
off_t seek_pos;
83
off_t seek_end;
84
boolean
usigned;
85
boolean
reverse_endian;
86
87
lives_whentostop_t
*whentostop;
88
volatile
lives_cancel_t
*cancelled;
89
90
/* variables used for trying to restart the connection to pulse */
91
boolean
pulsed_died;
92
struct
timeval last_reconnect_attempt;
93
94
boolean
is_output;
95
96
int
playing_file;
97
98
lives_audio_buf_t
**abufs;
99
volatile
int
read_abuf;
100
101
uint64_t chunk_size;
102
103
volatile
int
astream_fd;
104
105
} pulse_driver_t;
106
107
108
109
// TODO - rationalise names
110
111
boolean
lives_pulse_init(
short
startup_phase);
112
113
int
pulse_audio_init(
void
);
114
int
pulse_audio_read_init(
void
);
// ditto
115
116
pulse_driver_t *pulse_get_driver(
boolean
is_output);
117
118
int
pulse_driver_activate(pulse_driver_t *);
119
void
pulse_close_client(pulse_driver_t *);
120
121
void
pulse_shutdown(
void
);
122
123
void
pulse_aud_pb_ready(
int
fileno);
124
125
size_t
pulse_flush_read_data(pulse_driver_t *,
int
fileno,
size_t
rbytes,
boolean
rev_endian,
void
*data);
126
127
void
pulse_driver_uncork(pulse_driver_t *);
128
129
boolean
pulse_try_reconnect(
void
);
130
131
// utils
132
volatile
aserver_message_t
*pulse_get_msgq(pulse_driver_t *);
133
134
int64_t pulse_audio_seek_bytes(pulse_driver_t *, int64_t bytes);
135
136
int64_t lives_pulse_get_time(pulse_driver_t *,
boolean
absolute);
137
138
double
lives_pulse_get_pos(pulse_driver_t *);
139
140
void
pa_mloop_lock(
void
);
141
void
pa_mloop_unlock(
void
);
142
143
145
146
boolean
pulse_audio_seek_frame(pulse_driver_t *,
int
frame);
147
148
void
pulse_get_rec_avals(pulse_driver_t *);
149
150
151
152
#endif
lives_audio_loop_t
lives_audio_loop_t
Definition:
audio.h:147
lives_audio_buf_t
Definition:
audio.h:78
lives_whentostop_t
lives_whentostop_t
which stream end should cause playback to finish ?
Definition:
main.h:416
aserver_message_t
Definition:
audio.h:60
lives_cancel_t
lives_cancel_t
cancel reason
Definition:
main.h:424
Generated on Wed Feb 15 2017 13:46:48 for LiVES by
1.8.11