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
17afdb91
Commit
17afdb91
authored
Aug 29, 2006
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
1d0b15b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
modules/audio_filter/converter/mono.c
modules/audio_filter/converter/mono.c
+17
-13
No files found.
modules/audio_filter/converter/mono.c
View file @
17afdb91
...
@@ -103,7 +103,7 @@ static const uint32_t pi_channels_out[] =
...
@@ -103,7 +103,7 @@ static const uint32_t pi_channels_out[] =
{
AOUT_CHAN_LEFT
,
AOUT_CHAN_RIGHT
,
AOUT_CHAN_REARLEFT
,
AOUT_CHAN_REARRIGHT
,
{
AOUT_CHAN_LEFT
,
AOUT_CHAN_RIGHT
,
AOUT_CHAN_REARLEFT
,
AOUT_CHAN_REARRIGHT
,
AOUT_CHAN_CENTER
,
AOUT_CHAN_LFE
,
0
};
AOUT_CHAN_CENTER
,
AOUT_CHAN_LFE
,
0
};
#define MONO_CFG "sout-"
#define MONO_CFG "sout-
mono-
"
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
*****************************************************************************/
*****************************************************************************/
...
@@ -111,9 +111,9 @@ vlc_module_begin();
...
@@ -111,9 +111,9 @@ vlc_module_begin();
set_description
(
_
(
"Audio filter for stereo to mono conversion"
)
);
set_description
(
_
(
"Audio filter for stereo to mono conversion"
)
);
set_capability
(
"audio filter2"
,
5
);
set_capability
(
"audio filter2"
,
5
);
add_bool
(
MONO_CFG
"
mono-
downmix"
,
VLC_FALSE
,
NULL
,
MONO_DOWNMIX_TEXT
,
add_bool
(
MONO_CFG
"downmix"
,
VLC_FALSE
,
NULL
,
MONO_DOWNMIX_TEXT
,
MONO_DOWNMIX_LONGTEXT
,
VLC_FALSE
);
MONO_DOWNMIX_LONGTEXT
,
VLC_FALSE
);
add_integer
(
MONO_CFG
"
mono-
channel"
,
-
1
,
NULL
,
MONO_CHANNEL_TEXT
,
add_integer
(
MONO_CFG
"channel"
,
-
1
,
NULL
,
MONO_CHANNEL_TEXT
,
MONO_CHANNEL_LONGTEXT
,
VLC_FALSE
);
MONO_CHANNEL_LONGTEXT
,
VLC_FALSE
);
change_integer_list
(
pi_pos_values
,
ppsz_pos_descriptions
,
0
);
change_integer_list
(
pi_pos_values
,
ppsz_pos_descriptions
,
0
);
...
@@ -379,7 +379,9 @@ static int OpenFilter( vlc_object_t *p_this )
...
@@ -379,7 +379,9 @@ static int OpenFilter( vlc_object_t *p_this )
if
(
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
p_filter
->
fmt_out
.
audio
.
i_format
)
&&
if
(
(
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_rate
!=
p_filter
->
fmt_out
.
audio
.
i_rate
)
&&
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
AOUT_FMT_S16_NE
)
&&
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
AOUT_FMT_S16_NE
)
&&
(
p_filter
->
fmt_out
.
audio
.
i_format
!=
AOUT_FMT_S16_NE
)
)
(
p_filter
->
fmt_out
.
audio
.
i_format
!=
AOUT_FMT_S16_NE
)
&&
(
p_filter
->
fmt_in
.
audio
.
i_bitspersample
!=
p_filter
->
fmt_out
.
audio
.
i_bitspersample
))
{
{
msg_Err
(
p_this
,
"couldn't load mono filter"
);
msg_Err
(
p_this
,
"couldn't load mono filter"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -393,25 +395,28 @@ static int OpenFilter( vlc_object_t *p_this )
...
@@ -393,25 +395,28 @@ static int OpenFilter( vlc_object_t *p_this )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
var_Create
(
p_this
,
MONO_CFG
"
mono-
downmix"
,
var_Create
(
p_this
,
MONO_CFG
"downmix"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
p_sys
->
b_downmix
=
var_GetBool
(
p_this
,
MONO_CFG
"
mono-
downmix"
);
p_sys
->
b_downmix
=
var_GetBool
(
p_this
,
MONO_CFG
"downmix"
);
var_Create
(
p_this
,
MONO_CFG
"
mono-
channel"
,
var_Create
(
p_this
,
MONO_CFG
"channel"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
p_sys
->
i_channel_selected
=
p_sys
->
i_channel_selected
=
(
unsigned
int
)
var_GetInteger
(
p_this
,
MONO_CFG
"
mono-
channel"
);
(
unsigned
int
)
var_GetInteger
(
p_this
,
MONO_CFG
"channel"
);
if
(
p_sys
->
b_downmix
)
if
(
p_sys
->
b_downmix
)
{
{
msg_Dbg
(
p_this
,
"using stereo to mono downmix"
);
p_filter
->
fmt_out
.
audio
.
i_physical_channels
=
AOUT_CHAN_CENTER
;
p_filter
->
fmt_out
.
audio
.
i_physical_channels
=
AOUT_CHAN_CENTER
;
p_filter
->
fmt_out
.
audio
.
i_channels
=
1
;
}
}
else
else
{
{
msg_Dbg
(
p_this
,
"using pseudo mono"
);
p_filter
->
fmt_out
.
audio
.
i_physical_channels
=
p_filter
->
fmt_out
.
audio
.
i_physical_channels
=
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
);
(
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
);
p_filter
->
fmt_out
.
audio
.
i_channels
=
2
;
}
}
p_filter
->
fmt_out
.
audio
.
i_channels
=
aout_FormatNbChannels
(
&
(
p_filter
->
fmt_out
.
audio
)
);
p_filter
->
fmt_out
.
audio
.
i_rate
=
p_filter
->
fmt_in
.
audio
.
i_rate
;
p_filter
->
fmt_out
.
audio
.
i_rate
=
p_filter
->
fmt_in
.
audio
.
i_rate
;
p_filter
->
fmt_out
.
audio
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
p_filter
->
fmt_out
.
audio
.
i_format
=
p_filter
->
fmt_out
.
i_codec
;
...
@@ -453,8 +458,8 @@ static void CloseFilter( vlc_object_t *p_this)
...
@@ -453,8 +458,8 @@ static void CloseFilter( vlc_object_t *p_this)
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
var_Destroy
(
p_this
,
MONO_CFG
"
mono-
channel"
);
var_Destroy
(
p_this
,
MONO_CFG
"channel"
);
var_Destroy
(
p_this
,
MONO_CFG
"
mono-
downmix"
);
var_Destroy
(
p_this
,
MONO_CFG
"downmix"
);
free
(
p_sys
);
free
(
p_sys
);
}
}
...
@@ -516,9 +521,9 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
...
@@ -516,9 +521,9 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
out_buf
.
i_nb_bytes
=
p_out
->
i_buffer
;
out_buf
.
i_nb_bytes
=
p_out
->
i_buffer
;
out_buf
.
i_nb_samples
=
p_out
->
i_samples
;
out_buf
.
i_nb_samples
=
p_out
->
i_samples
;
memset
(
p_out
->
p_buffer
,
0
,
i_out_size
);
if
(
p_filter
->
p_sys
->
b_downmix
)
if
(
p_filter
->
p_sys
->
b_downmix
)
{
{
memset
(
out_buf
.
p_buffer
,
0
,
i_out_size
);
stereo2mono_downmix
(
(
aout_instance_t
*
)
p_filter
,
&
aout_filter
,
stereo2mono_downmix
(
(
aout_instance_t
*
)
p_filter
,
&
aout_filter
,
&
in_buf
,
&
out_buf
);
&
in_buf
,
&
out_buf
);
}
}
...
@@ -575,7 +580,6 @@ static void stereo2mono_downmix( aout_instance_t * p_aout, aout_filter_t * p_fil
...
@@ -575,7 +580,6 @@ static void stereo2mono_downmix( aout_instance_t * p_aout, aout_filter_t * p_fil
p_overflow
=
p_sys
->
p_overflow_buffer
;
p_overflow
=
p_sys
->
p_overflow_buffer
;
i_overflow_size
=
p_sys
->
i_overflow_buffer_size
;
i_overflow_size
=
p_sys
->
i_overflow_buffer_size
;
memset
(
p_out
,
0
,
i_out_size
);
if
(
i_out_size
>
i_overflow_size
)
if
(
i_out_size
>
i_overflow_size
)
memcpy
(
p_out
,
p_overflow
,
i_overflow_size
);
memcpy
(
p_out
,
p_overflow
,
i_overflow_size
);
else
else
...
...
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