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
d2549af0
Commit
d2549af0
authored
Sep 27, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout_filter_t.(in|out)put -> aout_filter_t.fmt_(in|out).audio
This migrates to a filter_t-like syntax
parent
86997e00
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
405 additions
and
403 deletions
+405
-403
include/vlc_aout.h
include/vlc_aout.h
+5
-4
modules/audio_filter/channel_mixer/dolby.c
modules/audio_filter/channel_mixer/dolby.c
+11
-11
modules/audio_filter/channel_mixer/headphone.c
modules/audio_filter/channel_mixer/headphone.c
+23
-23
modules/audio_filter/channel_mixer/mono.c
modules/audio_filter/channel_mixer/mono.c
+6
-6
modules/audio_filter/channel_mixer/simple.c
modules/audio_filter/channel_mixer/simple.c
+19
-19
modules/audio_filter/channel_mixer/trivial.c
modules/audio_filter/channel_mixer/trivial.c
+18
-18
modules/audio_filter/chorus_flanger.c
modules/audio_filter/chorus_flanger.c
+11
-11
modules/audio_filter/converter/a52tofloat32.c
modules/audio_filter/converter/a52tofloat32.c
+11
-11
modules/audio_filter/converter/a52tospdif.c
modules/audio_filter/converter/a52tospdif.c
+4
-4
modules/audio_filter/converter/dtstofloat32.c
modules/audio_filter/converter/dtstofloat32.c
+10
-10
modules/audio_filter/converter/dtstospdif.c
modules/audio_filter/converter/dtstospdif.c
+6
-6
modules/audio_filter/converter/fixed.c
modules/audio_filter/converter/fixed.c
+12
-12
modules/audio_filter/converter/float.c
modules/audio_filter/converter/float.c
+58
-58
modules/audio_filter/converter/mpgatofixed32.c
modules/audio_filter/converter/mpgatofixed32.c
+18
-18
modules/audio_filter/converter/neon.c
modules/audio_filter/converter/neon.c
+6
-6
modules/audio_filter/equalizer.c
modules/audio_filter/equalizer.c
+8
-8
modules/audio_filter/normvol.c
modules/audio_filter/normvol.c
+8
-8
modules/audio_filter/param_eq.c
modules/audio_filter/param_eq.c
+9
-9
modules/audio_filter/resampler/bandlimited.c
modules/audio_filter/resampler/bandlimited.c
+51
-51
modules/audio_filter/resampler/linear.c
modules/audio_filter/resampler/linear.c
+22
-22
modules/audio_filter/resampler/trivial.c
modules/audio_filter/resampler/trivial.c
+13
-13
modules/audio_filter/resampler/ugly.c
modules/audio_filter/resampler/ugly.c
+16
-16
modules/audio_filter/scaletempo.c
modules/audio_filter/scaletempo.c
+9
-9
modules/audio_filter/spatializer/spatializer.cpp
modules/audio_filter/spatializer/spatializer.cpp
+7
-7
modules/visualization/goom.c
modules/visualization/goom.c
+5
-5
modules/visualization/projectm.cpp
modules/visualization/projectm.cpp
+4
-4
modules/visualization/visual/visual.c
modules/visualization/visual/visual.c
+5
-5
src/audio_output/filters.c
src/audio_output/filters.c
+12
-12
src/audio_output/input.c
src/audio_output/input.c
+18
-17
No files found.
include/vlc_aout.h
View file @
d2549af0
...
...
@@ -162,13 +162,14 @@ struct aout_filter_t
{
VLC_COMMON_MEMBERS
audio_sample_format_t
input
;
audio_sample_format_t
output
;
aout_alloc_t
output_alloc
;
module_t
*
p_module
;
aout_filter_sys_t
*
p_sys
;
es_format_t
fmt_in
;
es_format_t
fmt_out
;
aout_alloc_t
output_alloc
;
bool
b_in_place
;
bool
b_continuity
;
...
...
modules/audio_filter/channel_mixer/dolby.c
View file @
d2549af0
...
...
@@ -84,22 +84,22 @@ static int Create( vlc_object_t *p_this )
aout_filter_sys_t
*
p_sys
;
/* Validate audio filter format */
if
(
p_filter
->
input
.
i_physical_channels
!=
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
)
||
!
(
p_filter
->
input
.
i_original_channels
&
AOUT_CHAN_DOLBYSTEREO
)
||
aout_FormatNbChannels
(
&
p_filter
->
output
)
<=
2
||
(
p_filter
->
input
.
i_original_channels
&
~
AOUT_CHAN_DOLBYSTEREO
)
!=
(
p_filter
->
output
.
i_original_channels
&
~
AOUT_CHAN_DOLBYSTEREO
)
)
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
!=
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
)
||
!
(
p_filter
->
fmt_in
.
audio
.
i_original_channels
&
AOUT_CHAN_DOLBYSTEREO
)
||
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
)
<=
2
||
(
p_filter
->
fmt_in
.
audio
.
i_original_channels
&
~
AOUT_CHAN_DOLBYSTEREO
)
!=
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
&
~
AOUT_CHAN_DOLBYSTEREO
)
)
{
return
VLC_EGENERIC
;
}
if
(
p_filter
->
input
.
i_rate
!=
p_filter
->
output
.
i_rate
)
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
!=
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
return
VLC_EGENERIC
;
}
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
return
VLC_EGENERIC
;
}
...
...
@@ -117,7 +117,7 @@ static int Create( vlc_object_t *p_this )
while
(
pi_channels
[
i
]
)
{
if
(
p_filter
->
output
.
i_physical_channels
&
pi_channels
[
i
]
)
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
&
pi_channels
[
i
]
)
{
switch
(
pi_channels
[
i
]
)
{
...
...
@@ -171,13 +171,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float
*
p_in
=
(
float
*
)
p_in_buf
->
p_buffer
;
float
*
p_out
=
(
float
*
)
p_out_buf
->
p_buffer
;
size_t
i_nb_samples
=
p_in_buf
->
i_nb_samples
;
size_t
i_nb_channels
=
aout_FormatNbChannels
(
&
p_filter
->
output
);
size_t
i_nb_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
);
size_t
i_nb_rear
=
0
;
size_t
i
;
p_out_buf
->
i_nb_samples
=
i_nb_samples
;
p_out_buf
->
i_buffer
=
sizeof
(
float
)
*
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
output
);
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
);
memset
(
p_out
,
0
,
p_out_buf
->
i_buffer
);
...
...
modules/audio_filter/channel_mixer/headphone.c
View file @
d2549af0
...
...
@@ -358,7 +358,7 @@ static int Create( vlc_object_t *p_this )
bool
b_fit
=
true
;
/* Activate this filter only with stereo devices */
if
(
p_filter
->
output
.
i_physical_channels
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
!=
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
)
)
{
msg_Dbg
(
p_filter
,
"filter discarded (incompatible format)"
);
...
...
@@ -366,31 +366,31 @@ static int Create( vlc_object_t *p_this )
}
/* Request a specific format if not already compatible */
if
(
p_filter
->
input
.
i_original_channels
!=
p_filter
->
output
.
i_original_channels
)
if
(
p_filter
->
fmt_in
.
audio
.
i_original_channels
!=
p_filter
->
fmt_out
.
audio
.
i_original_channels
)
{
b_fit
=
false
;
p_filter
->
input
.
i_original_channels
=
p_filter
->
output
.
i_original_channels
;
p_filter
->
fmt_in
.
audio
.
i_original_channels
=
p_filter
->
fmt_out
.
audio
.
i_original_channels
;
}
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
b_fit
=
false
;
p_filter
->
input
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
output
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_in
.
audio
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_out
.
audio
.
i_format
=
VLC_CODEC_FL32
;
}
if
(
p_filter
->
input
.
i_rate
!=
p_filter
->
output
.
i_rate
)
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
!=
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
b_fit
=
false
;
p_filter
->
input
.
i_rate
=
p_filter
->
output
.
i_rate
;
p_filter
->
fmt_in
.
audio
.
i_rate
=
p_filter
->
fmt_out
.
audio
.
i_rate
;
}
if
(
p_filter
->
input
.
i_physical_channels
==
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
)
&&
(
p_filter
->
input
.
i_original_channels
&
AOUT_CHAN_DOLBYSTEREO
)
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
==
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
)
&&
(
p_filter
->
fmt_in
.
audio
.
i_original_channels
&
AOUT_CHAN_DOLBYSTEREO
)
&&
!
config_GetInt
(
p_filter
,
"headphone-dolby"
)
)
{
b_fit
=
false
;
p_filter
->
input
.
i_physical_channels
=
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
p_filter
->
fmt_in
.
audio
.
i_physical_channels
=
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_CENTER
|
AOUT_CHAN_REARLEFT
|
AOUT_CHAN_REARRIGHT
;
...
...
@@ -412,9 +412,9 @@ static int Create( vlc_object_t *p_this )
p_sys
->
p_atomic_operations
=
NULL
;
if
(
Init
(
VLC_OBJECT
(
p_filter
),
p_sys
,
aout_FormatNbChannels
(
&
p_filter
->
input
)
,
p_filter
->
input
.
i_physical_channels
,
p_filter
->
input
.
i_rate
)
<
0
)
,
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
,
p_filter
->
fmt_in
.
audio
.
i_physical_channels
,
p_filter
->
fmt_in
.
audio
.
i_rate
)
<
0
)
{
free
(
p_sys
);
return
VLC_EGENERIC
;
...
...
@@ -446,8 +446,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
VLC_UNUSED
(
p_aout
);
aout_filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
int
i_input_nb
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i_output_nb
=
aout_FormatNbChannels
(
&
p_filter
->
output
);
int
i_input_nb
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
int
i_output_nb
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
);
float
*
p_in
=
(
float
*
)
p_in_buf
->
p_buffer
;
uint8_t
*
p_out
;
...
...
@@ -668,10 +668,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out
->
i_length
=
p_block
->
i_length
;
aout_filter
.
p_sys
=
(
struct
aout_filter_sys_t
*
)
p_filter
->
p_sys
;
aout_filter
.
input
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
input
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
output
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
output
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
aout_filter
.
fmt_in
.
audio
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
fmt_in
.
audio
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
fmt_out
.
audio
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
fmt_out
.
audio
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
aout_filter
.
b_in_place
=
0
;
in_buf
.
p_buffer
=
p_block
->
p_buffer
;
...
...
modules/audio_filter/channel_mixer/mono.c
View file @
d2549af0
...
...
@@ -484,10 +484,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out
->
i_length
=
p_block
->
i_length
;
aout_filter
.
p_sys
=
(
struct
aout_filter_sys_t
*
)
p_filter
->
p_sys
;
aout_filter
.
input
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
input
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
output
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
output
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
aout_filter
.
fmt_in
.
audio
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
fmt_in
.
audio
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
fmt_out
.
audio
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
fmt_out
.
audio
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
in_buf
.
p_buffer
=
p_block
->
p_buffer
;
in_buf
.
i_buffer
=
p_block
->
i_buffer
;
...
...
@@ -535,8 +535,8 @@ static void stereo2mono_downmix( aout_filter_t * p_filter,
{
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_filter
->
p_sys
;
int
i_input_nb
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i_output_nb
=
aout_FormatNbChannels
(
&
p_filter
->
output
);
int
i_input_nb
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
int
i_output_nb
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
);
int16_t
*
p_in
=
(
int16_t
*
)
p_in_buf
->
p_buffer
;
uint8_t
*
p_out
;
...
...
modules/audio_filter/channel_mixer/simple.c
View file @
d2549af0
...
...
@@ -85,7 +85,7 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
!
IsSupported
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
IsSupported
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
return
-
1
;
p_filter
->
pf_do_work
=
DoWork
;
...
...
@@ -101,7 +101,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
const
unsigned
i_input_physical
=
p_filter
->
input
.
i_physical_channels
;
const
unsigned
i_input_physical
=
p_filter
->
fmt_in
.
audio
.
i_physical_channels
;
const
bool
b_input_7_0
=
(
i_input_physical
&
~
AOUT_CHAN_LFE
)
==
AOUT_CHANS_7_0
;
const
bool
b_input_5_0
=
!
b_input_7_0
&&
...
...
@@ -112,8 +112,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
const
bool
b_input_3_0
=
!
b_input_7_0
&&
!
b_input_5_0
&&
!
b_input_4_center_rear
&&
(
i_input_physical
&
~
AOUT_CHAN_LFE
)
==
AOUT_CHANS_3_0
;
int
i_input_nb
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i_output_nb
=
aout_FormatNbChannels
(
&
p_filter
->
output
);
int
i_input_nb
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
int
i_output_nb
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
);
float
*
p_dest
=
(
float
*
)
p_out_buf
->
p_buffer
;
const
float
*
p_src
=
(
const
float
*
)
p_in_buf
->
p_buffer
;
int
i
;
...
...
@@ -121,7 +121,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf
->
i_nb_samples
=
p_in_buf
->
i_nb_samples
;
p_out_buf
->
i_buffer
=
p_in_buf
->
i_buffer
*
i_output_nb
/
i_input_nb
;
if
(
p_filter
->
output
.
i_physical_channels
==
AOUT_CHANS_2_0
)
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
==
AOUT_CHANS_2_0
)
{
if
(
b_input_7_0
)
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -133,7 +133,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src
+=
7
;
if
(
p_filter
->
input
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
}
else
if
(
b_input_5_0
)
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -145,7 +145,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src
+=
5
;
if
(
p_filter
->
input
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
}
else
if
(
b_input_3_0
)
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -157,7 +157,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src
+=
3
;
if
(
p_filter
->
input
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
}
else
if
(
b_input_4_center_rear
)
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -169,7 +169,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src
+=
4
;
}
}
else
if
(
p_filter
->
output
.
i_physical_channels
==
AOUT_CHAN_CENTER
)
else
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
==
AOUT_CHAN_CENTER
)
{
if
(
b_input_7_0
)
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -179,7 +179,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src
+=
7
;
if
(
p_filter
->
input
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
}
else
if
(
b_input_5_0
)
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -189,7 +189,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src
+=
5
;
if
(
p_filter
->
input
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
}
else
if
(
b_input_3_0
)
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -199,7 +199,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src
+=
3
;
if
(
p_filter
->
input
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
}
else
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -212,7 +212,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
else
{
assert
(
p_filter
->
output
.
i_physical_channels
==
AOUT_CHANS_4_0
);
assert
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
==
AOUT_CHANS_4_0
);
assert
(
b_input_7_0
||
b_input_5_0
);
if
(
b_input_7_0
)
...
...
@@ -229,7 +229,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src
+=
7
;
if
(
p_filter
->
input
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
}
else
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -245,7 +245,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src
+=
5
;
if
(
p_filter
->
input
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
if
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
&
AOUT_CHAN_LFE
)
p_src
++
;
}
}
}
...
...
@@ -306,10 +306,10 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block )
p_out
->
i_length
=
p_block
->
i_length
;
aout_filter
.
p_sys
=
(
struct
aout_filter_sys_t
*
)
p_filter
->
p_sys
;
aout_filter
.
input
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
input
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
output
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
output
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
aout_filter
.
fmt_in
.
audio
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
fmt_in
.
audio
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
fmt_out
.
audio
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
fmt_out
.
audio
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
in_buf
.
p_buffer
=
p_block
->
p_buffer
;
in_buf
.
i_buffer
=
p_block
->
i_buffer
;
...
...
modules/audio_filter/channel_mixer/trivial.c
View file @
d2549af0
...
...
@@ -59,21 +59,21 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
(
p_filter
->
input
.
i_physical_channels
==
p_filter
->
output
.
i_physical_channels
&&
p_filter
->
input
.
i_original_channels
==
p_filter
->
output
.
i_original_channels
)
||
p_filter
->
input
.
i_format
!=
p_filter
->
output
.
i_format
||
p_filter
->
input
.
i_rate
!=
p_filter
->
output
.
i_rate
||
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
input
.
i_format
!=
VLC_CODEC_FI32
)
)
if
(
(
p_filter
->
fmt_in
.
audio
.
i_physical_channels
==
p_filter
->
fmt_out
.
audio
.
i_physical_channels
&&
p_filter
->
fmt_in
.
audio
.
i_original_channels
==
p_filter
->
fmt_out
.
audio
.
i_original_channels
)
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
p_filter
->
fmt_out
.
audio
.
i_format
||
p_filter
->
fmt_in
.
audio
.
i_rate
!=
p_filter
->
fmt_out
.
audio
.
i_rate
||
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FI32
)
)
{
return
-
1
;
}
p_filter
->
pf_do_work
=
DoWork
;
if
(
aout_FormatNbChannels
(
&
p_filter
->
input
)
>
aout_FormatNbChannels
(
&
p_filter
->
output
)
)
if
(
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
>
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
)
)
{
/* Downmixing */
p_filter
->
b_in_place
=
1
;
...
...
@@ -113,26 +113,26 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i_input_nb
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i_output_nb
=
aout_FormatNbChannels
(
&
p_filter
->
output
);
int
i_input_nb
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
int
i_output_nb
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
);
int32_t
*
p_dest
=
(
int32_t
*
)
p_out_buf
->
p_buffer
;
int32_t
*
p_src
=
(
int32_t
*
)
p_in_buf
->
p_buffer
;
p_out_buf
->
i_nb_samples
=
p_in_buf
->
i_nb_samples
;
p_out_buf
->
i_buffer
=
p_in_buf
->
i_buffer
*
i_output_nb
/
i_input_nb
;
if
(
(
p_filter
->
output
.
i_original_channels
&
AOUT_CHAN_PHYSMASK
)
!=
(
p_filter
->
input
.
i_original_channels
&
AOUT_CHAN_PHYSMASK
)
&&
(
p_filter
->
input
.
i_original_channels
&
AOUT_CHAN_PHYSMASK
)
if
(
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
&
AOUT_CHAN_PHYSMASK
)
!=
(
p_filter
->
fmt_in
.
audio
.
i_original_channels
&
AOUT_CHAN_PHYSMASK
)
&&
(
p_filter
->
fmt_in
.
audio
.
i_original_channels
&
AOUT_CHAN_PHYSMASK
)
==
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
)
)
{
int
i
;
/* This is a bit special. */
if
(
!
(
p_filter
->
output
.
i_original_channels
&
AOUT_CHAN_LEFT
)
)
if
(
!
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
&
AOUT_CHAN_LEFT
)
)
{
p_src
++
;
}
if
(
p_filter
->
output
.
i_physical_channels
==
AOUT_CHAN_CENTER
)
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
==
AOUT_CHAN_CENTER
)
{
/* Mono mode */
for
(
i
=
p_in_buf
->
i_nb_samples
;
i
--
;
)
...
...
@@ -155,7 +155,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
}
}
else
if
(
p_filter
->
output
.
i_original_channels
else
if
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
&
AOUT_CHAN_REVERSESTEREO
)
{
/* Reverse-stereo mode */
...
...
modules/audio_filter/chorus_flanger.c
View file @
d2549af0
...
...
@@ -116,17 +116,17 @@ static int Open( vlc_object_t *p_this )
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
aout_filter_sys_t
*
p_sys
;
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
msg_Err
(
p_filter
,
"input and output formats are not similar"
);
return
VLC_EGENERIC
;
}
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
p_filter
->
input
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
output
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_in
.
audio
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_out
.
audio
.
i_format
=
VLC_CODEC_FL32
;
msg_Warn
(
p_filter
,
"bad input or output format"
);
}
...
...
@@ -137,7 +137,7 @@ static int Open( vlc_object_t *p_this )
if
(
!
p_sys
)
return
VLC_ENOMEM
;
p_sys
->
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
p_sys
->
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
p_sys
->
f_delayTime
=
var_CreateGetFloat
(
p_this
,
"delay-time"
);
p_sys
->
f_sweepDepth
=
var_CreateGetFloat
(
p_this
,
"sweep-depth"
);
p_sys
->
f_sweepRate
=
var_CreateGetFloat
(
p_this
,
"sweep-rate"
);
...
...
@@ -168,12 +168,12 @@ static int Open( vlc_object_t *p_this )
/* Max delay = delay + depth. Min = delay - depth */
p_sys
->
i_bufferLength
=
p_sys
->
i_channels
*
(
(
int
)(
(
p_sys
->
f_delayTime
+
p_sys
->
f_sweepDepth
)
*
p_filter
->
input
.
i_rate
/
1000
)
+
1
);
+
p_sys
->
f_sweepDepth
)
*
p_filter
->
fmt_in
.
audio
.
i_rate
/
1000
)
+
1
);
msg_Dbg
(
p_filter
,
"Buffer length:%d, Channels:%d, Sweep Depth:%f, Delay "
"time:%f, Sweep Rate:%f, Sample Rate: %d"
,
p_sys
->
i_bufferLength
,
p_sys
->
i_channels
,
p_sys
->
f_sweepDepth
,
p_sys
->
f_delayTime
,
p_sys
->
f_sweepRate
,
p_filter
->
input
.
i_rate
);
p_sys
->
f_sweepRate
,
p_filter
->
fmt_in
.
audio
.
i_rate
);
if
(
p_sys
->
i_bufferLength
<=
0
)
{
msg_Err
(
p_filter
,
"Delay-time, Sampl rate or Channels was incorrect"
);
...
...
@@ -199,14 +199,14 @@ static int Open( vlc_object_t *p_this )
p_sys
->
pf_write
=
p_sys
->
pf_delayLineStart
;
if
(
p_sys
->
f_sweepDepth
<
small_value
()
||
p_filter
->
input
.
i_rate
<
small_value
()
)
{
p_filter
->
fmt_in
.
audio
.
i_rate
<
small_value
()
)
{
p_sys
->
f_sinMultiplier
=
0
.
0
;
}
else
{
p_sys
->
f_sinMultiplier
=
11
*
p_sys
->
f_sweepRate
/
(
7
*
p_sys
->
f_sweepDepth
*
p_filter
->
input
.
i_rate
)
;
(
7
*
p_sys
->
f_sweepDepth
*
p_filter
->
fmt_in
.
audio
.
i_rate
)
;
}
p_sys
->
i_sampleRate
=
p_filter
->
input
.
i_rate
;
p_sys
->
i_sampleRate
=
p_filter
->
fmt_in
.
audio
.
i_rate
;
return
VLC_SUCCESS
;
}
...
...
modules/audio_filter/converter/a52tofloat32.c
View file @
d2549af0
...
...
@@ -122,17 +122,17 @@ static int Create( vlc_object_t *p_this )
filter_sys_t
*
p_sys
;
int
i_ret
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_A52
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_A52
#ifdef LIBA52_FIXED
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FI32
)
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FI32
)
#else
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
#endif
{
return
-
1
;
}
if
(
p_filter
->
input
.
i_rate
!=
p_filter
->
output
.
i_rate
)
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
!=
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
return
-
1
;
}
...
...
@@ -144,7 +144,7 @@ static int Create( vlc_object_t *p_this )
return
-
1
;
i_ret
=
Open
(
VLC_OBJECT
(
p_filter
),
p_sys
,
p_filter
->
input
,
p_filter
->
output
);
p_filter
->
fmt_in
.
audio
,
p_filter
->
fmt_out
.
audio
);
p_filter
->
pf_do_work
=
DoWork
;
p_filter
->
b_in_place
=
0
;
...
...
@@ -371,13 +371,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
if
(
((
p_sys
->
i_flags
&
A52_CHANNEL_MASK
)
==
A52_CHANNEL1
||
(
p_sys
->
i_flags
&
A52_CHANNEL_MASK
)
==
A52_CHANNEL2
||
(
p_sys
->
i_flags
&
A52_CHANNEL_MASK
)
==
A52_MONO
)
&&
(
p_filter
->
output
.
i_physical_channels
&&
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
&
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
))
)
{
Duplicate
(
(
sample_t
*
)(
p_out_buf
->
p_buffer
+
i
*
i_bytes_per_block
),
p_samples
);
}
else
if
(
p_filter
->
output
.
i_original_channels
else
if
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
&
AOUT_CHAN_REVERSESTEREO
)
{
Exchange
(
(
sample_t
*
)(
p_out_buf
->
p_buffer
+
i
*
i_bytes_per_block
),
...
...
@@ -488,10 +488,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out
->
i_length
=
p_block
->
i_length
;
aout_filter
.
p_sys
=
(
struct
aout_filter_sys_t
*
)
p_filter
->
p_sys
;
aout_filter
.
input
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
input
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
output
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
output
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
aout_filter
.
fmt_in
.
audio
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
fmt_in
.
audio
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
fmt_out
.
audio
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
fmt_out
.
audio
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
in_buf
.
p_buffer
=
p_block
->
p_buffer
;
in_buf
.
i_buffer
=
p_block
->
i_buffer
;
...
...
modules/audio_filter/converter/a52tospdif.c
View file @
d2549af0
...
...
@@ -64,9 +64,9 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_A52
||
(
p_filter
->
output
.
i_format
!=
VLC_CODEC_SPDIFB
&&
p_filter
->
output
.
i_format
!=
VLC_CODEC_SPDIFL
)
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_A52
||
(
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_SPDIFB
&&
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_SPDIFL
)
)
{
return
-
1
;
}
...
...
@@ -95,7 +95,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
uint8_t
*
p_out
=
p_out_buf
->
p_buffer
;
/* Copy the S/PDIF headers. */
if
(
p_filter
->
output
.
i_format
==
VLC_CODEC_SPDIFB
)
if
(
p_filter
->
fmt_out
.
audio
.
i_format
==
VLC_CODEC_SPDIFB
)
{
vlc_memcpy
(
p_out
,
p_sync_be
,
6
);
p_out
[
4
]
=
p_in
[
5
]
&
0x7
;
/* bsmod */
...
...
modules/audio_filter/converter/dtstofloat32.c
View file @
d2549af0
...
...
@@ -112,13 +112,13 @@ static int Create( vlc_object_t *p_this )
filter_sys_t
*
p_sys
;
int
i_ret
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_DTS
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_DTS
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
return
-
1
;
}
if
(
p_filter
->
input
.
i_rate
!=
p_filter
->
output
.
i_rate
)
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
!=
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
return
-
1
;
}
...
...
@@ -130,7 +130,7 @@ static int Create( vlc_object_t *p_this )
return
-
1
;
i_ret
=
Open
(
VLC_OBJECT
(
p_filter
),
p_sys
,
p_filter
->
input
,
p_filter
->
output
);
p_filter
->
fmt_in
.
audio
,
p_filter
->
fmt_out
.
audio
);
p_filter
->
pf_do_work
=
DoWork
;
p_filter
->
b_in_place
=
0
;
...
...
@@ -340,13 +340,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_samples
=
dca_samples
(
p_sys
->
p_libdca
);
if
(
(
p_sys
->
i_flags
&
DCA_CHANNEL_MASK
)
==
DCA_MONO
&&
(
p_filter
->
output
.
i_physical_channels
&&
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
&
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
))
)
{
Duplicate
(
(
float
*
)(
p_out_buf
->
p_buffer
+
i
*
i_bytes_per_block
),
p_samples
);
}
else
if
(
p_filter
->
output
.
i_original_channels
else
if
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
&
AOUT_CHAN_REVERSESTEREO
)
{
Exchange
(
(
float
*
)(
p_out_buf
->
p_buffer
+
i
*
i_bytes_per_block
),
...
...
@@ -453,10 +453,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out
->
i_length
=
p_block
->
i_length
;
aout_filter
.
p_sys
=
(
struct
aout_filter_sys_t
*
)
p_filter
->
p_sys
;
aout_filter
.
input
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
input
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
output
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
output
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
aout_filter
.
fmt_in
.
audio
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
fmt_in
.
audio
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
fmt_out
.
audio
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
fmt_out
.
audio
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
in_buf
.
p_buffer
=
p_block
->
p_buffer
;
in_buf
.
i_buffer
=
p_block
->
i_buffer
;
...
...
modules/audio_filter/converter/dtstospdif.c
View file @
d2549af0
...
...
@@ -81,9 +81,9 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_DTS
||
(
p_filter
->
output
.
i_format
!=
VLC_CODEC_SPDIFL
&&
p_filter
->
output
.
i_format
!=
VLC_CODEC_SPDIFB
)
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_DTS
||
(
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_SPDIFL
&&
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_SPDIFB
)
)
{
return
-
1
;
}
...
...
@@ -170,7 +170,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
/* Copy the S/PDIF headers. */
if
(
p_filter
->
output
.
i_format
==
VLC_CODEC_SPDIFB
)
if
(
p_filter
->
fmt_out
.
audio
.
i_format
==
VLC_CODEC_SPDIFB
)
{
vlc_memcpy
(
p_out
,
p_sync_be
,
6
);
p_out
[
5
]
=
i_ac5_spdif_type
;
...
...
@@ -185,8 +185,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out
[
7
]
=
((
i_length
)
>>
5
)
&
0xFF
;
}
if
(
(
(
p_in
[
0
]
==
0x1F
||
p_in
[
0
]
==
0x7F
)
&&
p_filter
->
output
.
i_format
==
VLC_CODEC_SPDIFL
)
||
(
(
p_in
[
0
]
==
0xFF
||
p_in
[
0
]
==
0xFE
)
&&
p_filter
->
output
.
i_format
==
VLC_CODEC_SPDIFB
)
)
if
(
(
(
p_in
[
0
]
==
0x1F
||
p_in
[
0
]
==
0x7F
)
&&
p_filter
->
fmt_out
.
audio
.
i_format
==
VLC_CODEC_SPDIFL
)
||
(
(
p_in
[
0
]
==
0xFF
||
p_in
[
0
]
==
0xFE
)
&&
p_filter
->
fmt_out
.
audio
.
i_format
==
VLC_CODEC_SPDIFB
)
)
{
/* We are dealing with a big endian bitstream and a little endian output
* or a little endian bitstream and a big endian output.
...
...
modules/audio_filter/converter/fixed.c
View file @
d2549af0
...
...
@@ -73,13 +73,13 @@ static int Create_F32ToS16( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FI32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_S16N
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FI32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_S16N
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -140,7 +140,7 @@ static void Do_F32ToS16( aout_instance_t * p_aout, aout_filter_t * p_filter,
int16_t
*
p_out
=
(
int16_t
*
)
p_out_buf
->
p_buffer
;
for
(
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
)
;
i
--
;
)
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
;
i
--
;
)
{
/* Fast Scaling */
*
p_out
++
=
s24_to_s16_pcm
(
*
p_in
++
);
...
...
@@ -157,13 +157,13 @@ static int Create_S16ToF32( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
output
.
i_format
!=
VLC_CODEC_FI32
||
p_filter
->
input
.
i_format
!=
VLC_CODEC_S16N
)
if
(
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FI32
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_S16N
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -178,7 +178,7 @@ static void Do_S16ToF32( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
int16_t
*
p_in
=
(
int16_t
*
)
p_in_buf
->
p_buffer
+
i
-
1
;
...
...
@@ -203,13 +203,13 @@ static int Create_U8ToF32( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_U8
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FI32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_U8
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FI32
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -224,7 +224,7 @@ static void Do_U8ToF32( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
uint8_t
*
p_in
=
(
uint8_t
*
)
p_in_buf
->
p_buffer
+
i
-
1
;
...
...
modules/audio_filter/converter/float.c
View file @
d2549af0
...
...
@@ -132,20 +132,20 @@ static int Create_F32ToFL32( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FI32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
&&
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FI32
)
)
if
(
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FI32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
&&
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FI32
)
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
if
(
p_filter
->
input
.
i_format
==
VLC_CODEC_FI32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
==
VLC_CODEC_FI32
)
{
p_filter
->
pf_do_work
=
Do_F32ToFL32
;
}
...
...
@@ -168,7 +168,7 @@ static void Do_F32ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
float
*
p_out
=
(
float
*
)
p_out_buf
->
p_buffer
;
for
(
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
)
;
i
--
;
)
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
;
i
--
;
)
{
*
p_out
++
=
(
float
)
*
p_in
++
/
(
float
)
FIXED32_ONE
;
}
...
...
@@ -186,7 +186,7 @@ static void Do_FL32ToF32( aout_instance_t * p_aout, aout_filter_t * p_filter,
vlc_fixed_t
*
p_out
=
(
vlc_fixed_t
*
)
p_out_buf
->
p_buffer
;
for
(
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
)
;
i
--
;
)
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
;
i
--
;
)
{
*
p_out
++
=
(
vlc_fixed_t
)(
*
p_in
++
*
(
float
)
FIXED32_ONE
);
}
...
...
@@ -202,13 +202,13 @@ static int Create_FL32ToS16( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_S16N
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_S16N
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -228,7 +228,7 @@ static void Do_FL32ToS16( aout_instance_t * p_aout, aout_filter_t * p_filter,
int16_t
*
p_out
=
(
int16_t
*
)
p_out_buf
->
p_buffer
;
for
(
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
i
--
;
)
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
i
--
;
)
{
#if 0
/* Slow version. */
...
...
@@ -257,13 +257,13 @@ static int Create_FL32ToS8( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_S8
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_S8
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -283,7 +283,7 @@ static void Do_FL32ToS8( aout_instance_t * p_aout, aout_filter_t * p_filter,
int8_t
*
p_out
=
(
int8_t
*
)
p_out_buf
->
p_buffer
;
for
(
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
i
--
;
)
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
i
--
;
)
{
if
(
*
p_in
>=
1
.
0
)
*
p_out
=
127
;
else
if
(
*
p_in
<
-
1
.
0
)
*
p_out
=
-
128
;
...
...
@@ -302,13 +302,13 @@ static int Create_FL32ToU16( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_U16N
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_U16N
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -328,7 +328,7 @@ static void Do_FL32ToU16( aout_instance_t * p_aout, aout_filter_t * p_filter,
uint16_t
*
p_out
=
(
uint16_t
*
)
p_out_buf
->
p_buffer
;
for
(
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
i
--
;
)
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
i
--
;
)
{
if
(
*
p_in
>=
1
.
0
)
*
p_out
=
65535
;
else
if
(
*
p_in
<
-
1
.
0
)
*
p_out
=
0
;
...
...
@@ -347,13 +347,13 @@ static int Create_FL32ToU8( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_U8
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_U8
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -373,7 +373,7 @@ static void Do_FL32ToU8( aout_instance_t * p_aout, aout_filter_t * p_filter,
uint8_t
*
p_out
=
(
uint8_t
*
)
p_out_buf
->
p_buffer
;
for
(
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
i
--
;
)
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
i
--
;
)
{
if
(
*
p_in
>=
1
.
0
)
*
p_out
=
255
;
else
if
(
*
p_in
<
-
1
.
0
)
*
p_out
=
0
;
...
...
@@ -392,22 +392,22 @@ static int Create_S16ToFL32( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_S16N
&&
p_filter
->
input
.
i_format
!=
VLC_CODEC_S24N
&&
p_filter
->
input
.
i_format
!=
VLC_CODEC_S32N
)
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_S16N
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_S24N
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_S32N
)
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
if
(
p_filter
->
input
.
i_format
==
VLC_CODEC_S32N
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
==
VLC_CODEC_S32N
)
p_filter
->
pf_do_work
=
Do_S32ToFL32
;
else
if
(
p_filter
->
input
.
i_format
==
VLC_CODEC_S24N
)
else
if
(
p_filter
->
fmt_in
.
audio
.
i_format
==
VLC_CODEC_S24N
)
p_filter
->
pf_do_work
=
Do_S24ToFL32
;
else
p_filter
->
pf_do_work
=
Do_S16ToFL32
;
...
...
@@ -421,7 +421,7 @@ static void Do_S16ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
int16_t
*
p_in
=
(
int16_t
*
)
p_in_buf
->
p_buffer
+
i
-
1
;
...
...
@@ -452,7 +452,7 @@ static void Do_S24ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
uint8_t
*
p_in
=
(
uint8_t
*
)
p_in_buf
->
p_buffer
+
(
i
-
1
)
*
3
;
...
...
@@ -478,7 +478,7 @@ static void Do_S32ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
int32_t
*
p_in
=
(
int32_t
*
)
p_in_buf
->
p_buffer
+
i
-
1
;
...
...
@@ -500,15 +500,15 @@ static int Create_S16ToFL32_SW( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
if
(
(
p_filter
->
input
.
i_format
==
VLC_CODEC_S16L
||
p_filter
->
input
.
i_format
==
VLC_CODEC_S16B
)
&&
p_filter
->
output
.
i_format
==
VLC_CODEC_FL32
&&
p_filter
->
input
.
i_format
!=
VLC_CODEC_S16N
)
if
(
(
p_filter
->
fmt_in
.
audio
.
i_format
==
VLC_CODEC_S16L
||
p_filter
->
fmt_in
.
audio
.
i_format
==
VLC_CODEC_S16B
)
&&
p_filter
->
fmt_out
.
audio
.
i_format
==
VLC_CODEC_FL32
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_S16N
)
{
p_filter
->
pf_do_work
=
Do_S16ToFL32_SW
;
p_filter
->
b_in_place
=
true
;
...
...
@@ -516,10 +516,10 @@ static int Create_S16ToFL32_SW( vlc_object_t *p_this )
return
0
;
}
if
(
(
p_filter
->
input
.
i_format
==
VLC_CODEC_S24L
||
p_filter
->
input
.
i_format
==
VLC_CODEC_S24B
)
&&
p_filter
->
output
.
i_format
==
VLC_CODEC_FL32
&&
p_filter
->
input
.
i_format
!=
VLC_CODEC_S24N
)
if
(
(
p_filter
->
fmt_in
.
audio
.
i_format
==
VLC_CODEC_S24L
||
p_filter
->
fmt_in
.
audio
.
i_format
==
VLC_CODEC_S24B
)
&&
p_filter
->
fmt_out
.
audio
.
i_format
==
VLC_CODEC_FL32
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_S24N
)
{
p_filter
->
pf_do_work
=
Do_S24ToFL32_SW
;
p_filter
->
b_in_place
=
true
;
...
...
@@ -527,10 +527,10 @@ static int Create_S16ToFL32_SW( vlc_object_t *p_this )
return
0
;
}
if
(
(
p_filter
->
input
.
i_format
==
VLC_CODEC_S32L
||
p_filter
->
input
.
i_format
==
VLC_CODEC_S32B
)
&&
p_filter
->
output
.
i_format
==
VLC_CODEC_FL32
&&
p_filter
->
input
.
i_format
!=
VLC_CODEC_S32N
)
if
(
(
p_filter
->
fmt_in
.
audio
.
i_format
==
VLC_CODEC_S32L
||
p_filter
->
fmt_in
.
audio
.
i_format
==
VLC_CODEC_S32B
)
&&
p_filter
->
fmt_out
.
audio
.
i_format
==
VLC_CODEC_FL32
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_S32N
)
{
p_filter
->
pf_do_work
=
Do_S32ToFL32_SW
;
p_filter
->
b_in_place
=
true
;
...
...
@@ -545,7 +545,7 @@ static void Do_S16ToFL32_SW( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
int16_t
*
p_in
;
...
...
@@ -568,7 +568,7 @@ static void Do_S24ToFL32_SW( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
uint8_t
*
p_in
=
(
uint8_t
*
)
p_in_buf
->
p_buffer
+
(
i
-
1
)
*
3
;
...
...
@@ -600,7 +600,7 @@ static void Do_S32ToFL32_SW( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
int32_t
*
p_in
=
(
int32_t
*
)
p_in_buf
->
p_buffer
+
i
-
1
;
...
...
@@ -623,13 +623,13 @@ static int Create_S8ToFL32( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_S8
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_S8
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -644,7 +644,7 @@ static void Do_S8ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
int8_t
*
p_in
=
(
int8_t
*
)
p_in_buf
->
p_buffer
+
i
-
1
;
...
...
@@ -667,13 +667,13 @@ static int Create_U8ToFL32( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_U8
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_U8
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -688,7 +688,7 @@ static void Do_U8ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
VLC_UNUSED
(
p_aout
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i
=
p_in_buf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* We start from the end because b_in_place is true */
uint8_t
*
p_in
=
(
uint8_t
*
)
p_in_buf
->
p_buffer
+
i
-
1
;
...
...
modules/audio_filter/converter/mpgatofixed32.c
View file @
d2549af0
...
...
@@ -88,15 +88,15 @@ static int Create( vlc_object_t *p_this )
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
struct
filter_sys_t
*
p_sys
;
if
(
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_MPGA
&&
p_filter
->
input
.
i_format
!=
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'3'
))
||
(
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
output
.
i_format
!=
VLC_CODEC_FI32
)
)
if
(
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_MPGA
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'3'
))
||
(
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FI32
)
)
{
return
-
1
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
return
-
1
;
}
...
...
@@ -130,7 +130,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf
->
i_nb_samples
=
p_in_buf
->
i_nb_samples
;
p_out_buf
->
i_buffer
=
p_in_buf
->
i_nb_samples
*
sizeof
(
vlc_fixed_t
)
*
aout_FormatNbChannels
(
&
p_filter
->
output
);
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
);
/* Do the actual decoding now. */
mad_stream_buffer
(
&
p_sys
->
mad_stream
,
p_in_buf
->
p_buffer
,
...
...
@@ -148,7 +148,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
if
(
p_sys
->
i_reject_count
>
0
)
{
if
(
p_filter
->
output
.
i_format
==
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_out
.
audio
.
i_format
==
VLC_CODEC_FL32
)
{
int
i
;
int
i_size
=
p_out_buf
->
i_buffer
/
sizeof
(
float
);
...
...
@@ -168,7 +168,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
mad_synth_frame
(
&
p_sys
->
mad_synth
,
&
p_sys
->
mad_frame
);
if
(
p_filter
->
output
.
i_format
==
VLC_CODEC_FI32
)
if
(
p_filter
->
fmt_out
.
audio
.
i_format
==
VLC_CODEC_FI32
)
{
/* Interleave and keep buffers in mad_fixed_t format */
mad_fixed_t
*
p_samples
=
(
mad_fixed_t
*
)
p_out_buf
->
p_buffer
;
...
...
@@ -180,14 +180,14 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
switch
(
p_pcm
->
channels
)
{
case
2
:
if
(
p_filter
->
output
.
i_physical_channels
==
AOUT_CHAN_CENTER
)
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
==
AOUT_CHAN_CENTER
)
{
while
(
i_samples
--
)
{
*
p_samples
++
=
(
*
p_left
++
>>
1
)
+
(
*
p_right
++
>>
1
);
}
}
else
if
(
p_filter
->
output
.
i_original_channels
==
AOUT_CHAN_LEFT
)
else
if
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
==
AOUT_CHAN_LEFT
)
{
while
(
i_samples
--
)
{
...
...
@@ -195,7 +195,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
*
p_samples
++
=
*
p_left
++
;
}
}
else
if
(
p_filter
->
output
.
i_original_channels
==
AOUT_CHAN_RIGHT
)
else
if
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
==
AOUT_CHAN_RIGHT
)
{
while
(
i_samples
--
)
{
...
...
@@ -235,7 +235,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
switch
(
p_pcm
->
channels
)
{
case
2
:
if
(
p_filter
->
output
.
i_physical_channels
==
AOUT_CHAN_CENTER
)
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
==
AOUT_CHAN_CENTER
)
{
while
(
i_samples
--
)
{
...
...
@@ -243,7 +243,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
(
float
)
*
p_right
++
/
f_temp
/
2
;
}
}
else
if
(
p_filter
->
output
.
i_original_channels
==
AOUT_CHAN_LEFT
)
else
if
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
==
AOUT_CHAN_LEFT
)
{
while
(
i_samples
--
)
{
...
...
@@ -251,7 +251,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
*
p_samples
++
=
(
float
)
*
p_left
++
/
f_temp
;
}
}
else
if
(
p_filter
->
output
.
i_original_channels
==
AOUT_CHAN_RIGHT
)
else
if
(
p_filter
->
fmt_out
.
audio
.
i_original_channels
==
AOUT_CHAN_RIGHT
)
{
while
(
i_samples
--
)
{
...
...
@@ -389,10 +389,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out
->
i_length
=
p_block
->
i_length
;
aout_filter
.
p_sys
=
(
struct
aout_filter_sys_t
*
)
p_filter
->
p_sys
;
aout_filter
.
input
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
input
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
output
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
output
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
aout_filter
.
fmt_in
.
audio
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
fmt_in
.
audio
.
i_format
=
p_filter
->
fmt_in
.
i_codec
;
aout_filter
.
fmt_out
.
audio
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
fmt_out
.
audio
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
in_buf
.
p_buffer
=
p_block
->
p_buffer
;
in_buf
.
i_flags
=
0
;
...
...
modules/audio_filter/converter/neon.c
View file @
d2549af0
...
...
@@ -45,13 +45,13 @@ static int Open (vlc_object_t *obj)
{
aout_filter_t
*
filter
=
(
aout_filter_t
*
)
obj
;
if
(
!
AOUT_FMTS_SIMILAR
(
&
filter
->
input
,
&
filter
->
output
))
if
(
!
AOUT_FMTS_SIMILAR
(
&
filter
->
fmt_in
.
audio
,
&
filter
->
fmt_out
.
audio
))
return
VLC_EGENERIC
;
switch
(
filter
->
input
.
i_format
)
switch
(
filter
->
fmt_in
.
audio
.
i_format
)
{
case
VLC_CODEC_FL32
:
switch
(
filter
->
output
.
i_format
)
switch
(
filter
->
fmt_out
.
audio
.
i_format
)
{
case
VLC_CODEC_FI32
:
filter
->
pf_do_work
=
Do_F32_S32
;
...
...
@@ -62,7 +62,7 @@ static int Open (vlc_object_t *obj)
break
;
case
VLC_CODEC_FI32
:
switch
(
filter
->
output
.
i_format
)
switch
(
filter
->
fmt_out
.
audio
.
i_format
)
{
case
VLC_CODEC_S16N
:
filter
->
pf_do_work
=
Do_S32_S16
;
...
...
@@ -86,7 +86,7 @@ static void Do_F32_S32 (aout_instance_t *aout, aout_filter_t *filter,
aout_buffer_t
*
inbuf
,
aout_buffer_t
*
outbuf
)
{
unsigned
nb_samples
=
inbuf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
filter
->
input
);
*
aout_FormatNbChannels
(
&
filter
->
fmt_in
.
audio
);
const
float
*
inp
=
(
float
*
)
inbuf
->
p_buffer
;
const
float
*
endp
=
inp
+
nb_samples
;
int32_t
*
outp
=
(
int32_t
*
)
outbuf
->
p_buffer
;
...
...
@@ -144,7 +144,7 @@ static void Do_S32_S16 (aout_instance_t *aout, aout_filter_t *filter,
aout_buffer_t
*
inbuf
,
aout_buffer_t
*
outbuf
)
{
unsigned
nb_samples
=
inbuf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
filter
->
input
);
*
aout_FormatNbChannels
(
&
filter
->
fmt_in
.
audio
);
int32_t
*
inp
=
(
int32_t
*
)
inbuf
->
p_buffer
;
const
int32_t
*
endp
=
inp
+
nb_samples
;
int16_t
*
outp
=
(
int16_t
*
)
outbuf
->
p_buffer
;
...
...
modules/audio_filter/equalizer.c
View file @
d2549af0
...
...
@@ -150,18 +150,18 @@ static int Open( vlc_object_t *p_this )
aout_filter_sys_t
*
p_sys
;
bool
b_fit
=
true
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
b_fit
=
false
;
p_filter
->
input
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
output
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_in
.
audio
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_out
.
audio
.
i_format
=
VLC_CODEC_FL32
;
msg_Warn
(
p_filter
,
"bad input or output format"
);
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
b_fit
=
false
;
memcpy
(
&
p_filter
->
output
,
&
p_filter
->
input
,
memcpy
(
&
p_filter
->
fmt_out
.
audio
,
&
p_filter
->
fmt_in
.
audio
,
sizeof
(
audio_sample_format_t
)
);
msg_Warn
(
p_filter
,
"input and output formats are not similar"
);
}
...
...
@@ -180,7 +180,7 @@ static int Open( vlc_object_t *p_this )
return
VLC_ENOMEM
;
vlc_mutex_init
(
&
p_sys
->
lock
);
if
(
EqzInit
(
p_filter
,
p_filter
->
input
.
i_rate
)
!=
VLC_SUCCESS
)
if
(
EqzInit
(
p_filter
,
p_filter
->
fmt_in
.
audio
.
i_rate
)
!=
VLC_SUCCESS
)
{
vlc_mutex_destroy
(
&
p_sys
->
lock
);
free
(
p_sys
);
...
...
@@ -217,7 +217,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
EqzFilter
(
p_filter
,
(
float
*
)
p_out_buf
->
p_buffer
,
(
float
*
)
p_in_buf
->
p_buffer
,
p_in_buf
->
i_nb_samples
,
aout_FormatNbChannels
(
&
p_filter
->
input
)
);
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
);
}
/*****************************************************************************
...
...
modules/audio_filter/normvol.c
View file @
d2549af0
...
...
@@ -103,19 +103,19 @@ static int Open( vlc_object_t *p_this )
int
i_channels
;
aout_filter_sys_t
*
p_sys
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
b_fit
=
false
;
p_filter
->
input
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
output
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_in
.
audio
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_out
.
audio
.
i_format
=
VLC_CODEC_FL32
;
msg_Warn
(
p_filter
,
"bad input or output format"
);
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
b_fit
=
false
;
memcpy
(
&
p_filter
->
output
,
&
p_filter
->
input
,
memcpy
(
&
p_filter
->
fmt_out
.
audio
,
&
p_filter
->
fmt_in
.
audio
,
sizeof
(
audio_sample_format_t
)
);
msg_Warn
(
p_filter
,
"input and output formats are not similar"
);
}
...
...
@@ -128,7 +128,7 @@ static int Open( vlc_object_t *p_this )
p_filter
->
pf_do_work
=
DoWork
;
p_filter
->
b_in_place
=
true
;
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
p_sys
=
p_filter
->
p_sys
=
malloc
(
sizeof
(
aout_filter_sys_t
)
);
if
(
!
p_sys
)
...
...
@@ -161,7 +161,7 @@ static int Open( vlc_object_t *p_this )
int
i
,
i_chan
;
int
i_samples
=
p_in_buf
->
i_nb_samples
;
int
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
float
*
p_out
=
(
float
*
)
p_out_buf
->
p_buffer
;
float
*
p_in
=
(
float
*
)
p_in_buf
->
p_buffer
;
...
...
modules/audio_filter/param_eq.c
View file @
d2549af0
...
...
@@ -111,18 +111,18 @@ static int Open( vlc_object_t *p_this )
bool
b_fit
=
true
;
int
i_samplerate
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
b_fit
=
false
;
p_filter
->
input
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
output
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_in
.
audio
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_out
.
audio
.
i_format
=
VLC_CODEC_FL32
;
msg_Warn
(
p_filter
,
"bad input or output format"
);
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
b_fit
=
false
;
memcpy
(
&
p_filter
->
output
,
&
p_filter
->
input
,
memcpy
(
&
p_filter
->
fmt_out
.
audio
,
&
p_filter
->
fmt_in
.
audio
,
sizeof
(
audio_sample_format_t
)
);
msg_Warn
(
p_filter
,
"input and output formats are not similar"
);
}
...
...
@@ -156,7 +156,7 @@ static int Open( vlc_object_t *p_this )
p_sys
->
f_gain3
=
config_GetFloat
(
p_this
,
"param-eq-gain3"
);
i_samplerate
=
p_filter
->
input
.
i_rate
;
i_samplerate
=
p_filter
->
fmt_in
.
audio
.
i_rate
;
CalcPeakEQCoeffs
(
p_sys
->
f_f1
,
p_sys
->
f_Q1
,
p_sys
->
f_gain1
,
i_samplerate
,
p_sys
->
coeffs
+
0
*
5
);
CalcPeakEQCoeffs
(
p_sys
->
f_f2
,
p_sys
->
f_Q2
,
p_sys
->
f_gain2
,
...
...
@@ -167,7 +167,7 @@ static int Open( vlc_object_t *p_this )
i_samplerate
,
p_sys
->
coeffs
+
3
*
5
);
CalcShelfEQCoeffs
(
p_sys
->
f_highf
,
1
,
p_sys
->
f_highgain
,
0
,
i_samplerate
,
p_sys
->
coeffs
+
4
*
5
);
p_sys
->
p_state
=
(
float
*
)
calloc
(
p_filter
->
input
.
i_channels
*
5
*
4
,
p_sys
->
p_state
=
(
float
*
)
calloc
(
p_filter
->
fmt_in
.
audio
.
i_channels
*
5
*
4
,
sizeof
(
float
)
);
return
VLC_SUCCESS
;
...
...
@@ -194,7 +194,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
ProcessEQ
(
(
float
*
)
p_in_buf
->
p_buffer
,
(
float
*
)
p_out_buf
->
p_buffer
,
p_filter
->
p_sys
->
p_state
,
p_filter
->
input
.
i_channels
,
p_in_buf
->
i_nb_samples
,
p_filter
->
fmt_in
.
audio
.
i_channels
,
p_in_buf
->
i_nb_samples
,
p_filter
->
p_sys
->
coeffs
,
5
);
}
...
...
modules/audio_filter/resampler/bandlimited.c
View file @
d2549af0
...
...
@@ -115,13 +115,13 @@ static int Create( vlc_object_t *p_this )
double
d_factor
;
int
i_filter_wing
;
if
(
p_filter
->
input
.
i_rate
==
p_filter
->
output
.
i_rate
||
p_filter
->
input
.
i_format
!=
p_filter
->
output
.
i_format
||
p_filter
->
input
.
i_physical_channels
!=
p_filter
->
output
.
i_physical_channels
||
p_filter
->
input
.
i_original_channels
!=
p_filter
->
output
.
i_original_channels
||
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
==
p_filter
->
fmt_out
.
audio
.
i_rate
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
p_filter
->
fmt_out
.
audio
.
i_format
||
p_filter
->
fmt_in
.
audio
.
i_physical_channels
!=
p_filter
->
fmt_out
.
audio
.
i_physical_channels
||
p_filter
->
fmt_in
.
audio
.
i_original_channels
!=
p_filter
->
fmt_out
.
audio
.
i_original_channels
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
return
VLC_EGENERIC
;
}
...
...
@@ -140,11 +140,11 @@ static int Create( vlc_object_t *p_this )
p_filter
->
p_sys
=
(
struct
aout_filter_sys_t
*
)
p_sys
;
/* Calculate worst case for the length of the filter wing */
d_factor
=
(
double
)
p_filter
->
output
.
i_rate
/
p_filter
->
input
.
i_rate
/
AOUT_MAX_INPUT_RATE
;
d_factor
=
(
double
)
p_filter
->
fmt_out
.
audio
.
i_rate
/
p_filter
->
fmt_in
.
audio
.
i_rate
/
AOUT_MAX_INPUT_RATE
;
i_filter_wing
=
((
SMALL_FILTER_NMULT
+
1
)
/
2
.
0
)
*
__MAX
(
1
.
0
,
1
.
0
/
d_factor
)
+
10
;
p_sys
->
i_buf_size
=
aout_FormatNbChannels
(
&
p_filter
->
input
)
*
p_sys
->
i_buf_size
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
*
sizeof
(
int32_t
)
*
2
*
i_filter_wing
;
/* Allocate enough memory to buffer previous samples */
...
...
@@ -186,7 +186,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_filter
->
p_sys
;
float
*
p_out
=
(
float
*
)
p_out_buf
->
p_buffer
;
int
i_nb_channels
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
int
i_nb_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
int
i_in_nb
=
p_in_buf
->
i_nb_samples
;
int
i_in
,
i_out
=
0
;
unsigned
int
i_out_rate
;
...
...
@@ -194,12 +194,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
int
i_filter_wing
;
if
(
p_sys
->
b_filter2
)
i_out_rate
=
p_filter
->
output
.
i_rate
;
i_out_rate
=
p_filter
->
fmt_out
.
audio
.
i_rate
;
else
i_out_rate
=
p_aout
->
mixer_format
.
i_rate
;
/* Check if we really need to run the resampler */
if
(
i_out_rate
==
p_filter
->
input
.
i_rate
)
if
(
i_out_rate
==
p_filter
->
fmt_in
.
audio
.
i_rate
)
{
#if 0 /* FIXME: needs audio filter2 to use block_Realloc */
if( /*p_filter->b_continuity && /--* What difference does it make ? :) */
...
...
@@ -207,14 +207,14 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
/* output the whole thing with the samples from last time */
p_in_buf = block_Realloc( p_in_buf,
p_sys->i_old_wing * p_filter->
input
.i_bytes_per_frame,
p_sys->i_old_wing * p_filter->
fmt_in.audio
.i_bytes_per_frame,
p_in_buf->i_buffer );
if( !p_in_buf )
abort();
memcpy( p_in_buf->p_buffer, p_sys->p_buf +
i_nb_channels * p_sys->i_old_wing,
p_sys->i_old_wing *
p_filter->
input
.i_bytes_per_frame );
p_filter->
fmt_in.audio
.i_bytes_per_frame );
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples +
p_sys->i_old_wing;
...
...
@@ -225,7 +225,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf->i_nb_samples ) - p_out_buf->i_pts;
p_out_buf->i_buffer = p_out_buf->i_nb_samples *
p_filter->
input
.i_bytes_per_frame;
p_filter->
fmt_in.audio
.i_bytes_per_frame;
}
#endif
p_filter
->
b_continuity
=
false
;
...
...
@@ -241,7 +241,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_sys
->
i_remainder
=
0
;
date_Init
(
&
p_sys
->
end_date
,
i_out_rate
,
1
);
date_Set
(
&
p_sys
->
end_date
,
p_in_buf
->
i_pts
);
p_sys
->
i_old_rate
=
p_filter
->
input
.
i_rate
;
p_sys
->
i_old_rate
=
p_filter
->
fmt_in
.
audio
.
i_rate
;
p_sys
->
d_old_factor
=
1
;
p_sys
->
i_old_wing
=
0
;
}
...
...
@@ -255,7 +255,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
/* Prepare the source buffer */
i_in_nb
+=
(
p_sys
->
i_old_wing
*
2
);
float
p_in_orig
[
i_in_nb
*
p_filter
->
input
.
i_bytes_per_frame
/
4
],
float
p_in_orig
[
i_in_nb
*
p_filter
->
fmt_in
.
audio
.
i_bytes_per_frame
/
4
],
*
p_in
=
p_in_orig
;
/* Copy all our samples in p_in */
...
...
@@ -263,17 +263,17 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
vlc_memcpy
(
p_in
,
p_sys
->
p_buf
,
p_sys
->
i_old_wing
*
2
*
p_filter
->
input
.
i_bytes_per_frame
);
p_filter
->
fmt_in
.
audio
.
i_bytes_per_frame
);
}
vlc_memcpy
(
p_in
+
p_sys
->
i_old_wing
*
2
*
i_nb_channels
,
p_in_buf
->
p_buffer
,
p_in_buf
->
i_nb_samples
*
p_filter
->
input
.
i_bytes_per_frame
);
p_in_buf
->
i_nb_samples
*
p_filter
->
fmt_in
.
audio
.
i_bytes_per_frame
);
/* Make sure the output buffer is reset */
memset
(
p_out
,
0
,
p_out_buf
->
i_buffer
);
/* Calculate the new length of the filter wing */
d_factor
=
(
double
)
i_out_rate
/
p_filter
->
input
.
i_rate
;
d_factor
=
(
double
)
i_out_rate
/
p_filter
->
fmt_in
.
audio
.
i_rate
;
i_filter_wing
=
((
SMALL_FILTER_NMULT
+
1
)
/
2
.
0
)
*
__MAX
(
1
.
0
,
1
.
0
/
d_factor
)
+
1
;
/* Account for increased filter gain when using factors less than 1 */
...
...
@@ -291,14 +291,14 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
/* Just copy the samples */
memcpy
(
p_out
,
p_in
,
p_filter
->
input
.
i_bytes_per_frame
);
p_filter
->
fmt_in
.
audio
.
i_bytes_per_frame
);
p_in
+=
i_nb_channels
;
p_out
+=
i_nb_channels
;
i_out
++
;
continue
;
}
while
(
p_sys
->
i_remainder
<
p_filter
->
output
.
i_rate
)
while
(
p_sys
->
i_remainder
<
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
if
(
p_sys
->
d_old_factor
>=
1
)
...
...
@@ -309,14 +309,14 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
FilterFloatUP
(
SMALL_FILTER_FLOAT_IMP
,
SMALL_FILTER_FLOAT_IMPD
,
SMALL_FILTER_NWING
,
p_in
,
p_out
,
p_sys
->
i_remainder
,
p_filter
->
output
.
i_rate
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
-
1
,
i_nb_channels
);
/* Perform right-wing inner product */
FilterFloatUP
(
SMALL_FILTER_FLOAT_IMP
,
SMALL_FILTER_FLOAT_IMPD
,
SMALL_FILTER_NWING
,
p_in
+
i_nb_channels
,
p_out
,
p_filter
->
output
.
i_rate
-
p_filter
->
fmt_out
.
audio
.
i_rate
-
p_sys
->
i_remainder
,
p_filter
->
output
.
i_rate
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
1
,
i_nb_channels
);
#if 0
...
...
@@ -328,12 +328,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
#endif
/* Sanity check */
if
(
p_out_buf
->
i_buffer
/
p_filter
->
input
.
i_bytes_per_frame
if
(
p_out_buf
->
i_buffer
/
p_filter
->
fmt_in
.
audio
.
i_bytes_per_frame
<=
(
unsigned
int
)
i_out
+
1
)
{
p_out
+=
i_nb_channels
;
i_out
++
;
p_sys
->
i_remainder
+=
p_filter
->
input
.
i_rate
;
p_sys
->
i_remainder
+=
p_filter
->
fmt_in
.
audio
.
i_rate
;
break
;
}
}
...
...
@@ -343,37 +343,37 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
FilterFloatUD
(
SMALL_FILTER_FLOAT_IMP
,
SMALL_FILTER_FLOAT_IMPD
,
SMALL_FILTER_NWING
,
p_in
,
p_out
,
p_sys
->
i_remainder
,
p_filter
->
output
.
i_rate
,
p_filter
->
input
.
i_rate
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
p_filter
->
fmt_in
.
audio
.
i_rate
,
-
1
,
i_nb_channels
);
/* Perform right-wing inner product */
FilterFloatUD
(
SMALL_FILTER_FLOAT_IMP
,
SMALL_FILTER_FLOAT_IMPD
,
SMALL_FILTER_NWING
,
p_in
+
i_nb_channels
,
p_out
,
p_filter
->
output
.
i_rate
-
p_filter
->
fmt_out
.
audio
.
i_rate
-
p_sys
->
i_remainder
,
p_filter
->
output
.
i_rate
,
p_filter
->
input
.
i_rate
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
p_filter
->
fmt_in
.
audio
.
i_rate
,
1
,
i_nb_channels
);
}
p_out
+=
i_nb_channels
;
i_out
++
;
p_sys
->
i_remainder
+=
p_filter
->
input
.
i_rate
;
p_sys
->
i_remainder
+=
p_filter
->
fmt_in
.
audio
.
i_rate
;
}
p_in
+=
i_nb_channels
;
p_sys
->
i_remainder
-=
p_filter
->
output
.
i_rate
;
p_sys
->
i_remainder
-=
p_filter
->
fmt_out
.
audio
.
i_rate
;
}
/* Apply the new rate for the rest of the samples */
if
(
i_in
<
i_in_nb
-
i_filter_wing
)
{
p_sys
->
i_old_rate
=
p_filter
->
input
.
i_rate
;
p_sys
->
i_old_rate
=
p_filter
->
fmt_in
.
audio
.
i_rate
;
p_sys
->
d_old_factor
=
d_factor
;
p_sys
->
i_old_wing
=
i_filter_wing
;
}
for
(
;
i_in
<
i_in_nb
-
i_filter_wing
;
i_in
++
)
{
while
(
p_sys
->
i_remainder
<
p_filter
->
output
.
i_rate
)
while
(
p_sys
->
i_remainder
<
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
if
(
d_factor
>=
1
)
...
...
@@ -384,15 +384,15 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
FilterFloatUP
(
SMALL_FILTER_FLOAT_IMP
,
SMALL_FILTER_FLOAT_IMPD
,
SMALL_FILTER_NWING
,
p_in
,
p_out
,
p_sys
->
i_remainder
,
p_filter
->
output
.
i_rate
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
-
1
,
i_nb_channels
);
/* Perform right-wing inner product */
FilterFloatUP
(
SMALL_FILTER_FLOAT_IMP
,
SMALL_FILTER_FLOAT_IMPD
,
SMALL_FILTER_NWING
,
p_in
+
i_nb_channels
,
p_out
,
p_filter
->
output
.
i_rate
-
p_filter
->
fmt_out
.
audio
.
i_rate
-
p_sys
->
i_remainder
,
p_filter
->
output
.
i_rate
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
1
,
i_nb_channels
);
#if 0
...
...
@@ -403,12 +403,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
#endif
/* Sanity check */
if
(
p_out_buf
->
i_buffer
/
p_filter
->
input
.
i_bytes_per_frame
if
(
p_out_buf
->
i_buffer
/
p_filter
->
fmt_in
.
audio
.
i_bytes_per_frame
<=
(
unsigned
int
)
i_out
+
1
)
{
p_out
+=
i_nb_channels
;
i_out
++
;
p_sys
->
i_remainder
+=
p_filter
->
input
.
i_rate
;
p_sys
->
i_remainder
+=
p_filter
->
fmt_in
.
audio
.
i_rate
;
break
;
}
}
...
...
@@ -418,25 +418,25 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
FilterFloatUD
(
SMALL_FILTER_FLOAT_IMP
,
SMALL_FILTER_FLOAT_IMPD
,
SMALL_FILTER_NWING
,
p_in
,
p_out
,
p_sys
->
i_remainder
,
p_filter
->
output
.
i_rate
,
p_filter
->
input
.
i_rate
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
p_filter
->
fmt_in
.
audio
.
i_rate
,
-
1
,
i_nb_channels
);
/* Perform right-wing inner product */
FilterFloatUD
(
SMALL_FILTER_FLOAT_IMP
,
SMALL_FILTER_FLOAT_IMPD
,
SMALL_FILTER_NWING
,
p_in
+
i_nb_channels
,
p_out
,
p_filter
->
output
.
i_rate
-
p_filter
->
fmt_out
.
audio
.
i_rate
-
p_sys
->
i_remainder
,
p_filter
->
output
.
i_rate
,
p_filter
->
input
.
i_rate
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
p_filter
->
fmt_in
.
audio
.
i_rate
,
1
,
i_nb_channels
);
}
p_out
+=
i_nb_channels
;
i_out
++
;
p_sys
->
i_remainder
+=
p_filter
->
input
.
i_rate
;
p_sys
->
i_remainder
+=
p_filter
->
fmt_in
.
audio
.
i_rate
;
}
p_in
+=
i_nb_channels
;
p_sys
->
i_remainder
-=
p_filter
->
output
.
i_rate
;
p_sys
->
i_remainder
-=
p_filter
->
fmt_out
.
audio
.
i_rate
;
}
/* Buffer i_filter_wing * 2 samples for next time */
...
...
@@ -445,12 +445,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
memcpy
(
p_sys
->
p_buf
,
p_in_orig
+
(
i_in_nb
-
2
*
p_sys
->
i_old_wing
)
*
i_nb_channels
,
(
2
*
p_sys
->
i_old_wing
)
*
p_filter
->
input
.
i_bytes_per_frame
);
p_filter
->
fmt_in
.
audio
.
i_bytes_per_frame
);
}
#if 0
msg_Err( p_filter, "p_out size: %i, nb bytes out: %i", p_out_buf->i_buffer,
i_out * p_filter->
input
.i_bytes_per_frame );
i_out * p_filter->
fmt_in.audio
.i_bytes_per_frame );
#endif
/* Finalize aout buffer */
...
...
@@ -577,11 +577,11 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
p_out
->
i_length
=
p_block
->
i_length
;
aout_filter
.
p_sys
=
(
struct
aout_filter_sys_t
*
)
p_filter
->
p_sys
;
aout_filter
.
input
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
input
.
i_bytes_per_frame
=
p_filter
->
fmt_in
.
audio
.
i_channels
*
aout_filter
.
fmt_in
.
audio
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
fmt_in
.
audio
.
i_bytes_per_frame
=
p_filter
->
fmt_in
.
audio
.
i_channels
*
p_filter
->
fmt_in
.
audio
.
i_bitspersample
/
8
;
aout_filter
.
output
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
output
.
i_bytes_per_frame
=
p_filter
->
fmt_out
.
audio
.
i_channels
*
aout_filter
.
fmt_out
.
audio
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
fmt_out
.
audio
.
i_bytes_per_frame
=
p_filter
->
fmt_out
.
audio
.
i_channels
*
p_filter
->
fmt_out
.
audio
.
i_bitspersample
/
8
;
aout_filter
.
b_continuity
=
!
p_filter
->
p_sys
->
b_first
;
p_filter
->
p_sys
->
b_first
=
false
;
...
...
modules/audio_filter/resampler/linear.c
View file @
d2549af0
...
...
@@ -84,13 +84,13 @@ static int Create( vlc_object_t *p_this )
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
struct
filter_sys_t
*
p_sys
;
if
(
p_filter
->
input
.
i_rate
==
p_filter
->
output
.
i_rate
||
p_filter
->
input
.
i_format
!=
p_filter
->
output
.
i_format
||
p_filter
->
input
.
i_physical_channels
!=
p_filter
->
output
.
i_physical_channels
||
p_filter
->
input
.
i_original_channels
!=
p_filter
->
output
.
i_original_channels
||
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
==
p_filter
->
fmt_out
.
audio
.
i_rate
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
p_filter
->
fmt_out
.
audio
.
i_format
||
p_filter
->
fmt_in
.
audio
.
i_physical_channels
!=
p_filter
->
fmt_out
.
audio
.
i_physical_channels
||
p_filter
->
fmt_in
.
audio
.
i_original_channels
!=
p_filter
->
fmt_out
.
audio
.
i_original_channels
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
return
VLC_EGENERIC
;
}
...
...
@@ -101,13 +101,13 @@ static int Create( vlc_object_t *p_this )
if
(
p_sys
==
NULL
)
return
VLC_ENOMEM
;
p_sys
->
p_prev_sample
=
malloc
(
p_filter
->
input
.
i_channels
*
sizeof
(
int32_t
)
);
p_filter
->
fmt_in
.
audio
.
i_channels
*
sizeof
(
int32_t
)
);
if
(
p_sys
->
p_prev_sample
==
NULL
)
{
free
(
p_sys
);
return
VLC_ENOMEM
;
}
date_Init
(
&
p_sys
->
end_date
,
p_filter
->
output
.
i_rate
,
1
);
date_Init
(
&
p_sys
->
end_date
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
1
);
p_filter
->
pf_do_work
=
DoWork
;
...
...
@@ -140,12 +140,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float
*
p_out
=
(
float
*
)
p_out_buf
->
p_buffer
;
float
*
p_prev_sample
=
(
float
*
)
p_sys
->
p_prev_sample
;
int
i_nb_channels
=
p_filter
->
input
.
i_channels
;
int
i_nb_channels
=
p_filter
->
fmt_in
.
audio
.
i_channels
;
int
i_in_nb
=
p_in_buf
->
i_nb_samples
;
int
i_chan
,
i_in
,
i_out
=
0
;
/* Check if we really need to run the resampler */
if
(
p_aout
->
mixer_format
.
i_rate
==
p_filter
->
input
.
i_rate
)
if
(
p_aout
->
mixer_format
.
i_rate
==
p_filter
->
fmt_in
.
audio
.
i_rate
)
{
#if 0 /* FIXME: needs audio filter2 for block_Realloc */
if( p_filter->b_continuity )
...
...
@@ -172,11 +172,11 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
p_filter
->
b_continuity
=
true
;
p_sys
->
i_remainder
=
0
;
date_Init
(
&
p_sys
->
end_date
,
p_filter
->
output
.
i_rate
,
1
);
date_Init
(
&
p_sys
->
end_date
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
1
);
}
else
{
while
(
p_sys
->
i_remainder
<
p_filter
->
output
.
i_rate
)
while
(
p_sys
->
i_remainder
<
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
for
(
i_chan
=
i_nb_channels
;
i_chan
;
)
{
...
...
@@ -184,20 +184,20 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out
[
i_chan
]
=
p_prev_sample
[
i_chan
];
p_out
[
i_chan
]
+=
(
(
p_in
[
i_chan
]
-
p_prev_sample
[
i_chan
]
)
*
p_sys
->
i_remainder
/
p_filter
->
output
.
i_rate
);
/
p_filter
->
fmt_out
.
audio
.
i_rate
);
}
p_out
+=
i_nb_channels
;
i_out
++
;
p_sys
->
i_remainder
+=
p_filter
->
input
.
i_rate
;
p_sys
->
i_remainder
+=
p_filter
->
fmt_in
.
audio
.
i_rate
;
}
p_sys
->
i_remainder
-=
p_filter
->
output
.
i_rate
;
p_sys
->
i_remainder
-=
p_filter
->
fmt_out
.
audio
.
i_rate
;
}
/* Take care of the current input samples (minus last one) */
for
(
i_in
=
0
;
i_in
<
i_in_nb
-
1
;
i_in
++
)
{
while
(
p_sys
->
i_remainder
<
p_filter
->
output
.
i_rate
)
while
(
p_sys
->
i_remainder
<
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
for
(
i_chan
=
i_nb_channels
;
i_chan
;
)
{
...
...
@@ -205,16 +205,16 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out
[
i_chan
]
=
p_in
[
i_chan
];
p_out
[
i_chan
]
+=
(
(
p_in
[
i_chan
+
i_nb_channels
]
-
p_in
[
i_chan
]
)
*
p_sys
->
i_remainder
/
p_filter
->
output
.
i_rate
);
*
p_sys
->
i_remainder
/
p_filter
->
fmt_out
.
audio
.
i_rate
);
}
p_out
+=
i_nb_channels
;
i_out
++
;
p_sys
->
i_remainder
+=
p_filter
->
input
.
i_rate
;
p_sys
->
i_remainder
+=
p_filter
->
fmt_in
.
audio
.
i_rate
;
}
p_in
+=
i_nb_channels
;
p_sys
->
i_remainder
-=
p_filter
->
output
.
i_rate
;
p_sys
->
i_remainder
-=
p_filter
->
fmt_out
.
audio
.
i_rate
;
}
/* Backup the last input sample for next time */
...
...
@@ -333,8 +333,8 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
p_out
->
i_length
=
p_block
->
i_length
;
aout_filter
.
p_sys
=
(
struct
aout_filter_sys_t
*
)
p_filter
->
p_sys
;
aout_filter
.
input
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
output
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
fmt_in
.
audio
=
p_filter
->
fmt_in
.
audio
;
aout_filter
.
fmt_out
.
audio
=
p_filter
->
fmt_out
.
audio
;
aout_filter
.
b_continuity
=
false
;
in_buf
.
p_buffer
=
p_block
->
p_buffer
;
...
...
modules/audio_filter/resampler/trivial.c
View file @
d2549af0
...
...
@@ -59,14 +59,14 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_rate
==
p_filter
->
output
.
i_rate
||
p_filter
->
input
.
i_format
!=
p_filter
->
output
.
i_format
||
p_filter
->
input
.
i_physical_channels
!=
p_filter
->
output
.
i_physical_channels
||
p_filter
->
input
.
i_original_channels
!=
p_filter
->
output
.
i_original_channels
||
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
input
.
i_format
!=
VLC_CODEC_FI32
)
)
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
==
p_filter
->
fmt_out
.
audio
.
i_rate
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
p_filter
->
fmt_out
.
audio
.
i_format
||
p_filter
->
fmt_in
.
audio
.
i_physical_channels
!=
p_filter
->
fmt_out
.
audio
.
i_physical_channels
||
p_filter
->
fmt_in
.
audio
.
i_original_channels
!=
p_filter
->
fmt_out
.
audio
.
i_original_channels
||
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FI32
)
)
{
return
-
1
;
}
...
...
@@ -84,13 +84,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t
*
p_in_buf
,
aout_buffer_t
*
p_out_buf
)
{
int
i_in_nb
=
p_in_buf
->
i_nb_samples
;
int
i_out_nb
=
i_in_nb
*
p_filter
->
output
.
i_rate
/
p_filter
->
input
.
i_rate
;
int
i_sample_bytes
=
aout_FormatNbChannels
(
&
p_filter
->
input
)
int
i_out_nb
=
i_in_nb
*
p_filter
->
fmt_out
.
audio
.
i_rate
/
p_filter
->
fmt_in
.
audio
.
i_rate
;
int
i_sample_bytes
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
*
sizeof
(
int32_t
);
/* Check if we really need to run the resampler */
if
(
p_aout
->
mixer_format
.
i_rate
==
p_filter
->
input
.
i_rate
)
if
(
p_aout
->
mixer_format
.
i_rate
==
p_filter
->
fmt_in
.
audio
.
i_rate
)
{
return
;
}
...
...
@@ -114,5 +114,5 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf
->
i_buffer
=
i_out_nb
*
i_sample_bytes
;
p_out_buf
->
i_pts
=
p_in_buf
->
i_pts
;
p_out_buf
->
i_length
=
p_out_buf
->
i_nb_samples
*
1000000
/
p_filter
->
output
.
i_rate
;
1000000
/
p_filter
->
fmt_out
.
audio
.
i_rate
;
}
modules/audio_filter/resampler/ugly.c
View file @
d2549af0
...
...
@@ -59,14 +59,14 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
if
(
p_filter
->
input
.
i_rate
==
p_filter
->
output
.
i_rate
||
p_filter
->
input
.
i_format
!=
p_filter
->
output
.
i_format
||
p_filter
->
input
.
i_physical_channels
!=
p_filter
->
output
.
i_physical_channels
||
p_filter
->
input
.
i_original_channels
!=
p_filter
->
output
.
i_original_channels
||
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
input
.
i_format
!=
VLC_CODEC_FI32
)
)
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
==
p_filter
->
fmt_out
.
audio
.
i_rate
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
p_filter
->
fmt_out
.
audio
.
i_format
||
p_filter
->
fmt_in
.
audio
.
i_physical_channels
!=
p_filter
->
fmt_out
.
audio
.
i_physical_channels
||
p_filter
->
fmt_in
.
audio
.
i_original_channels
!=
p_filter
->
fmt_out
.
audio
.
i_original_channels
||
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FI32
)
)
{
return
VLC_EGENERIC
;
}
...
...
@@ -88,15 +88,15 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
int32_t
*
p_out
=
(
int32_t
*
)
p_out_buf
->
p_buffer
;
unsigned
int
i_nb_channels
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
unsigned
int
i_nb_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
unsigned
int
i_in_nb
=
p_in_buf
->
i_nb_samples
;
unsigned
int
i_out_nb
=
i_in_nb
*
p_filter
->
output
.
i_rate
/
p_filter
->
input
.
i_rate
;
unsigned
int
i_out_nb
=
i_in_nb
*
p_filter
->
fmt_out
.
audio
.
i_rate
/
p_filter
->
fmt_in
.
audio
.
i_rate
;
unsigned
int
i_sample_bytes
=
i_nb_channels
*
sizeof
(
int32_t
);
unsigned
int
i_out
,
i_chan
,
i_remainder
=
0
;
/* Check if we really need to run the resampler */
if
(
p_aout
->
mixer_format
.
i_rate
==
p_filter
->
input
.
i_rate
)
if
(
p_aout
->
mixer_format
.
i_rate
==
p_filter
->
fmt_in
.
audio
.
i_rate
)
{
return
;
}
...
...
@@ -115,11 +115,11 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
p_out
+=
i_nb_channels
;
i_remainder
+=
p_filter
->
input
.
i_rate
;
while
(
i_remainder
>=
p_filter
->
output
.
i_rate
)
i_remainder
+=
p_filter
->
fmt_in
.
audio
.
i_rate
;
while
(
i_remainder
>=
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
p_in
+=
i_nb_channels
;
i_remainder
-=
p_filter
->
output
.
i_rate
;
i_remainder
-=
p_filter
->
fmt_out
.
audio
.
i_rate
;
}
}
...
...
@@ -127,5 +127,5 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf
->
i_buffer
=
i_out_nb
*
i_sample_bytes
;
p_out_buf
->
i_pts
=
p_in_buf
->
i_pts
;
p_out_buf
->
i_length
=
p_out_buf
->
i_nb_samples
*
1000000
/
p_filter
->
output
.
i_rate
;
1000000
/
p_filter
->
fmt_out
.
audio
.
i_rate
;
}
modules/audio_filter/scaletempo.c
View file @
d2549af0
...
...
@@ -392,17 +392,17 @@ static int Open( vlc_object_t *p_this )
aout_filter_sys_t
*
p_sys
;
bool
b_fit
=
true
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
b_fit
=
false
;
p_filter
->
input
.
i_format
=
p_filter
->
output
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_in
.
audio
.
i_format
=
p_filter
->
fmt_out
.
audio
.
i_format
=
VLC_CODEC_FL32
;
msg_Warn
(
p_filter
,
"bad input or output format"
);
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
b_fit
=
false
;
memcpy
(
&
p_filter
->
output
,
&
p_filter
->
input
,
sizeof
(
audio_sample_format_t
)
);
memcpy
(
&
p_filter
->
fmt_out
.
audio
,
&
p_filter
->
fmt_in
.
audio
,
sizeof
(
audio_sample_format_t
)
);
msg_Warn
(
p_filter
,
"input and output formats are not similar"
);
}
...
...
@@ -418,8 +418,8 @@ static int Open( vlc_object_t *p_this )
return
VLC_ENOMEM
;
p_sys
->
scale
=
1
.
0
;
p_sys
->
sample_rate
=
p_filter
->
input
.
i_rate
;
p_sys
->
samples_per_frame
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
p_sys
->
sample_rate
=
p_filter
->
fmt_in
.
audio
.
i_rate
;
p_sys
->
samples_per_frame
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
p_sys
->
bytes_per_sample
=
4
;
p_sys
->
bytes_per_frame
=
p_sys
->
samples_per_frame
*
p_sys
->
bytes_per_sample
;
...
...
@@ -481,14 +481,14 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
VLC_UNUSED
(
p_aout
);
aout_filter_sys_t
*
p
=
p_filter
->
p_sys
;
if
(
p_filter
->
input
.
i_rate
==
p
->
sample_rate
)
{
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
==
p
->
sample_rate
)
{
memcpy
(
p_out_buf
->
p_buffer
,
p_in_buf
->
p_buffer
,
p_in_buf
->
i_buffer
);
p_out_buf
->
i_buffer
=
p_in_buf
->
i_buffer
;
p_out_buf
->
i_nb_samples
=
p_in_buf
->
i_nb_samples
;
return
;
}
double
scale
=
p_filter
->
input
.
i_rate
/
(
double
)
p
->
sample_rate
;
double
scale
=
p_filter
->
fmt_in
.
audio
.
i_rate
/
(
double
)
p
->
sample_rate
;
if
(
scale
!=
p
->
scale
)
{
p
->
scale
=
scale
;
p
->
bytes_stride_scaled
=
p
->
bytes_stride
*
p
->
scale
;
...
...
modules/audio_filter/spatializer/spatializer.cpp
View file @
d2549af0
...
...
@@ -132,18 +132,18 @@ static int Open( vlc_object_t *p_this )
bool
b_fit
=
true
;
msg_Dbg
(
p_this
,
"Opening filter spatializer"
);
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
b_fit
=
false
;
p_filter
->
input
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
output
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_in
.
audio
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_out
.
audio
.
i_format
=
VLC_CODEC_FL32
;
msg_Warn
(
p_filter
,
"bad input or output format"
);
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
b_fit
=
false
;
memcpy
(
&
p_filter
->
output
,
&
p_filter
->
input
,
memcpy
(
&
p_filter
->
fmt_out
.
audio
,
&
p_filter
->
fmt_in
.
audio
,
sizeof
(
audio_sample_format_t
)
);
msg_Warn
(
p_filter
,
"input and output formats are not similar"
);
}
...
...
@@ -239,7 +239,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
SpatFilter
(
p_aout
,
p_filter
,
(
float
*
)
p_out_buf
->
p_buffer
,
(
float
*
)
p_in_buf
->
p_buffer
,
p_in_buf
->
i_nb_samples
,
aout_FormatNbChannels
(
&
p_filter
->
input
)
);
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
);
}
...
...
modules/visualization/goom.c
View file @
d2549af0
...
...
@@ -137,13 +137,13 @@ static int Open( vlc_object_t *p_this )
video_format_t
fmt
;
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
msg_Warn
(
p_filter
,
"bad input or output format"
);
return
VLC_EGENERIC
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
msg_Warn
(
p_filter
,
"input and output formats are not similar"
);
return
VLC_EGENERIC
;
...
...
@@ -184,9 +184,9 @@ static int Open( vlc_object_t *p_this )
vlc_cond_init
(
&
p_thread
->
wait
);
p_thread
->
i_blocks
=
0
;
date_Init
(
&
p_thread
->
date
,
p_filter
->
output
.
i_rate
,
1
);
date_Init
(
&
p_thread
->
date
,
p_filter
->
fmt_out
.
audio
.
i_rate
,
1
);
date_Set
(
&
p_thread
->
date
,
0
);
p_thread
->
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
p_thread
->
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
p_thread
->
psz_title
=
TitleGet
(
VLC_OBJECT
(
p_filter
)
);
...
...
modules/visualization/projectm.cpp
View file @
d2549af0
...
...
@@ -162,13 +162,13 @@ static int Open( vlc_object_t * p_this )
projectm_thread_t
*
p_thread
;
/* Test the audio format */
if
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
output
.
i_format
!=
VLC_CODEC_FL32
)
if
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
p_filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
)
{
msg_Warn
(
p_filter
,
"bad input or output format"
);
return
VLC_EGENERIC
;
}
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
input
,
&
p_filter
->
output
)
)
if
(
!
AOUT_FMTS_SIMILAR
(
&
p_filter
->
fmt_in
.
audio
,
&
p_filter
->
fmt_out
.
audio
)
)
{
msg_Warn
(
p_filter
,
"input and outut are not similar"
);
return
VLC_EGENERIC
;
...
...
@@ -198,7 +198,7 @@ static int Open( vlc_object_t * p_this )
return
i_ret
;
}
p_thread
->
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
p_thread
->
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
p_thread
->
psz_config
=
var_CreateGetString
(
p_filter
,
"projectm-config"
);
vlc_mutex_init
(
&
p_thread
->
lock
);
p_thread
->
p_buffer
=
NULL
;
...
...
modules/visualization/visual/visual.c
View file @
d2549af0
...
...
@@ -194,8 +194,8 @@ static int Open( vlc_object_t *p_this )
char
*
psz_effects
,
*
psz_parser
;
video_format_t
fmt
;
if
(
(
p_filter
->
input
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
input
.
i_format
!=
VLC_CODEC_FI32
)
)
if
(
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FI32
)
)
{
return
VLC_EGENERIC
;
}
...
...
@@ -229,7 +229,7 @@ static int Open( vlc_object_t *p_this )
break
;
p_effect
->
i_width
=
p_sys
->
i_width
;
p_effect
->
i_height
=
p_sys
->
i_height
;
p_effect
->
i_nb_chans
=
aout_FormatNbChannels
(
&
p_filter
->
input
);
p_effect
->
i_nb_chans
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
p_effect
->
i_idx_left
=
0
;
p_effect
->
i_idx_right
=
__MIN
(
1
,
p_effect
->
i_nb_chans
-
1
);
...
...
@@ -344,8 +344,8 @@ static void DoWork( aout_instance_t *p_aout, aout_filter_t *p_filter,
p_out_buf
->
i_nb_samples
=
p_in_buf
->
i_nb_samples
;
p_out_buf
->
i_buffer
=
p_in_buf
->
i_buffer
*
aout_FormatNbChannels
(
&
p_filter
->
output
)
/
aout_FormatNbChannels
(
&
p_filter
->
input
);
aout_FormatNbChannels
(
&
p_filter
->
fmt_out
.
audio
)
/
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
/* First, get a new picture */
while
(
(
p_outpic
=
vout_CreatePicture
(
p_sys
->
p_vout
,
0
,
0
,
3
)
)
==
NULL
)
...
...
src/audio_output/filters.c
View file @
d2549af0
...
...
@@ -53,8 +53,8 @@ static aout_filter_t * FindFilter( aout_instance_t * p_aout,
if
(
p_filter
==
NULL
)
return
NULL
;
vlc_object_attach
(
p_filter
,
p_aout
);
memcpy
(
&
p_filter
->
input
,
p_input_format
,
sizeof
(
audio_sample_format_t
)
);
memcpy
(
&
p_filter
->
output
,
p_output_format
,
memcpy
(
&
p_filter
->
fmt_in
.
audio
,
p_input_format
,
sizeof
(
audio_sample_format_t
)
);
memcpy
(
&
p_filter
->
fmt_out
.
audio
,
p_output_format
,
sizeof
(
audio_sample_format_t
)
);
p_filter
->
p_module
=
module_need
(
p_filter
,
"audio filter"
,
NULL
,
false
);
if
(
p_filter
->
p_module
==
NULL
)
...
...
@@ -206,12 +206,12 @@ int aout_FiltersCreatePipeline( aout_instance_t * p_aout,
AOUT_MAX_FILTERS
);
return
-
1
;
}
pp_filters
[
1
]
=
FindFilter
(
p_aout
,
&
pp_filters
[
0
]
->
output
,
pp_filters
[
1
]
=
FindFilter
(
p_aout
,
&
pp_filters
[
0
]
->
fmt_out
.
audio
,
p_output_format
);
if
(
pp_filters
[
1
]
==
NULL
)
{
/* Try to split the conversion. */
i_nb_conversions
=
SplitConversion
(
&
pp_filters
[
0
]
->
output
,
i_nb_conversions
=
SplitConversion
(
&
pp_filters
[
0
]
->
fmt_out
.
audio
,
p_output_format
,
&
temp_format
);
if
(
!
i_nb_conversions
)
{
...
...
@@ -229,7 +229,7 @@ int aout_FiltersCreatePipeline( aout_instance_t * p_aout,
AOUT_MAX_FILTERS
);
return
-
1
;
}
pp_filters
[
1
]
=
FindFilter
(
p_aout
,
&
pp_filters
[
0
]
->
output
,
pp_filters
[
1
]
=
FindFilter
(
p_aout
,
&
pp_filters
[
0
]
->
fmt_out
.
audio
,
&
temp_format
);
pp_filters
[
2
]
=
FindFilter
(
p_aout
,
&
temp_format
,
p_output_format
);
...
...
@@ -298,12 +298,12 @@ void aout_FiltersHintBuffers( aout_instance_t * p_aout,
{
aout_filter_t
*
p_filter
=
pp_filters
[
i
];
int
i_output_size
=
p_filter
->
output
.
i_bytes_per_frame
*
p_filter
->
output
.
i_rate
*
AOUT_MAX_INPUT_RATE
/
p_filter
->
output
.
i_frame_length
;
int
i_input_size
=
p_filter
->
input
.
i_bytes_per_frame
*
p_filter
->
input
.
i_rate
*
AOUT_MAX_INPUT_RATE
/
p_filter
->
input
.
i_frame_length
;
int
i_output_size
=
p_filter
->
fmt_out
.
audio
.
i_bytes_per_frame
*
p_filter
->
fmt_out
.
audio
.
i_rate
*
AOUT_MAX_INPUT_RATE
/
p_filter
->
fmt_out
.
audio
.
i_frame_length
;
int
i_input_size
=
p_filter
->
fmt_in
.
audio
.
i_bytes_per_frame
*
p_filter
->
fmt_in
.
audio
.
i_rate
*
AOUT_MAX_INPUT_RATE
/
p_filter
->
fmt_in
.
audio
.
i_frame_length
;
p_first_alloc
->
i_bytes_per_sec
=
__MAX
(
p_first_alloc
->
i_bytes_per_sec
,
i_output_size
);
...
...
@@ -345,7 +345,7 @@ void aout_FiltersPlay( aout_instance_t * p_aout,
* slightly bigger buffers. */
p_output_buffer
=
aout_BufferAlloc
(
&
p_filter
->
output_alloc
,
((
mtime_t
)(
*
pp_input_buffer
)
->
i_nb_samples
+
2
)
*
1000000
/
p_filter
->
input
.
i_rate
,
*
1000000
/
p_filter
->
fmt_in
.
audio
.
i_rate
,
*
pp_input_buffer
);
if
(
p_output_buffer
==
NULL
)
return
;
...
...
src/audio_output/input.c
View file @
d2549af0
...
...
@@ -288,9 +288,9 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
p_filter
->
p_owner
->
p_input
=
p_input
;
/* request format */
memcpy
(
&
p_filter
->
input
,
&
chain_output_format
,
memcpy
(
&
p_filter
->
fmt_in
.
audio
,
&
chain_output_format
,
sizeof
(
audio_sample_format_t
)
);
memcpy
(
&
p_filter
->
output
,
&
chain_output_format
,
memcpy
(
&
p_filter
->
fmt_out
.
audio
,
&
chain_output_format
,
sizeof
(
audio_sample_format_t
)
);
...
...
@@ -308,13 +308,13 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
if
(
p_filter
->
p_module
==
NULL
)
{
/* if the filter requested a special format, retry */
if
(
!
(
AOUT_FMTS_IDENTICAL
(
&
p_filter
->
input
,
if
(
!
(
AOUT_FMTS_IDENTICAL
(
&
p_filter
->
fmt_in
.
audio
,
&
chain_input_format
)
&&
AOUT_FMTS_IDENTICAL
(
&
p_filter
->
output
,
&&
AOUT_FMTS_IDENTICAL
(
&
p_filter
->
fmt_out
.
audio
,
&
chain_output_format
)
)
)
{
aout_FormatPrepare
(
&
p_filter
->
input
);
aout_FormatPrepare
(
&
p_filter
->
output
);
aout_FormatPrepare
(
&
p_filter
->
fmt_in
.
audio
);
aout_FormatPrepare
(
&
p_filter
->
fmt_out
.
audio
);
p_filter
->
p_module
=
module_need
(
p_filter
,
"audio filter"
,
psz_parser
,
true
);
...
...
@@ -322,9 +322,9 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
/* try visual filters */
else
{
memcpy
(
&
p_filter
->
input
,
&
chain_output_format
,
memcpy
(
&
p_filter
->
fmt_in
.
audio
,
&
chain_output_format
,
sizeof
(
audio_sample_format_t
)
);
memcpy
(
&
p_filter
->
output
,
&
chain_output_format
,
memcpy
(
&
p_filter
->
fmt_out
.
audio
,
&
chain_output_format
,
sizeof
(
audio_sample_format_t
)
);
p_filter
->
p_module
=
module_need
(
p_filter
,
"visualization"
,
...
...
@@ -348,12 +348,13 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
}
/* complete the filter chain if necessary */
if
(
!
AOUT_FMTS_IDENTICAL
(
&
chain_input_format
,
&
p_filter
->
input
)
)
if
(
!
AOUT_FMTS_IDENTICAL
(
&
chain_input_format
,
&
p_filter
->
fmt_in
.
audio
)
)
{
if
(
aout_FiltersCreatePipeline
(
p_aout
,
p_input
->
pp_filters
,
&
p_input
->
i_nb_filters
,
&
chain_input_format
,
&
p_filter
->
input
)
<
0
)
&
p_filter
->
fmt_in
.
audio
)
<
0
)
{
msg_Err
(
p_aout
,
"cannot add user filter %s (skipped)"
,
psz_parser
);
...
...
@@ -371,7 +372,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
/* success */
p_filter
->
b_continuity
=
false
;
p_input
->
pp_filters
[
p_input
->
i_nb_filters
++
]
=
p_filter
;
memcpy
(
&
chain_input_format
,
&
p_filter
->
output
,
memcpy
(
&
chain_input_format
,
&
p_filter
->
fmt_out
.
audio
,
sizeof
(
audio_sample_format_t
)
);
if
(
i_visual
==
0
)
/* scaletempo */
...
...
@@ -428,7 +429,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
p_input
->
input_alloc
.
b_alloc
=
true
;
/* Setup the initial rate of the resampler */
p_input
->
pp_resamplers
[
0
]
->
input
.
i_rate
=
p_input
->
input
.
i_rate
;
p_input
->
pp_resamplers
[
0
]
->
fmt_in
.
audio
.
i_rate
=
p_input
->
input
.
i_rate
;
}
p_input
->
i_resampling_type
=
AOUT_RESAMPLING_NONE
;
...
...
@@ -563,7 +564,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
/* Handle input rate change, but keep drift correction */
if
(
i_input_rate
!=
p_input
->
i_last_input_rate
)
{
unsigned
int
*
const
pi_rate
=
&
p_input
->
p_playback_rate_filter
->
input
.
i_rate
;
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
);
...
...
@@ -679,11 +680,11 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
if
(
p_input
->
i_resampling_type
==
AOUT_RESAMPLING_UP
)
{
p_input
->
pp_resamplers
[
0
]
->
input
.
i_rate
+=
2
;
/* Hz */
p_input
->
pp_resamplers
[
0
]
->
fmt_in
.
audio
.
i_rate
+=
2
;
/* Hz */
}
else
{
p_input
->
pp_resamplers
[
0
]
->
input
.
i_rate
-=
2
;
/* Hz */
p_input
->
pp_resamplers
[
0
]
->
fmt_in
.
audio
.
i_rate
-=
2
;
/* Hz */
}
/* Check if everything is back to normal, in which case we can stop the
...
...
@@ -692,7 +693,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
(
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
;
if
(
p_input
->
pp_resamplers
[
0
]
->
input
.
i_rate
==
i_nominal_rate
)
if
(
p_input
->
pp_resamplers
[
0
]
->
fmt_in
.
audio
.
i_rate
==
i_nominal_rate
)
{
p_input
->
i_resampling_type
=
AOUT_RESAMPLING_NONE
;
msg_Warn
(
p_aout
,
"resampling stopped after %"
PRIi64
" usec "
...
...
@@ -789,7 +790,7 @@ static void inputResamplingStop( aout_input_t *p_input )
p_input
->
i_resampling_type
=
AOUT_RESAMPLING_NONE
;
if
(
p_input
->
i_nb_resamplers
!=
0
)
{
p_input
->
pp_resamplers
[
0
]
->
input
.
i_rate
=
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
;
...
...
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