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
502b865b
Commit
502b865b
authored
Aug 08, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout: move input format to aout_owner
parent
a489b9cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
24 deletions
+29
-24
src/audio_output/aout_internal.h
src/audio_output/aout_internal.h
+4
-2
src/audio_output/dec.c
src/audio_output/dec.c
+7
-9
src/audio_output/input.c
src/audio_output/input.c
+18
-13
No files found.
src/audio_output/aout_internal.h
View file @
502b865b
...
...
@@ -51,8 +51,8 @@ block_t *aout_FilterBufferNew( filter_t *, int );
/** an input stream for the audio output */
struct
aout_input_t
{
audio_sample_format_t
input
;
float
multiplier
;
/**< Replay gain multiplier */
unsigned
samplerate
;
/**< Input sample rate */
/* pre-filters */
filter_t
*
pp_filters
[
AOUT_MAX_FILTERS
];
...
...
@@ -106,6 +106,7 @@ typedef struct
}
volume
;
/**< Volume and gain management (FIXME: input manager?) */
audio_sample_format_t
mixer_format
;
audio_sample_format_t
input_format
;
/* Filters between mixer and output */
filter_t
*
filters
[
AOUT_MAX_FILTERS
];
...
...
@@ -130,7 +131,8 @@ static inline aout_owner_t *aout_owner (audio_output_t *aout)
*****************************************************************************/
/* From input.c : */
int
aout_InputNew
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
,
const
aout_request_vout_t
*
);
int
aout_InputNew
(
audio_output_t
*
,
const
audio_sample_format_t
*
,
aout_input_t
*
,
const
aout_request_vout_t
*
);
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
*
p_buffer
,
int
i_input_rate
,
date_t
*
);
...
...
src/audio_output/dec.c
View file @
502b865b
...
...
@@ -83,8 +83,6 @@ int aout_DecNew( audio_output_t *p_aout,
p_input
->
b_error
=
true
;
memcpy
(
&
p_input
->
input
,
p_format
,
sizeof
(
audio_sample_format_t
)
);
if
(
p_replay_gain
)
p_input
->
replay_gain
=
*
p_replay_gain
;
...
...
@@ -98,6 +96,7 @@ int aout_DecNew( audio_output_t *p_aout,
var_Destroy
(
p_aout
,
"audio-channels"
);
/* Recreate the output using the new format. */
owner
->
input_format
=
*
p_format
;
if
(
aout_OutputNew
(
p_aout
,
p_format
)
<
0
)
goto
error
;
...
...
@@ -108,7 +107,7 @@ int aout_DecNew( audio_output_t *p_aout,
date_Set
(
&
owner
->
sync
.
date
,
VLC_TS_INVALID
);
owner
->
input
=
p_input
;
aout_InputNew
(
p_aout
,
p_input
,
p_request_vout
);
aout_InputNew
(
p_aout
,
p_
format
,
p_
input
,
p_request_vout
);
aout_unlock
(
p_aout
);
return
0
;
error:
...
...
@@ -161,7 +160,7 @@ static void aout_CheckRestart (audio_output_t *aout)
owner
->
volume
.
mixer
=
NULL
;
aout_OutputDelete
(
aout
);
if
(
aout_OutputNew
(
aout
,
&
input
->
inpu
t
))
if
(
aout_OutputNew
(
aout
,
&
owner
->
input_forma
t
))
{
input
->
b_error
=
true
;
return
;
/* we are officially screwed */
...
...
@@ -169,7 +168,7 @@ static void aout_CheckRestart (audio_output_t *aout)
owner
->
volume
.
mixer
=
aout_MixerNew
(
aout
,
owner
->
mixer_format
.
i_format
);
if
(
aout_InputNew
(
aout
,
input
,
&
input
->
request_vout
))
if
(
aout_InputNew
(
aout
,
&
owner
->
input_format
,
input
,
&
input
->
request_vout
))
assert
(
input
->
b_error
);
else
assert
(
!
input
->
b_error
);
...
...
@@ -187,10 +186,9 @@ block_t *aout_DecNewBuffer (audio_output_t *aout, size_t samples)
{
/* NOTE: the caller is responsible for serializing input change */
aout_owner_t
*
owner
=
aout_owner
(
aout
);
aout_input_t
*
input
=
owner
->
input
;
size_t
length
=
samples
*
input
->
inpu
t
.
i_bytes_per_frame
/
input
->
inpu
t
.
i_frame_length
;
size_t
length
=
samples
*
owner
->
input_forma
t
.
i_bytes_per_frame
/
owner
->
input_forma
t
.
i_frame_length
;
block_t
*
block
=
block_Alloc
(
length
);
if
(
likely
(
block
!=
NULL
)
)
{
...
...
@@ -222,7 +220,7 @@ int aout_DecPlay (audio_output_t *p_aout, block_t *p_buffer, int i_input_rate)
assert
(
p_buffer
->
i_pts
>
0
);
p_buffer
->
i_length
=
(
mtime_t
)
p_buffer
->
i_nb_samples
*
1000000
/
p_input
->
inpu
t
.
i_rate
;
/
owner
->
input_forma
t
.
i_rate
;
aout_lock
(
p_aout
);
if
(
p_input
->
b_error
)
...
...
src/audio_output/input.c
View file @
502b865b
...
...
@@ -66,7 +66,10 @@ static vout_thread_t *RequestVout( void *,
/*****************************************************************************
* aout_InputNew : allocate a new input and rework the filter pipeline
*****************************************************************************/
int
aout_InputNew
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
,
const
aout_request_vout_t
*
p_request_vout
)
int
aout_InputNew
(
audio_output_t
*
p_aout
,
const
audio_sample_format_t
*
restrict
format
,
aout_input_t
*
p_input
,
const
aout_request_vout_t
*
p_request_vout
)
{
aout_owner_t
*
owner
=
aout_owner
(
p_aout
);
audio_sample_format_t
chain_input_format
;
...
...
@@ -75,7 +78,8 @@ int aout_InputNew( audio_output_t * p_aout, aout_input_t * p_input, const aout_r
char
*
psz_filters
,
*
psz_visual
,
*
psz_scaletempo
;
int
i_visual
;
aout_FormatPrint
(
p_aout
,
"input"
,
&
p_input
->
input
);
aout_FormatPrint
(
p_aout
,
"input"
,
format
);
p_input
->
samplerate
=
format
->
i_rate
;
p_input
->
i_nb_resamplers
=
p_input
->
i_nb_filters
=
0
;
...
...
@@ -91,9 +95,9 @@ int aout_InputNew( audio_output_t * p_aout, aout_input_t * p_input, const aout_r
}
/* Prepare format structure */
chain_input_format
=
p_input
->
inpu
t
;
chain_input_format
=
*
forma
t
;
chain_output_format
=
owner
->
mixer_format
;
chain_output_format
.
i_rate
=
p_input
->
input
.
i_rate
;
chain_output_format
.
i_rate
=
format
->
i_rate
;
aout_FormatPrepare
(
&
chain_output_format
);
/* Now add user filters */
...
...
@@ -382,7 +386,7 @@ int aout_InputNew( audio_output_t * p_aout, aout_input_t * p_input, const aout_r
/* Create resamplers. */
if
(
AOUT_FMT_LINEAR
(
&
owner
->
mixer_format
))
{
chain_output_format
.
i_rate
=
(
__MAX
(
p_input
->
input
.
i_
rate
,
chain_output_format
.
i_rate
=
(
__MAX
(
p_input
->
sample
rate
,
owner
->
mixer_format
.
i_rate
)
*
(
100
+
AOUT_MAX_RESAMPLING
))
/
100
;
if
(
chain_output_format
.
i_rate
==
owner
->
mixer_format
.
i_rate
)
...
...
@@ -400,7 +404,7 @@ int aout_InputNew( audio_output_t * p_aout, aout_input_t * p_input, const aout_r
}
/* Setup the initial rate of the resampler */
p_input
->
pp_resamplers
[
0
]
->
fmt_in
.
audio
.
i_rate
=
p_input
->
input
.
i_
rate
;
p_input
->
pp_resamplers
[
0
]
->
fmt_in
.
audio
.
i_rate
=
p_input
->
sample
rate
;
}
p_input
->
i_resampling_type
=
AOUT_RESAMPLING_NONE
;
...
...
@@ -453,13 +457,14 @@ int aout_InputDelete( audio_output_t * p_aout, aout_input_t * p_input )
*****************************************************************************/
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
,
p_input
,
&
p_input
->
request_vout
);
aout_InputNew
(
p_aout
,
&
owner
->
input_format
,
p_input
,
&
p_input
->
request_vout
);
p_input
->
b_restart
=
false
;
}
...
...
@@ -513,8 +518,8 @@ block_t *aout_InputPlay(audio_output_t *p_aout, aout_input_t *p_input,
{
unsigned
int
*
const
pi_rate
=
&
p_input
->
p_playback_rate_filter
->
fmt_in
.
audio
.
i_rate
;
#define F(r,ir) ( INPUT_RATE_DEFAULT * (r) / (ir) )
const
int
i_delta
=
*
pi_rate
-
F
(
p_input
->
input
.
i_
rate
,
p_input
->
i_last_input_rate
);
*
pi_rate
=
F
(
p_input
->
input
.
i_
rate
+
i_delta
,
i_input_rate
);
const
int
i_delta
=
*
pi_rate
-
F
(
p_input
->
sample
rate
,
p_input
->
i_last_input_rate
);
*
pi_rate
=
F
(
p_input
->
sample
rate
+
i_delta
,
i_input_rate
);
#undef F
p_input
->
i_last_input_rate
=
i_input_rate
;
}
...
...
@@ -628,8 +633,8 @@ block_t *aout_InputPlay(audio_output_t *p_aout, aout_input_t *p_input,
* resampling */
unsigned
int
i_nominal_rate
=
(
p_input
->
pp_resamplers
[
0
]
==
p_input
->
p_playback_rate_filter
)
?
INPUT_RATE_DEFAULT
*
p_input
->
input
.
i_
rate
/
i_input_rate
:
p_input
->
input
.
i_
rate
;
?
INPUT_RATE_DEFAULT
*
p_input
->
sample
rate
/
i_input_rate
:
p_input
->
sample
rate
;
if
(
p_input
->
pp_resamplers
[
0
]
->
fmt_in
.
audio
.
i_rate
==
i_nominal_rate
)
{
p_input
->
i_resampling_type
=
AOUT_RESAMPLING_NONE
;
...
...
@@ -724,8 +729,8 @@ static void inputResamplingStop( aout_input_t *p_input )
{
p_input
->
pp_resamplers
[
0
]
->
fmt_in
.
audio
.
i_rate
=
(
p_input
->
pp_resamplers
[
0
]
==
p_input
->
p_playback_rate_filter
)
?
INPUT_RATE_DEFAULT
*
p_input
->
input
.
i_
rate
/
p_input
->
i_last_input_rate
:
p_input
->
input
.
i_
rate
;
?
INPUT_RATE_DEFAULT
*
p_input
->
sample
rate
/
p_input
->
i_last_input_rate
:
p_input
->
sample
rate
;
}
}
...
...
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