Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
15366ab4
Commit
15366ab4
authored
Jun 07, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer: partial cleanup, use aout_mixer_t instead of aout_instance_t
parent
dd89374c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
22 deletions
+15
-22
src/audio_output/mixer.c
src/audio_output/mixer.c
+15
-22
No files found.
src/audio_output/mixer.c
View file @
15366ab4
...
@@ -58,7 +58,7 @@ int aout_MixerNew( aout_instance_t * p_aout )
...
@@ -58,7 +58,7 @@ int aout_MixerNew( aout_instance_t * p_aout )
p_mixer
->
module
=
module_need
(
p_mixer
,
"audio mixer"
,
NULL
,
false
);
p_mixer
->
module
=
module_need
(
p_mixer
,
"audio mixer"
,
NULL
,
false
);
if
(
!
p_mixer
->
module
)
if
(
!
p_mixer
->
module
)
{
{
msg_Err
(
p_
aout
,
"no suitable audio mixer"
);
msg_Err
(
p_
mixer
,
"no suitable audio mixer"
);
vlc_object_release
(
p_mixer
);
vlc_object_release
(
p_mixer
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -94,14 +94,8 @@ void aout_MixerDelete( aout_instance_t * p_aout )
...
@@ -94,14 +94,8 @@ void aout_MixerDelete( aout_instance_t * p_aout )
static
int
MixBuffer
(
aout_instance_t
*
p_aout
,
float
volume
)
static
int
MixBuffer
(
aout_instance_t
*
p_aout
,
float
volume
)
{
{
aout_mixer_t
*
p_mixer
=
p_aout
->
p_mixer
;
aout_mixer_t
*
p_mixer
=
p_aout
->
p_mixer
;
aout_mixer_input_t
*
p_input
=
p_mixer
->
input
;
assert
(
p_aout
->
p_input
!=
NULL
);
aout_fifo_t
*
p_fifo
=
&
p_input
->
fifo
;
aout_input_t
*
p_input
=
p_aout
->
p_input
;
if
(
p_input
->
b_paused
)
return
-
1
;
aout_fifo_t
*
p_fifo
=
&
p_input
->
mixer
.
fifo
;
mtime_t
now
=
mdate
();
mtime_t
now
=
mdate
();
aout_lock_input_fifos
(
p_aout
);
aout_lock_input_fifos
(
p_aout
);
...
@@ -116,7 +110,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
...
@@ -116,7 +110,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
/* The output is _very_ late. This can only happen if the user
/* The output is _very_ late. This can only happen if the user
* pauses the stream (or if the decoder is buggy, which cannot
* pauses the stream (or if the decoder is buggy, which cannot
* happen :). */
* happen :). */
msg_Warn
(
p_
aout
,
"output PTS is out of range (%"
PRId64
"), clearing out"
,
msg_Warn
(
p_
mixer
,
"output PTS is out of range (%"
PRId64
"), clearing out"
,
mdate
()
-
start_date
);
mdate
()
-
start_date
);
aout_FifoSet
(
p_aout
,
&
p_aout
->
output
.
fifo
,
0
);
aout_FifoSet
(
p_aout
,
&
p_aout
->
output
.
fifo
,
0
);
date_Set
(
&
exact_start_date
,
0
);
date_Set
(
&
exact_start_date
,
0
);
...
@@ -139,10 +133,10 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
...
@@ -139,10 +133,10 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
if
(
p_buffer
->
i_pts
>=
now
)
if
(
p_buffer
->
i_pts
>=
now
)
break
;
break
;
msg_Warn
(
p_
aout
,
"input PTS is out of range (%"
PRId64
"), "
msg_Warn
(
p_
mixer
,
"input PTS is out of range (%"
PRId64
"), "
"trashing"
,
now
-
p_buffer
->
i_pts
);
"trashing"
,
now
-
p_buffer
->
i_pts
);
aout_BufferFree
(
aout_FifoPop
(
p_aout
,
p_fifo
)
);
aout_BufferFree
(
aout_FifoPop
(
p_aout
,
p_fifo
)
);
p_input
->
mixer
.
begin
=
NULL
;
p_input
->
begin
=
NULL
;
}
}
date_Set
(
&
exact_start_date
,
p_buffer
->
i_pts
);
date_Set
(
&
exact_start_date
,
p_buffer
->
i_pts
);
...
@@ -167,10 +161,10 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
...
@@ -167,10 +161,10 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
break
;
break
;
/* We authorize a +-1 because rounding errors get compensated
/* We authorize a +-1 because rounding errors get compensated
* regularly. */
* regularly. */
msg_Warn
(
p_
aout
,
"the mixer got a packet in the past (%"
PRId64
")"
,
msg_Warn
(
p_
mixer
,
"the mixer got a packet in the past (%"
PRId64
")"
,
start_date
-
prev_date
);
start_date
-
prev_date
);
aout_BufferFree
(
aout_FifoPop
(
p_aout
,
p_fifo
)
);
aout_BufferFree
(
aout_FifoPop
(
p_aout
,
p_fifo
)
);
p_input
->
mixer
.
begin
=
NULL
;
p_input
->
begin
=
NULL
;
p_buffer
=
p_fifo
->
p_first
;
p_buffer
=
p_fifo
->
p_first
;
}
}
...
@@ -184,7 +178,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
...
@@ -184,7 +178,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
/* Check that all buffers are contiguous. */
/* Check that all buffers are contiguous. */
if
(
prev_date
!=
p_buffer
->
i_pts
)
if
(
prev_date
!=
p_buffer
->
i_pts
)
{
{
msg_Warn
(
p_
aout
,
msg_Warn
(
p_
mixer
,
"buffer hole, dropping packets (%"
PRId64
")"
,
"buffer hole, dropping packets (%"
PRId64
")"
,
p_buffer
->
i_pts
-
prev_date
);
p_buffer
->
i_pts
-
prev_date
);
...
@@ -205,14 +199,14 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
...
@@ -205,14 +199,14 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
*
p_mixer
->
fmt
.
i_rate
*
p_mixer
->
fmt
.
i_rate
/
p_mixer
->
fmt
.
i_frame_length
/
p_mixer
->
fmt
.
i_frame_length
/
CLOCK_FREQ
;
/
CLOCK_FREQ
;
if
(
p_input
->
mixer
.
begin
==
NULL
)
if
(
p_input
->
begin
==
NULL
)
p_input
->
mixer
.
begin
=
p_buffer
->
p_buffer
;
p_input
->
begin
=
p_buffer
->
p_buffer
;
ptrdiff_t
bytes
=
p_input
->
mixer
.
begin
-
p_buffer
->
p_buffer
;
ptrdiff_t
bytes
=
p_input
->
begin
-
p_buffer
->
p_buffer
;
if
(
!
((
i_buffer
+
p_mixer
->
fmt
.
i_bytes_per_frame
>
bytes
)
if
(
!
((
i_buffer
+
p_mixer
->
fmt
.
i_bytes_per_frame
>
bytes
)
&&
(
i_buffer
<
p_mixer
->
fmt
.
i_bytes_per_frame
+
bytes
))
)
&&
(
i_buffer
<
p_mixer
->
fmt
.
i_bytes_per_frame
+
bytes
))
)
{
{
msg_Warn
(
p_
aout
,
"mixer start is not output start (%"
PRId64
")"
,
msg_Warn
(
p_
mixer
,
"mixer start is not output start (%"
PRId64
")"
,
i_buffer
-
bytes
);
i_buffer
-
bytes
);
/* Round to the nearest multiple */
/* Round to the nearest multiple */
...
@@ -227,13 +221,12 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
...
@@ -227,13 +221,12 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
aout_unlock_output_fifo
(
p_aout
);
aout_unlock_output_fifo
(
p_aout
);
goto
giveup
;
goto
giveup
;
}
}
p_input
->
mixer
.
begin
=
p_buffer
->
p_buffer
+
i_buffer
;
p_input
->
begin
=
p_buffer
->
p_buffer
+
i_buffer
;
}
}
}
}
/* Run the mixer. */
/* Run the mixer. */
p_buffer
=
p_mixer
->
mix
(
p_aout
->
p_mixer
,
p_aout
->
output
.
i_nb_samples
,
p_buffer
=
p_mixer
->
mix
(
p_mixer
,
p_aout
->
output
.
i_nb_samples
,
volume
);
volume
);
aout_unlock_input_fifos
(
p_aout
);
aout_unlock_input_fifos
(
p_aout
);
if
(
unlikely
(
p_buffer
==
NULL
)
)
if
(
unlikely
(
p_buffer
==
NULL
)
)
...
...
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