Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
2a8f1eb6
Commit
2a8f1eb6
authored
Jul 11, 2011
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua: small cleanup (no functional changes)
parent
5b818e66
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
99 deletions
+103
-99
modules/lua/libs/equalizer.c
modules/lua/libs/equalizer.c
+103
-99
No files found.
modules/lua/libs/equalizer.c
View file @
2a8f1eb6
...
...
@@ -61,53 +61,52 @@
static
int
vlclua_preamp_get
(
lua_State
*
L
)
{
input_thread_t
*
p_input
=
vlclua_get_input_internal
(
L
);
if
(
p_input
)
{
if
(
!
p_input
)
return
0
;
aout_instance_t
*
p_aout
=
input_GetAout
(
p_input
);
vlc_object_release
(
p_input
);
char
*
psz_af
=
var_GetNonEmptyString
(
p_aout
,
"audio-filter"
);
if
(
strstr
(
psz_af
,
"equalizer"
)
==
NULL
)
if
(
strstr
(
psz_af
,
"equalizer"
)
==
NULL
)
{
vlc_object_release
(
p_aout
);
return
0
;
}
float
preamp
=
var_GetFloat
(
p_aout
,
"equalizer-preamp"
);
lua_pushnumber
(
L
,
preamp
);
lua_pushnumber
(
L
,
var_GetFloat
(
p_aout
,
"equalizer-preamp"
)
);
vlc_object_release
(
p_aout
);
return
1
;
}
return
0
;
}
/*****************************************************************************
* Set the preamp level
*****************************************************************************/
static
int
vlclua_preamp_set
(
lua_State
*
L
)
{
input_thread_t
*
p_input
=
vlclua_get_input_internal
(
L
);
if
(
p_input
)
{
if
(
!
p_input
)
return
0
;
aout_instance_t
*
p_aout
=
input_GetAout
(
p_input
);
vlc_object_release
(
p_input
);
if
(
!
p_aout
)
{
if
(
!
p_aout
)
return
0
;
}
char
*
psz_af
=
var_GetNonEmptyString
(
p_aout
,
"audio-filter"
);
if
(
strstr
(
psz_af
,
"equalizer"
)
==
NULL
)
if
(
strstr
(
psz_af
,
"equalizer"
)
==
NULL
)
{
vlc_object_release
(
p_aout
);
return
0
;
}
float
preamp
=
luaL_checknumber
(
L
,
1
);
var_SetFloat
(
p_aout
,
"equalizer-preamp"
,
preamp
);
lua_pushnumber
(
L
,
preamp
);
var_SetFloat
(
p_aout
,
"equalizer-preamp"
,
luaL_checknumber
(
L
,
1
)
);
vlc_object_release
(
p_aout
);
return
1
;
}
return
0
;
}
/*****************************************************************************
Bands:
Band 0: 60 Hz
...
...
@@ -127,17 +126,17 @@ Band 9: 16 kHz
static
int
vlclua_equalizer_get
(
lua_State
*
L
)
{
input_thread_t
*
p_input
=
vlclua_get_input_internal
(
L
);
if
(
p_input
)
{
float
level
=
0
;
if
(
!
p_input
)
return
0
;
aout_instance_t
*
p_aout
=
input_GetAout
(
p_input
);
vlc_object_release
(
p_input
);
if
(
!
p_aout
)
{
if
(
!
p_aout
)
return
0
;
}
float
level
=
0
;
char
*
psz_af
=
var_GetNonEmptyString
(
p_aout
,
"audio-filter"
);
if
(
strstr
(
psz_af
,
"equalizer"
)
==
NULL
)
if
(
strstr
(
psz_af
,
"equalizer"
)
==
NULL
)
{
vlc_object_release
(
p_aout
);
return
0
;
...
...
@@ -157,38 +156,41 @@ static int vlclua_equalizer_get( lua_State *L )
uselocale
(
oldloc
);
freelocale
(
loc
);
}
if
(
bandid
!=
-
1
)
{
vlc_object_release
(
p_aout
);
return
0
;
}
if
(
bandid
==
-
1
)
{
lua_pushnumber
(
L
,
level
);
vlc_object_release
(
p_aout
);
return
1
;
}
else
return
0
;
}
/*****************************************************************************
* Set the equalizer level for the specified band
*****************************************************************************/
static
int
vlclua_equalizer_set
(
lua_State
*
L
)
{
input_thread_t
*
p_input
=
vlclua_get_input_internal
(
L
);
if
(
p_input
)
{
if
(
!
p_input
)
return
0
;
int
i_pos
=
0
,
j
=
0
;
aout_instance_t
*
p_aout
=
input_GetAout
(
p_input
);
vlc_object_release
(
p_input
);
if
(
!
p_aout
)
{
if
(
!
p_aout
)
return
0
;
}
char
*
psz_af
=
var_GetNonEmptyString
(
p_aout
,
"audio-filter"
);
if
(
strstr
(
psz_af
,
"equalizer"
)
==
NULL
)
if
(
strstr
(
psz_af
,
"equalizer"
)
==
NULL
)
{
vlc_object_release
(
p_aout
);
return
0
;
}
int
bandid
=
luaL_checknumber
(
L
,
1
);
float
level
=
luaL_checknumber
(
L
,
2
);
char
*
bands
=
var_GetString
(
p_aout
,
"equalizer-bands"
);
...
...
@@ -207,12 +209,13 @@ static int vlclua_equalizer_set( lua_State *L )
snprintf
(
newstr
,
sizeof
(
newstr
)
,
"%6.1f"
,
level
);
for
(
int
i
=
0
;
i
<
6
;
i
++
)
bands
[
i_pos
+
i
]
=
newstr
[
i
];
var_SetString
(
p_aout
,
"equalizer-bands"
,
bands
);
var_SetString
(
p_aout
,
"equalizer-bands"
,
bands
);
vlc_object_release
(
p_aout
);
return
1
;
}
return
0
;
}
static
const
luaL_Reg
vlclua_equalizer_reg
[]
=
{
{
"preampget"
,
vlclua_preamp_get
},
{
"preampset"
,
vlclua_preamp_set
},
...
...
@@ -221,6 +224,7 @@ static const luaL_Reg vlclua_equalizer_reg[] = {
{
NULL
,
NULL
}
};
void
luaopen_equalizer
(
lua_State
*
L
)
{
lua_newtable
(
L
);
...
...
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