Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
cdb6ccc5
Commit
cdb6ccc5
authored
Sep 07, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simple mixer: remove useless allocation and simplify
parent
f1d743d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
40 deletions
+21
-40
modules/audio_filter/channel_mixer/simple.c
modules/audio_filter/channel_mixer/simple.c
+21
-40
No files found.
modules/audio_filter/channel_mixer/simple.c
View file @
cdb6ccc5
...
...
@@ -39,24 +39,15 @@
* Module descriptor
*****************************************************************************/
static
int
OpenFilter
(
vlc_object_t
*
);
static
void
CloseFilter
(
vlc_object_t
*
);
vlc_module_begin
()
set_description
(
N_
(
"Audio filter for simple channel mixing"
)
)
set_category
(
CAT_AUDIO
)
set_subcategory
(
SUBCAT_AUDIO_MISC
)
set_capability
(
"audio converter"
,
10
)
set_callbacks
(
OpenFilter
,
CloseFilter
);
set_callbacks
(
OpenFilter
,
NULL
);
vlc_module_end
()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct
filter_sys_t
{
void
(
*
pf_dowork
)(
filter_t
*
,
block_t
*
,
block_t
*
);
};
/*****************************************************************************
* IsSupported: can we downmix?
*****************************************************************************/
...
...
@@ -327,7 +318,7 @@ static void DoWork_6_1_to_5_x( filter_t * p_filter, block_t * p_in_buf, block_t
static
int
OpenFilter
(
vlc_object_t
*
p_this
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
;
void
(
*
do_work
)(
filter_t
*
,
block_t
*
,
block_t
*
)
=
NULL
;
audio_format_t
fmt_in
=
p_filter
->
fmt_in
.
audio
;
audio_format_t
fmt_out
=
p_filter
->
fmt_out
.
audio
;
...
...
@@ -335,12 +326,6 @@ static int OpenFilter( vlc_object_t *p_this )
if
(
!
IsSupported
(
&
fmt_in
,
&
fmt_out
)
)
return
VLC_EGENERIC
;
p_filter
->
p_sys
=
malloc
(
sizeof
(
*
p_sys
)
);
if
(
unlikely
(
!
p_filter
->
p_sys
)
)
return
VLC_ENOMEM
;
p_filter
->
pf_audio_filter
=
Filter
;
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_6_1
=
!
b_input_7_0
&&
...
...
@@ -356,61 +341,57 @@ static int OpenFilter( vlc_object_t *p_this )
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
==
AOUT_CHANS_2_0
)
{
if
(
b_input_7_0
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_7_x_to_2_0
;
do_
work
=
DoWork_7_x_to_2_0
;
else
if
(
b_input_6_1
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_6_1_to_2_0
;
do_
work
=
DoWork_6_1_to_2_0
;
else
if
(
b_input_5_0
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_5_x_to_2_0
;
do_
work
=
DoWork_5_x_to_2_0
;
else
if
(
b_input_4_center_rear
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_4_0_to_2_0
;
do_
work
=
DoWork_4_0_to_2_0
;
else
if
(
b_input_3_0
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_3_x_to_2_0
;
do_
work
=
DoWork_3_x_to_2_0
;
}
else
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
==
AOUT_CHAN_CENTER
)
{
if
(
b_input_7_0
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_7_x_to_1_0
;
do_
work
=
DoWork_7_x_to_1_0
;
else
if
(
b_input_5_0
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_5_x_to_1_0
;
do_
work
=
DoWork_5_x_to_1_0
;
else
if
(
b_input_4_center_rear
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_4_0_to_1_0
;
do_
work
=
DoWork_4_0_to_1_0
;
else
if
(
b_input_3_0
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_3_x_to_1_0
;
do_
work
=
DoWork_3_x_to_1_0
;
else
p_filter
->
p_sys
->
pf_do
work
=
DoWork_2_x_to_1_0
;
do_
work
=
DoWork_2_x_to_1_0
;
}
else
if
(
p_filter
->
fmt_out
.
audio
.
i_physical_channels
==
AOUT_CHANS_4_0
)
{
if
(
b_input_7_0
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_7_x_to_4_0
;
do_
work
=
DoWork_7_x_to_4_0
;
else
p_filter
->
p_sys
->
pf_do
work
=
DoWork_5_x_to_4_0
;
do_
work
=
DoWork_5_x_to_4_0
;
}
else
{
assert
(
b_input_7_0
||
b_input_6_1
);
if
(
b_input_7_0
)
p_filter
->
p_sys
->
pf_do
work
=
DoWork_7_x_to_5_x
;
do_
work
=
DoWork_7_x_to_5_x
;
else
p_filter
->
p_sys
->
pf_do
work
=
DoWork_6_1_to_5_x
;
do_
work
=
DoWork_6_1_to_5_x
;
}
p_filter
->
pf_audio_filter
=
Filter
;
p_filter
->
p_sys
=
(
void
*
)
do_work
;
return
VLC_SUCCESS
;
}
static
void
CloseFilter
(
vlc_object_t
*
p_this
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
free
(
p_sys
);
}
/*****************************************************************************
* Filter:
*****************************************************************************/
static
block_t
*
Filter
(
filter_t
*
p_filter
,
block_t
*
p_block
)
{
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_filter
->
p_sys
;
void
(
*
work
)(
filter_t
*
,
block_t
*
,
block_t
*
)
=
(
void
*
)
p_filter
->
p_sys
;
if
(
!
p_block
||
!
p_block
->
i_nb_samples
)
{
if
(
p_block
)
...
...
@@ -440,7 +421,7 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block )
p_out
->
i_nb_samples
=
p_block
->
i_nb_samples
;
p_out
->
i_buffer
=
p_block
->
i_buffer
*
i_output_nb
/
i_input_nb
;
p_sys
->
pf_do
work
(
p_filter
,
p_block
,
p_out
);
work
(
p_filter
,
p_block
,
p_out
);
block_Release
(
p_block
);
...
...
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