Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
e071592a
Commit
e071592a
authored
Aug 02, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout: pass audio buffer explicitly to pf_play
parent
b616e265
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
68 additions
and
91 deletions
+68
-91
include/vlc_aout.h
include/vlc_aout.h
+2
-1
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+7
-6
modules/audio_output/amem.c
modules/audio_output/amem.c
+4
-8
modules/audio_output/audioqueue.c
modules/audio_output/audioqueue.c
+3
-3
modules/audio_output/auhal.c
modules/audio_output/auhal.c
+3
-3
modules/audio_output/directx.c
modules/audio_output/directx.c
+6
-12
modules/audio_output/file.c
modules/audio_output/file.c
+2
-6
modules/audio_output/jack.c
modules/audio_output/jack.c
+3
-3
modules/audio_output/opensles_android.c
modules/audio_output/opensles_android.c
+20
-26
modules/audio_output/oss.c
modules/audio_output/oss.c
+3
-3
modules/audio_output/portaudio.c
modules/audio_output/portaudio.c
+3
-3
modules/audio_output/pulse.c
modules/audio_output/pulse.c
+1
-5
modules/audio_output/sdl.c
modules/audio_output/sdl.c
+3
-3
modules/audio_output/waveout.c
modules/audio_output/waveout.c
+5
-4
src/audio_output/aout_internal.h
src/audio_output/aout_internal.h
+1
-1
src/audio_output/output.c
src/audio_output/output.c
+1
-4
src/libvlccore.sym
src/libvlccore.sym
+1
-0
No files found.
include/vlc_aout.h
View file @
e071592a
...
...
@@ -179,7 +179,7 @@ struct audio_output
aout_fifo_t
fifo
;
struct
aout_sys_t
*
sys
;
/**< Output plugin private data */
void
(
*
pf_play
)(
audio_output_t
*
);
/**< Audio buffer callback */
void
(
*
pf_play
)(
audio_output_t
*
,
block_t
*
);
/**< Audio buffer callback */
void
(
*
pf_pause
)(
audio_output_t
*
,
bool
,
mtime_t
);
/**< Pause/resume
callback (optional, may be NULL) */
void
(
*
pf_flush
)(
audio_output_t
*
,
bool
);
/**< Flush/drain callback
...
...
@@ -254,6 +254,7 @@ VLC_API const char * aout_FormatPrintChannels( const audio_sample_format_t * ) V
VLC_API
mtime_t
aout_FifoFirstDate
(
const
aout_fifo_t
*
)
VLC_USED
;
VLC_API
aout_buffer_t
*
aout_FifoPop
(
aout_fifo_t
*
p_fifo
)
VLC_USED
;
VLC_API
void
aout_FifoPush
(
aout_fifo_t
*
,
block_t
*
);
VLC_API
void
aout_VolumeNoneInit
(
audio_output_t
*
);
VLC_API
void
aout_VolumeSoftInit
(
audio_output_t
*
);
...
...
modules/audio_output/alsa.c
View file @
e071592a
...
...
@@ -85,7 +85,7 @@ struct aout_sys_t
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
void
*
ALSAThread
(
void
*
);
static
void
ALSAFill
(
audio_output_t
*
);
static
int
FindDevicesCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_name
,
...
...
@@ -522,20 +522,21 @@ error:
return
VLC_EGENERIC
;
}
static
void
PlayIgnore
(
audio_output_t
*
p_aout
)
{
/* Already playing - nothing to do */
(
void
)
p_aout
;
static
void
PlayIgnore
(
audio_output_t
*
p_aout
,
block_t
*
block
)
{
aout_FifoPush
(
&
p_aout
->
fifo
,
block
)
;
}
/*****************************************************************************
* Play: start playback
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
block
)
{
p_aout
->
pf_play
=
PlayIgnore
;
/* get the playing date of the first aout buffer */
p_aout
->
sys
->
start_date
=
aout_FifoFirstDate
(
&
p_aout
->
fifo
);
p_aout
->
sys
->
start_date
=
block
->
i_pts
;
aout_FifoPush
(
&
p_aout
->
fifo
,
block
);
/* wake up the audio output thread */
sem_post
(
&
p_aout
->
sys
->
wait
);
...
...
modules/audio_output/amem.c
View file @
e071592a
...
...
@@ -59,17 +59,13 @@ struct aout_sys_t
void
(
*
cleanup
)
(
void
*
opaque
);
};
static
void
Play
(
audio_output_t
*
aout
)
static
void
Play
(
audio_output_t
*
aout
,
block_t
*
block
)
{
aout_sys_t
*
sys
=
aout
->
sys
;
block_t
*
block
;
while
((
block
=
aout_FifoPop
(
&
aout
->
fifo
))
!=
NULL
)
{
sys
->
play
(
sys
->
opaque
,
block
->
p_buffer
,
block
->
i_nb_samples
,
block
->
i_pts
);
block_Release
(
block
);
}
sys
->
play
(
sys
->
opaque
,
block
->
p_buffer
,
block
->
i_nb_samples
,
block
->
i_pts
);
block_Release
(
block
);
}
static
int
VolumeSet
(
audio_output_t
*
aout
,
float
vol
,
bool
mute
)
...
...
modules/audio_output/audioqueue.c
View file @
e071592a
...
...
@@ -54,7 +54,7 @@ struct aout_sys_t
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
void
AudioQueueCallback
(
void
*
,
AudioQueueRef
,
AudioQueueBufferRef
);
/*****************************************************************************
...
...
@@ -135,9 +135,9 @@ static int Open ( vlc_object_t *p_this )
/*****************************************************************************
* Play: play a sound samples buffer
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
block
)
{
VLC_UNUSED
(
p_aout
);
aout_FifoPush
(
&
p_aout
->
fifo
,
block
);
}
/*****************************************************************************
...
...
modules/audio_output/auhal.c
View file @
e071592a
...
...
@@ -112,7 +112,7 @@ static int OpenAnalog ( audio_output_t * );
static
int
OpenSPDIF
(
audio_output_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
void
Probe
(
audio_output_t
*
);
static
int
AudioDeviceHasOutput
(
AudioDeviceID
);
...
...
@@ -910,9 +910,9 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Play: nothing to do
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
block
)
{
VLC_UNUSED
(
p_aout
);
aout_FifoPush
(
&
p_aout
->
fifo
,
block
);
}
...
...
modules/audio_output/directx.c
View file @
e071592a
...
...
@@ -94,7 +94,7 @@ struct aout_sys_t
*****************************************************************************/
static
int
OpenAudio
(
vlc_object_t
*
);
static
void
CloseAudio
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
/* local functions */
static
void
Probe
(
audio_output_t
*
);
...
...
@@ -569,29 +569,23 @@ static void Probe( audio_output_t * p_aout )
* we know the first buffer has been put in the aout fifo and we also
* know its date.
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
p_buffer
)
{
if
(
!
p_aout
->
sys
->
b_playing
)
{
aout_buffer_t
*
p_buffer
;
p_aout
->
sys
->
b_playing
=
1
;
/* get the playing date of the first aout buffer */
p_aout
->
sys
->
p_notif
->
start_date
=
aout_FifoFirstDate
(
&
p_aout
->
fifo
);
p_aout
->
sys
->
p_notif
->
start_date
=
p_buffer
->
i_pts
;
/* fill in the first samples */
for
(
int
i
=
0
;
i
<
FRAMES_NUM
;
i
++
)
{
p_buffer
=
aout_FifoPop
(
&
p_aout
->
fifo
);
if
(
!
p_buffer
)
break
;
FillBuffer
(
p_aout
,
i
,
p_buffer
);
}
FillBuffer
(
p_aout
,
0
,
p_buffer
);
/* wake up the audio output thread */
SetEvent
(
p_aout
->
sys
->
p_notif
->
event
);
}
else
aout_FifoPush
(
&
p_aout
->
fifo
,
p_buffer
);
}
/*****************************************************************************
...
...
modules/audio_output/file.c
View file @
e071592a
...
...
@@ -73,7 +73,7 @@ static const int pi_channels_maps[CHANNELS_MAX+1] =
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
/*****************************************************************************
* Module descriptor
...
...
@@ -316,12 +316,8 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Play: pretend to play a sound
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
p_buffer
)
{
aout_buffer_t
*
p_buffer
;
p_buffer
=
aout_FifoPop
(
&
p_aout
->
fifo
);
if
(
fwrite
(
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
,
1
,
p_aout
->
sys
->
p_file
)
!=
1
)
{
...
...
modules/audio_output/jack.c
View file @
e071592a
...
...
@@ -62,7 +62,7 @@ struct aout_sys_t
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
int
Process
(
jack_nframes_t
i_frames
,
void
*
p_arg
);
static
int
GraphChange
(
void
*
p_arg
);
...
...
@@ -334,9 +334,9 @@ static int GraphChange( void *p_arg )
/*****************************************************************************
* Play: nothing to do
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
block
)
{
VLC_UNUSED
(
p_aout
);
aout_FifoPush
(
&
p_aout
->
fifo
,
block
);
}
/*****************************************************************************
...
...
modules/audio_output/opensles_android.c
View file @
e071592a
...
...
@@ -75,7 +75,7 @@ typedef SLresult (*slCreateEngine_t)(
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
void
PlayedCallback
(
SLAndroidSimpleBufferQueueItf
caller
,
void
*
pContext
);
/*****************************************************************************
...
...
@@ -291,42 +291,36 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Play: play a sound
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
p_buffer
)
{
aout_sys_t
*
p_sys
=
p_aout
->
sys
;
aout_buffer_t
*
p_buffer
;
SLresult
result
;
p_buffer
=
aout_FifoPop
(
&
p_aout
->
fifo
);
if
(
p_buffer
!=
NULL
)
for
(;;)
{
for
(;;)
{
result
=
(
*
p_sys
->
playerBufferQueue
)
->
Enqueue
(
result
=
(
*
p_sys
->
playerBufferQueue
)
->
Enqueue
(
p_sys
->
playerBufferQueue
,
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
);
if
(
result
==
SL_RESULT_SUCCESS
)
break
;
if
(
result
!=
SL_RESULT_BUFFER_INSUFFICIENT
)
{
msg_Warn
(
p_aout
,
"Dropping invalid buffer"
);
aout_BufferFree
(
p_buffer
);
return
;
}
msg_Err
(
p_aout
,
"write error (%lu)"
,
result
);
// Wait a bit to retry. might miss calls to *cancel
// but this is supposed to be rare anyway
msleep
(
CLOCK_FREQ
);
if
(
result
==
SL_RESULT_SUCCESS
)
break
;
if
(
result
!=
SL_RESULT_BUFFER_INSUFFICIENT
)
{
msg_Warn
(
p_aout
,
"Dropping invalid buffer"
);
aout_BufferFree
(
p_buffer
);
return
;
}
p_sys
->
p_buffer_array
[
p_sys
->
i_toappend_buffer
]
=
p_buffer
;
if
(
++
p_sys
->
i_toappend_buffer
==
BUFF_QUEUE
)
p_sys
->
i_toappend_buffer
=
0
;
msg_Err
(
p_aout
,
"write error (%lu)"
,
result
);
// Wait a bit to retry. might miss calls to *cancel
// but this is supposed to be rare anyway
msleep
(
CLOCK_FREQ
);
}
else
msg_Err
(
p_aout
,
"nothing to play?"
);
p_sys
->
p_buffer_array
[
p_sys
->
i_toappend_buffer
]
=
p_buffer
;
if
(
++
p_sys
->
i_toappend_buffer
==
BUFF_QUEUE
)
p_sys
->
i_toappend_buffer
=
0
;
}
static
void
PlayedCallback
(
SLAndroidSimpleBufferQueueItf
caller
,
void
*
pContext
)
...
...
modules/audio_output/oss.c
View file @
e071592a
...
...
@@ -86,7 +86,7 @@ struct aout_sys_t
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
void
*
OSSThread
(
void
*
);
static
mtime_t
BufferDuration
(
audio_output_t
*
p_aout
);
...
...
@@ -520,9 +520,9 @@ static int Open( vlc_object_t *p_this )
/*****************************************************************************
* Play: nothing to do
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
block
)
{
VLC_UNUSED
(
p_aout
);
aout_FifoPush
(
&
p_aout
->
fifo
,
block
);
}
/*****************************************************************************
...
...
modules/audio_output/portaudio.c
View file @
e071592a
...
...
@@ -95,7 +95,7 @@ static void* PORTAUDIOThread( void * );
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
int
PAOpenDevice
(
audio_output_t
*
);
static
int
PAOpenStream
(
audio_output_t
*
);
...
...
@@ -559,9 +559,9 @@ static int PAOpenStream( audio_output_t *p_aout )
/*****************************************************************************
* Play: play sound
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
block
)
{
VLC_UNUSED
(
p_aout
);
aout_FifoPush
(
&
p_aout
->
fifo
,
block
);
}
#ifdef PORTAUDIO_IS_SERIOUSLY_BROKEN
...
...
modules/audio_output/pulse.c
View file @
e071592a
...
...
@@ -444,15 +444,11 @@ static void *data_convert(block_t **pp)
/**
* Queue one audio frame to the playabck stream
*/
static
void
Play
(
audio_output_t
*
aout
)
static
void
Play
(
audio_output_t
*
aout
,
block_t
*
block
)
{
aout_sys_t
*
sys
=
aout
->
sys
;
pa_stream
*
s
=
sys
->
stream
;
/* This function is called exactly once per block in the output FIFO. */
block_t
*
block
=
aout_FifoPop
(
&
aout
->
fifo
);
assert
(
block
!=
NULL
);
const
void
*
ptr
=
data_convert
(
&
block
);
if
(
unlikely
(
ptr
==
NULL
))
return
;
...
...
modules/audio_output/sdl.c
View file @
e071592a
...
...
@@ -58,7 +58,7 @@ struct aout_sys_t
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
void
SDLCallback
(
void
*
,
uint8_t
*
,
int
);
/*****************************************************************************
...
...
@@ -224,9 +224,9 @@ static int Open ( vlc_object_t *p_this )
/*****************************************************************************
* Play: play a sound samples buffer
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
)
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
block
)
{
VLC_UNUSED
(
p_aout
);
aout_FifoPush
(
&
p_aout
->
fifo
,
block
);
}
/*****************************************************************************
...
...
modules/audio_output/waveout.c
View file @
e071592a
...
...
@@ -46,7 +46,7 @@
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
/*****************************************************************************
* notification_thread_t: waveOut event thread
...
...
@@ -473,15 +473,16 @@ static void Probe( audio_output_t * p_aout )
* This doesn't actually play the buffer. This just stores the buffer so it
* can be played by the callback thread.
*****************************************************************************/
static
void
Play
(
audio_output_t
*
_p_aout
)
static
void
Play
(
audio_output_t
*
_p_aout
,
block_t
*
block
)
{
aout_FifoPush
(
&
_p_aout
->
fifo
,
block
);
if
(
!
_p_aout
->
sys
->
b_playing
)
{
_p_aout
->
sys
->
b_playing
=
1
;
/* get the playing date of the first aout buffer */
_p_aout
->
sys
->
start_date
=
aout_FifoFirstDate
(
&
_p_aout
->
fifo
);
_p_aout
->
sys
->
start_date
=
block
->
i_pts
;
msg_Dbg
(
_p_aout
,
"Wakeup sleeping output thread."
);
...
...
src/audio_output/aout_internal.h
View file @
e071592a
...
...
@@ -167,7 +167,7 @@ audio_output_t *aout_New ( vlc_object_t * );
void
aout_FifoInit
(
vlc_object_t
*
,
aout_fifo_t
*
,
uint32_t
);
#define aout_FifoInit(o, f, r) aout_FifoInit(VLC_OBJECT(o), f, r)
mtime_t
aout_FifoNextStart
(
const
aout_fifo_t
*
)
VLC_USED
;
void
aout_FifoPush
(
aout_fifo_t
*
,
aout_buffer_t
*
);
//
void aout_FifoPush( aout_fifo_t *, aout_buffer_t * );
void
aout_FifoReset
(
aout_fifo_t
*
);
void
aout_FifoMoveDates
(
aout_fifo_t
*
,
mtime_t
);
void
aout_FifoDestroy
(
aout_fifo_t
*
p_fifo
);
...
...
src/audio_output/output.c
View file @
e071592a
...
...
@@ -250,10 +250,7 @@ void aout_OutputPlay( audio_output_t * p_aout, aout_buffer_t * p_buffer )
aout_FifoPush
(
&
owner
->
partial
,
p_buffer
);
while
((
p_buffer
=
aout_OutputSlice
(
p_aout
,
&
owner
->
partial
))
!=
NULL
)
{
aout_FifoPush
(
&
p_aout
->
fifo
,
p_buffer
);
p_aout
->
pf_play
(
p_aout
);
}
p_aout
->
pf_play
(
p_aout
,
p_buffer
);
}
/**
...
...
src/libvlccore.sym
View file @
e071592a
...
...
@@ -15,6 +15,7 @@ aout_CheckChannelReorder
aout_EnableFilter
aout_FifoFirstDate
aout_FifoPop
aout_FifoPush
aout_filter_RequestVout
aout_FormatPrepare
aout_FormatPrint
...
...
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