Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
dd2f4469
Commit
dd2f4469
authored
Jul 18, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PulseAudio: cosmetics and comments
parent
43d10805
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
38 deletions
+23
-38
modules/audio_output/pulse.c
modules/audio_output/pulse.c
+23
-38
No files found.
modules/audio_output/pulse.c
View file @
dd2f4469
...
@@ -46,7 +46,14 @@ vlc_module_begin ()
...
@@ -46,7 +46,14 @@ vlc_module_begin ()
set_callbacks
(
Open
,
Close
)
set_callbacks
(
Open
,
Close
)
vlc_module_end
()
vlc_module_end
()
/* TODO: single static mainloop */
/* TODO:
* - single static mainloop
* - pause input on policy event
* - resample to compensate for long term drift
* - select music or video stream property correctly (?)
* - set further appropriate stream properties
* - update output devices list dynamically
*/
/* NOTE:
/* NOTE:
* Be careful what you do when the PulseAudio mainloop is held, which is to say
* Be careful what you do when the PulseAudio mainloop is held, which is to say
...
@@ -61,10 +68,9 @@ struct aout_sys_t
...
@@ -61,10 +68,9 @@ struct aout_sys_t
pa_threaded_mainloop
*
mainloop
;
/**< PulseAudio event loop */
pa_threaded_mainloop
*
mainloop
;
/**< PulseAudio event loop */
pa_volume_t
base_volume
;
/**< 0dB reference volume */
pa_volume_t
base_volume
;
/**< 0dB reference volume */
pa_cvolume
cvolume
;
/**< actual sink input volume */
pa_cvolume
cvolume
;
/**< actual sink input volume */
//uint32_t byterate; /**< bytes per second */
};
};
/*
Context helpers
*/
/*
** Context helpers **
*/
static
void
context_state_cb
(
pa_context
*
c
,
void
*
userdata
)
static
void
context_state_cb
(
pa_context
*
c
,
void
*
userdata
)
{
{
pa_threaded_mainloop
*
mainloop
=
userdata
;
pa_threaded_mainloop
*
mainloop
=
userdata
;
...
@@ -96,7 +102,7 @@ static void error(aout_instance_t *aout, const char *msg, pa_context *context)
...
@@ -96,7 +102,7 @@ static void error(aout_instance_t *aout, const char *msg, pa_context *context)
msg_Err
(
aout
,
"%s: %s"
,
msg
,
pa_strerror
(
pa_context_errno
(
context
)));
msg_Err
(
aout
,
"%s: %s"
,
msg
,
pa_strerror
(
pa_context_errno
(
context
)));
}
}
/*
Sink
*/
/*
** Sink **
*/
static
void
sink_list_cb
(
pa_context
*
c
,
const
pa_sink_info
*
i
,
int
eol
,
static
void
sink_list_cb
(
pa_context
*
c
,
const
pa_sink_info
*
i
,
int
eol
,
void
*
userdata
)
void
*
userdata
)
{
{
...
@@ -136,7 +142,7 @@ static void sink_info_cb(pa_context *c, const pa_sink_info *i, int eol,
...
@@ -136,7 +142,7 @@ static void sink_info_cb(pa_context *c, const pa_sink_info *i, int eol,
msg_Dbg
(
aout
,
"base volume: %f"
,
pa_sw_volume_to_linear
(
sys
->
base_volume
));
msg_Dbg
(
aout
,
"base volume: %f"
,
pa_sw_volume_to_linear
(
sys
->
base_volume
));
}
}
/*
Stream helpers
*/
/*
** Stream helpers **
*/
static
void
stream_state_cb
(
pa_stream
*
s
,
void
*
userdata
)
static
void
stream_state_cb
(
pa_stream
*
s
,
void
*
userdata
)
{
{
pa_threaded_mainloop
*
mainloop
=
userdata
;
pa_threaded_mainloop
*
mainloop
=
userdata
;
...
@@ -238,9 +244,9 @@ static void *data_convert(block_t **pp)
...
@@ -238,9 +244,9 @@ static void *data_convert(block_t **pp)
return
block
->
p_buffer
;
return
block
->
p_buffer
;
}
}
/**
***************************************************************************
/**
*
Play: play a sound samples buffer
*
Queue one audio frame to the playabck stream
*
****************************************************************************
/
*/
static
void
Play
(
aout_instance_t
*
aout
)
static
void
Play
(
aout_instance_t
*
aout
)
{
{
aout_sys_t
*
sys
=
aout
->
output
.
p_sys
;
aout_sys_t
*
sys
=
aout
->
output
.
p_sys
;
...
@@ -260,29 +266,6 @@ static void Play(aout_instance_t *aout)
...
@@ -260,29 +266,6 @@ static void Play(aout_instance_t *aout)
msg_Dbg
(
aout
,
"uncorking"
);
msg_Dbg
(
aout
,
"uncorking"
);
}
}
#if 0
/* This function should be called by the LibVLC core a header of time,
* but not more than AOUT_MAX_PREPARE. The PulseAudio latency should be
* shorter than that (though it might not be the case with some evil piece
* of audio output hardware). So we may need to trigger playback early,
* (that is to say, short cut the PulseAudio prebuffering). Otherwise,
* audio and video may be out of synchronization. */
pa_usec_t latency;
int negative;
if (pa_stream_get_latency(s, &latency, &negative) < 0) {
/* Especially at start of stream, latency may not be known (yet). */
if (pa_context_errno(sys->context) != PA_ERR_NODATA)
error(aout, "cannot determine latency", sys->context);
} else {
mtime_t gap = aout_FifoFirstDate(&aout->output.fifo) - mdate()
- latency;
if (gap > AOUT_PTS_TOLERANCE)
msg_Dbg(aout, "buffer too early (%"PRId64" us)", gap);
else if (gap < -AOUT_PTS_TOLERANCE)
msg_Err(aout, "buffer too late (%"PRId64" us)", -gap);
}
#endif
#if 0 /* Fault injector to test underrun recovery */
#if 0 /* Fault injector to test underrun recovery */
static unsigned u = 0;
static unsigned u = 0;
if ((++u % 500) == 0) {
if ((++u % 500) == 0) {
...
@@ -317,6 +300,9 @@ static void Play(aout_instance_t *aout)
...
@@ -317,6 +300,9 @@ static void Play(aout_instance_t *aout)
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
}
}
/**
* Cork or uncork the playback stream
*/
static
void
Pause
(
aout_instance_t
*
aout
,
bool
b_paused
,
mtime_t
i_date
)
static
void
Pause
(
aout_instance_t
*
aout
,
bool
b_paused
,
mtime_t
i_date
)
{
{
aout_sys_t
*
sys
=
aout
->
output
.
p_sys
;
aout_sys_t
*
sys
=
aout
->
output
.
p_sys
;
...
@@ -391,9 +377,9 @@ static int StreamMove(vlc_object_t *obj, const char *varname, vlc_value_t old,
...
@@ -391,9 +377,9 @@ static int StreamMove(vlc_object_t *obj, const char *varname, vlc_value_t old,
}
}
/**
***************************************************************************
/**
*
Open: open the audio device
*
Create a PulseAudio playback stream, a.k.a. a sink input.
*
****************************************************************************
/
*/
static
int
Open
(
vlc_object_t
*
obj
)
static
int
Open
(
vlc_object_t
*
obj
)
{
{
aout_instance_t
*
aout
=
(
aout_instance_t
*
)
obj
;
aout_instance_t
*
aout
=
(
aout_instance_t
*
)
obj
;
...
@@ -523,7 +509,6 @@ static int Open(vlc_object_t *obj)
...
@@ -523,7 +509,6 @@ static int Open(vlc_object_t *obj)
aout
->
output
.
p_sys
=
sys
;
aout
->
output
.
p_sys
=
sys
;
sys
->
context
=
NULL
;
sys
->
context
=
NULL
;
sys
->
stream
=
NULL
;
sys
->
stream
=
NULL
;
//sys->byterate = byterate;
/* Channel volume */
/* Channel volume */
sys
->
base_volume
=
PA_VOLUME_NORM
;
sys
->
base_volume
=
PA_VOLUME_NORM
;
...
@@ -610,9 +595,9 @@ fail:
...
@@ -610,9 +595,9 @@ fail:
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
/**
***************************************************************************
/**
*
Close: close the audio device
*
Removes a PulseAudio playback stream
*
****************************************************************************
/
*/
static
void
Close
(
vlc_object_t
*
obj
)
static
void
Close
(
vlc_object_t
*
obj
)
{
{
aout_instance_t
*
aout
=
(
aout_instance_t
*
)
obj
;
aout_instance_t
*
aout
=
(
aout_instance_t
*
)
obj
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment