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
e3a1b511
Commit
e3a1b511
authored
Aug 09, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout: do not use aout_owner() from input
parent
39833482
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
56 deletions
+55
-56
src/audio_output/aout_internal.h
src/audio_output/aout_internal.h
+1
-1
src/audio_output/dec.c
src/audio_output/dec.c
+36
-3
src/audio_output/input.c
src/audio_output/input.c
+18
-52
No files found.
src/audio_output/aout_internal.h
View file @
e3a1b511
...
@@ -132,11 +132,11 @@ static inline aout_owner_t *aout_owner (audio_output_t *aout)
...
@@ -132,11 +132,11 @@ static inline aout_owner_t *aout_owner (audio_output_t *aout)
/* From input.c : */
/* From input.c : */
int
aout_InputNew
(
audio_output_t
*
,
const
audio_sample_format_t
*
,
int
aout_InputNew
(
audio_output_t
*
,
const
audio_sample_format_t
*
,
const
audio_sample_format_t
*
,
aout_input_t
*
,
const
aout_request_vout_t
*
);
aout_input_t
*
,
const
aout_request_vout_t
*
);
int
aout_InputDelete
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
);
int
aout_InputDelete
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
);
block_t
*
aout_InputPlay
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
,
block_t
*
aout_InputPlay
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
,
block_t
*
p_buffer
,
int
i_input_rate
,
date_t
*
);
block_t
*
p_buffer
,
int
i_input_rate
,
date_t
*
);
void
aout_InputCheckAndRestart
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
);
void
aout_InputRequestRestart
(
audio_output_t
*
p_aout
);
void
aout_InputRequestRestart
(
audio_output_t
*
p_aout
);
/* From filters.c : */
/* From filters.c : */
...
...
src/audio_output/dec.c
View file @
e3a1b511
...
@@ -107,7 +107,8 @@ int aout_DecNew( audio_output_t *p_aout,
...
@@ -107,7 +107,8 @@ int aout_DecNew( audio_output_t *p_aout,
date_Set
(
&
owner
->
sync
.
date
,
VLC_TS_INVALID
);
date_Set
(
&
owner
->
sync
.
date
,
VLC_TS_INVALID
);
owner
->
input
=
p_input
;
owner
->
input
=
p_input
;
aout_InputNew
(
p_aout
,
p_format
,
p_input
,
p_request_vout
);
aout_InputNew
(
p_aout
,
p_format
,
&
owner
->
mixer_format
,
p_input
,
p_request_vout
);
aout_unlock
(
p_aout
);
aout_unlock
(
p_aout
);
return
0
;
return
0
;
error:
error:
...
@@ -168,12 +169,44 @@ static void aout_CheckRestart (audio_output_t *aout)
...
@@ -168,12 +169,44 @@ static void aout_CheckRestart (audio_output_t *aout)
owner
->
volume
.
mixer
=
aout_MixerNew
(
aout
,
owner
->
mixer_format
.
i_format
);
owner
->
volume
.
mixer
=
aout_MixerNew
(
aout
,
owner
->
mixer_format
.
i_format
);
if
(
aout_InputNew
(
aout
,
&
owner
->
input_format
,
input
,
&
input
->
request_vout
))
if
(
aout_InputNew
(
aout
,
&
owner
->
input_format
,
&
owner
->
mixer_format
,
input
,
&
input
->
request_vout
))
assert
(
input
->
b_error
);
assert
(
input
->
b_error
);
else
else
assert
(
!
input
->
b_error
);
assert
(
!
input
->
b_error
);
}
}
/**
* Restarts the audio filter chain if needed.
*/
static
void
aout_InputCheckAndRestart
(
audio_output_t
*
aout
)
{
aout_owner_t
*
owner
=
aout_owner
(
aout
);
aout_input_t
*
input
=
owner
->
input
;
aout_assert_locked
(
aout
);
if
(
!
input
->
b_restart
)
return
;
input
->
b_restart
=
false
;
aout_InputDelete
(
aout
,
input
);
aout_InputNew
(
aout
,
&
owner
->
input_format
,
&
owner
->
mixer_format
,
input
,
&
input
->
request_vout
);
}
/**
* This function will safely mark aout input to be restarted as soon as
* possible to take configuration changes into account
*/
void
aout_InputRequestRestart
(
audio_output_t
*
aout
)
{
aout_lock
(
aout
);
if
(
aout_owner
(
aout
)
->
input
!=
NULL
)
aout_owner
(
aout
)
->
input
->
b_restart
=
true
;
aout_unlock
(
aout
);
}
/*
/*
* Buffer management
* Buffer management
...
@@ -231,7 +264,7 @@ int aout_DecPlay (audio_output_t *p_aout, block_t *p_buffer, int i_input_rate)
...
@@ -231,7 +264,7 @@ int aout_DecPlay (audio_output_t *p_aout, block_t *p_buffer, int i_input_rate)
}
}
aout_CheckRestart
(
p_aout
);
aout_CheckRestart
(
p_aout
);
aout_InputCheckAndRestart
(
p_aout
,
p_input
);
aout_InputCheckAndRestart
(
p_aout
);
/* Input */
/* Input */
p_buffer
=
aout_InputPlay
(
p_aout
,
p_input
,
p_buffer
,
i_input_rate
,
p_buffer
=
aout_InputPlay
(
p_aout
,
p_input
,
p_buffer
,
i_input_rate
,
...
...
src/audio_output/input.c
View file @
e3a1b511
...
@@ -67,19 +67,19 @@ static vout_thread_t *RequestVout( void *,
...
@@ -67,19 +67,19 @@ static vout_thread_t *RequestVout( void *,
* aout_InputNew : allocate a new input and rework the filter pipeline
* aout_InputNew : allocate a new input and rework the filter pipeline
*****************************************************************************/
*****************************************************************************/
int
aout_InputNew
(
audio_output_t
*
p_aout
,
int
aout_InputNew
(
audio_output_t
*
p_aout
,
const
audio_sample_format_t
*
restrict
format
,
const
audio_sample_format_t
*
restrict
infmt
,
const
audio_sample_format_t
*
restrict
outfmt
,
aout_input_t
*
p_input
,
aout_input_t
*
p_input
,
const
aout_request_vout_t
*
p_request_vout
)
const
aout_request_vout_t
*
p_request_vout
)
{
{
aout_owner_t
*
owner
=
aout_owner
(
p_aout
);
audio_sample_format_t
chain_input_format
;
audio_sample_format_t
chain_input_format
;
audio_sample_format_t
chain_output_format
;
audio_sample_format_t
chain_output_format
;
vlc_value_t
val
,
text
;
vlc_value_t
val
,
text
;
char
*
psz_filters
,
*
psz_visual
,
*
psz_scaletempo
;
char
*
psz_filters
,
*
psz_visual
,
*
psz_scaletempo
;
int
i_visual
;
int
i_visual
;
aout_FormatPrint
(
p_aout
,
"input"
,
forma
t
);
aout_FormatPrint
(
p_aout
,
"input"
,
infm
t
);
p_input
->
samplerate
=
forma
t
->
i_rate
;
p_input
->
samplerate
=
infm
t
->
i_rate
;
p_input
->
i_nb_resamplers
=
p_input
->
i_nb_filters
=
0
;
p_input
->
i_nb_resamplers
=
p_input
->
i_nb_filters
=
0
;
...
@@ -95,9 +95,9 @@ int aout_InputNew( audio_output_t * p_aout,
...
@@ -95,9 +95,9 @@ int aout_InputNew( audio_output_t * p_aout,
}
}
/* Prepare format structure */
/* Prepare format structure */
chain_input_format
=
*
forma
t
;
chain_input_format
=
*
infm
t
;
chain_output_format
=
owner
->
mixer_forma
t
;
chain_output_format
=
*
outfm
t
;
chain_output_format
.
i_rate
=
forma
t
->
i_rate
;
chain_output_format
.
i_rate
=
infm
t
->
i_rate
;
aout_FormatPrepare
(
&
chain_output_format
);
aout_FormatPrepare
(
&
chain_output_format
);
/* Now add user filters */
/* Now add user filters */
...
@@ -163,7 +163,7 @@ int aout_InputNew( audio_output_t * p_aout,
...
@@ -163,7 +163,7 @@ int aout_InputNew( audio_output_t * p_aout,
&
val
,
&
text
);
&
val
,
&
text
);
}
}
var_AddCallback
(
p_aout
,
"equalizer"
,
EqualizerCallback
,
NULL
);
var_AddCallback
(
p_aout
,
"equalizer"
,
EqualizerCallback
,
p_input
);
}
}
}
}
...
@@ -204,7 +204,7 @@ int aout_InputNew( audio_output_t * p_aout,
...
@@ -204,7 +204,7 @@ int aout_InputNew( audio_output_t * p_aout,
&
val
,
&
text
);
&
val
,
&
text
);
}
}
var_AddCallback
(
p_aout
,
"audio-replay-gain-mode"
,
ReplayGainCallback
,
NULL
);
var_AddCallback
(
p_aout
,
"audio-replay-gain-mode"
,
ReplayGainCallback
,
p_input
);
}
}
}
}
if
(
var_Type
(
p_aout
,
"audio-replay-gain-preamp"
)
==
0
)
if
(
var_Type
(
p_aout
,
"audio-replay-gain-preamp"
)
==
0
)
...
@@ -384,20 +384,19 @@ int aout_InputNew( audio_output_t * p_aout,
...
@@ -384,20 +384,19 @@ int aout_InputNew( audio_output_t * p_aout,
}
}
/* Create resamplers. */
/* Create resamplers. */
if
(
AOUT_FMT_LINEAR
(
&
owner
->
mixer_forma
t
))
if
(
AOUT_FMT_LINEAR
(
outfm
t
))
{
{
chain_output_format
.
i_rate
=
(
__MAX
(
p_input
->
samplerate
,
chain_output_format
.
i_rate
=
(
__MAX
(
p_input
->
samplerate
,
o
wner
->
mixer_format
.
i_rate
)
o
utfmt
->
i_rate
)
*
(
100
+
AOUT_MAX_RESAMPLING
))
/
100
;
*
(
100
+
AOUT_MAX_RESAMPLING
))
/
100
;
if
(
chain_output_format
.
i_rate
==
o
wner
->
mixer_format
.
i_rate
)
if
(
chain_output_format
.
i_rate
==
o
utfmt
->
i_rate
)
{
{
/* Just in case... */
/* Just in case... */
chain_output_format
.
i_rate
++
;
chain_output_format
.
i_rate
++
;
}
}
if
(
aout_FiltersCreatePipeline
(
p_aout
,
p_input
->
pp_resamplers
,
if
(
aout_FiltersCreatePipeline
(
p_aout
,
p_input
->
pp_resamplers
,
&
p_input
->
i_nb_resamplers
,
&
p_input
->
i_nb_resamplers
,
&
chain_output_format
,
&
chain_output_format
,
outfmt
)
<
0
)
&
owner
->
mixer_format
)
<
0
)
{
{
inputFailure
(
p_aout
,
p_input
,
"couldn't set a resampler pipeline"
);
inputFailure
(
p_aout
,
p_input
,
"couldn't set a resampler pipeline"
);
return
-
1
;
return
-
1
;
...
@@ -450,37 +449,6 @@ int aout_InputDelete( audio_output_t * p_aout, aout_input_t * p_input )
...
@@ -450,37 +449,6 @@ int aout_InputDelete( audio_output_t * p_aout, aout_input_t * p_input )
return
0
;
return
0
;
}
}
/*****************************************************************************
* aout_InputCheckAndRestart : restart an input
*****************************************************************************
* This function must be entered with the input and mixer lock.
*****************************************************************************/
void
aout_InputCheckAndRestart
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
)
{
aout_owner_t
*
owner
=
aout_owner
(
p_aout
);
aout_assert_locked
(
p_aout
);
if
(
!
p_input
->
b_restart
)
return
;
aout_InputDelete
(
p_aout
,
p_input
);
aout_InputNew
(
p_aout
,
&
owner
->
input_format
,
p_input
,
&
p_input
->
request_vout
);
p_input
->
b_restart
=
false
;
}
/**
* This function will safely mark aout input to be restarted as soon as
* possible to take configuration changes into account
*/
void
aout_InputRequestRestart
(
audio_output_t
*
p_aout
)
{
aout_lock
(
p_aout
);
if
(
aout_owner
(
p_aout
)
->
input
!=
NULL
)
aout_owner
(
p_aout
)
->
input
->
b_restart
=
true
;
aout_unlock
(
p_aout
);
}
/*****************************************************************************
/*****************************************************************************
* aout_InputPlay : play a buffer
* aout_InputPlay : play a buffer
*****************************************************************************
*****************************************************************************
...
@@ -849,19 +817,17 @@ static int EqualizerCallback (vlc_object_t *obj, char const *cmd,
...
@@ -849,19 +817,17 @@ static int EqualizerCallback (vlc_object_t *obj, char const *cmd,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
int
ReplayGainCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
ReplayGainCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
data
)
{
{
VLC_UNUSED
(
psz_cmd
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
newval
);
VLC_UNUSED
(
p_data
);
audio_output_t
*
aout
=
(
audio_output_t
*
)
p_this
;
audio_output_t
*
aout
=
(
audio_output_t
*
)
p_this
;
aout_
owner_t
*
owner
=
aout_owner
(
aout
)
;
aout_
input_t
*
input
=
data
;
aout_lock
(
aout
);
aout_lock
(
aout
);
if
(
owner
->
input
!=
NULL
)
ReplayGainSelect
(
aout
,
input
);
ReplayGainSelect
(
aout
,
owner
->
input
);
aout_unlock
(
aout
);
aout_unlock
(
aout
);
VLC_UNUSED
(
psz_cmd
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
val
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
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