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
f2092cbf
Commit
f2092cbf
authored
Mar 20, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audiobargraph: use variable & callback for alarm state (refs #9491)
parent
2a5d95e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
modules/audio_filter/audiobargraph_a.c
modules/audio_filter/audiobargraph_a.c
+6
-11
modules/video_filter/audiobargraph_v.c
modules/video_filter/audiobargraph_v.c
+16
-11
No files found.
modules/audio_filter/audiobargraph_a.c
View file @
f2092cbf
...
@@ -158,6 +158,8 @@ static int Open( vlc_object_t *p_this )
...
@@ -158,6 +158,8 @@ static int Open( vlc_object_t *p_this )
p_filter
->
fmt_out
.
audio
=
p_filter
->
fmt_in
.
audio
;
p_filter
->
fmt_out
.
audio
=
p_filter
->
fmt_in
.
audio
;
p_filter
->
pf_audio_filter
=
DoWork
;
p_filter
->
pf_audio_filter
=
DoWork
;
var_Create
(
p_filter
->
p_libvlc
,
"audiobargraph_v-alarm"
,
VLC_VAR_BOOL
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -235,17 +237,8 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
...
@@ -235,17 +237,8 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
sum
=
sqrtf
(
sum
);
sum
=
sqrtf
(
sum
);
/* 5 - compare it to the threshold */
/* 5 - compare it to the threshold */
if
(
sum
<
p_sys
->
alarm_threshold
)
{
var_SetBool
(
p_filter
->
p_libvlc
,
"audiobargraph_v-alarm"
,
i
=
1
;
sum
<
p_sys
->
alarm_threshold
);
}
else
{
i
=
0
;
}
snprintf
(
message
,
255
,
"@audiobargraph_v audiobargraph_v-alarm %d
\n
"
,
i
);
msg_Dbg
(
p_filter
,
"message alarm : %s"
,
message
);
//TCPconnection = net_ConnectTCP(p_filter,p_sys->address,p_sys->port);
net_Write
(
p_filter
,
p_sys
->
TCPconnection
,
NULL
,
message
,
strlen
(
message
));
//net_Close(TCPconnection);
p_sys
->
lastAlarm
=
p_in_buf
->
i_pts
;
p_sys
->
lastAlarm
=
p_in_buf
->
i_pts
;
}
}
...
@@ -300,6 +293,8 @@ static void Close( vlc_object_t *p_this )
...
@@ -300,6 +293,8 @@ static void Close( vlc_object_t *p_this )
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
ValueDate_t
*
current
;
ValueDate_t
*
current
;
var_Destroy
(
p_filter
->
p_libvlc
,
"audiobargraph_v-alarm"
);
p_sys
->
last
=
NULL
;
p_sys
->
last
=
NULL
;
while
(
p_sys
->
first
!=
NULL
)
{
while
(
p_sys
->
first
!=
NULL
)
{
current
=
p_sys
->
first
;
current
=
p_sys
->
first
;
...
...
modules/video_filter/audiobargraph_v.c
View file @
f2092cbf
...
@@ -60,9 +60,6 @@
...
@@ -60,9 +60,6 @@
"Enforce the bargraph position on the video " \
"Enforce the bargraph position on the video " \
"(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"also use combinations of these values, eg 6 = top-right).")
"also use combinations of these values, eg 6 = top-right).")
#define ALARM_TEXT N_("Alarm")
#define ALARM_LONGTEXT N_("Signals a silence and displays and alert " \
"(0=no alarm, 1=alarm).")
#define BARWIDTH_TEXT N_("Bar width in pixel (default : 10)")
#define BARWIDTH_TEXT N_("Bar width in pixel (default : 10)")
#define BARWIDTH_LONGTEXT N_("Width in pixel of each bar in the BarGraph to be displayed " \
#define BARWIDTH_LONGTEXT N_("Width in pixel of each bar in the BarGraph to be displayed " \
"(default : 10).")
"(default : 10).")
...
@@ -96,7 +93,7 @@ vlc_module_begin ()
...
@@ -96,7 +93,7 @@ vlc_module_begin ()
TRANS_TEXT
,
TRANS_LONGTEXT
,
false
)
TRANS_TEXT
,
TRANS_LONGTEXT
,
false
)
add_integer
(
CFG_PREFIX
"position"
,
-
1
,
POS_TEXT
,
POS_LONGTEXT
,
false
)
add_integer
(
CFG_PREFIX
"position"
,
-
1
,
POS_TEXT
,
POS_LONGTEXT
,
false
)
change_integer_list
(
pi_pos_values
,
ppsz_pos_descriptions
)
change_integer_list
(
pi_pos_values
,
ppsz_pos_descriptions
)
add_
integer
(
CFG_PREFIX
"alarm"
,
0
,
ALARM_TEXT
,
ALARM_LONGTEXT
,
true
)
add_
obsolete_integer
(
CFG_PREFIX
"alarm"
)
add_integer
(
CFG_PREFIX
"barWidth"
,
10
,
BARWIDTH_TEXT
,
BARWIDTH_LONGTEXT
,
true
)
add_integer
(
CFG_PREFIX
"barWidth"
,
10
,
BARWIDTH_TEXT
,
BARWIDTH_LONGTEXT
,
true
)
/* video output filter submodule */
/* video output filter submodule */
...
@@ -123,7 +120,7 @@ typedef struct
...
@@ -123,7 +120,7 @@ typedef struct
picture_t
*
p_pic
;
picture_t
*
p_pic
;
mtime_t
date
;
mtime_t
date
;
int
scale
;
int
scale
;
int
alarm
;
bool
alarm
;
int
barWidth
;
int
barWidth
;
}
BarGraph_t
;
}
BarGraph_t
;
...
@@ -149,7 +146,7 @@ struct filter_sys_t
...
@@ -149,7 +146,7 @@ struct filter_sys_t
};
};
static
const
char
*
const
ppsz_filter_options
[]
=
{
static
const
char
*
const
ppsz_filter_options
[]
=
{
"i_values"
,
"x"
,
"y"
,
"transparency"
,
"position"
,
"
alarm"
,
"
barWidth"
,
NULL
"i_values"
,
"x"
,
"y"
,
"transparency"
,
"position"
,
"barWidth"
,
NULL
};
};
static
const
char
*
const
ppsz_filter_callbacks
[]
=
{
static
const
char
*
const
ppsz_filter_callbacks
[]
=
{
...
@@ -158,7 +155,6 @@ static const char *const ppsz_filter_callbacks[] = {
...
@@ -158,7 +155,6 @@ static const char *const ppsz_filter_callbacks[] = {
"audiobargraph_v-y"
,
"audiobargraph_v-y"
,
"audiobargraph_v-transparency"
,
"audiobargraph_v-transparency"
,
"audiobargraph_v-position"
,
"audiobargraph_v-position"
,
"audiobargraph_v-alarm"
,
"audiobargraph_v-barWidth"
,
"audiobargraph_v-barWidth"
,
NULL
NULL
};
};
...
@@ -246,7 +242,8 @@ static int OpenCommon( vlc_object_t *p_this, bool b_sub )
...
@@ -246,7 +242,8 @@ static int OpenCommon( vlc_object_t *p_this, bool b_sub )
//p_BarGraph->nbChannels = 0;
//p_BarGraph->nbChannels = 0;
//p_BarGraph->i_values = NULL;
//p_BarGraph->i_values = NULL;
parse_i_values
(
p_BarGraph
,
i_values
);
parse_i_values
(
p_BarGraph
,
i_values
);
p_BarGraph
->
alarm
=
var_CreateGetIntegerCommand
(
p_filter
,
"audiobargraph_v-alarm"
);
p_BarGraph
->
alarm
=
false
;
p_BarGraph
->
barWidth
=
var_CreateGetIntegerCommand
(
p_filter
,
"audiobargraph_v-barWidth"
);
p_BarGraph
->
barWidth
=
var_CreateGetIntegerCommand
(
p_filter
,
"audiobargraph_v-barWidth"
);
p_BarGraph
->
scale
=
400
;
p_BarGraph
->
scale
=
400
;
...
@@ -255,8 +252,12 @@ static int OpenCommon( vlc_object_t *p_this, bool b_sub )
...
@@ -255,8 +252,12 @@ static int OpenCommon( vlc_object_t *p_this, bool b_sub )
p_sys
->
i_pos
=
0
;
p_sys
->
i_pos
=
0
;
vlc_mutex_init
(
&
p_sys
->
lock
);
vlc_mutex_init
(
&
p_sys
->
lock
);
LoadBarGraph
(
p_this
,
p_BarGraph
);
p_sys
->
b_spu_update
=
true
;
var_Create
(
p_filter
->
p_libvlc
,
"audiobargraph_v-alarm"
,
VLC_VAR_BOOL
);
var_AddCallback
(
p_filter
->
p_libvlc
,
"audiobargraph_v-alarm"
,
BarGraphCallback
,
p_sys
);
var_TriggerCallback
(
p_filter
->
p_libvlc
,
"audiobargraph_v-alarm"
);
for
(
int
i
=
0
;
ppsz_filter_callbacks
[
i
];
i
++
)
for
(
int
i
=
0
;
ppsz_filter_callbacks
[
i
];
i
++
)
var_AddCallback
(
p_filter
,
ppsz_filter_callbacks
[
i
],
var_AddCallback
(
p_filter
,
ppsz_filter_callbacks
[
i
],
...
@@ -289,6 +290,10 @@ static void Close( vlc_object_t *p_this )
...
@@ -289,6 +290,10 @@ static void Close( vlc_object_t *p_this )
var_DelCallback
(
p_filter
,
ppsz_filter_callbacks
[
i
],
var_DelCallback
(
p_filter
,
ppsz_filter_callbacks
[
i
],
BarGraphCallback
,
p_sys
);
BarGraphCallback
,
p_sys
);
var_DelCallback
(
p_filter
->
p_libvlc
,
"audiobargraph_v-alarm"
,
BarGraphCallback
,
p_sys
);
var_Destroy
(
p_filter
->
p_libvlc
,
"audiobargraph_v-alarm"
);
if
(
p_sys
->
p_blend
)
if
(
p_sys
->
p_blend
)
filter_DeleteBlend
(
p_sys
->
p_blend
);
filter_DeleteBlend
(
p_sys
->
p_blend
);
...
@@ -509,7 +514,7 @@ static int BarGraphCallback( vlc_object_t *p_this, char const *psz_var,
...
@@ -509,7 +514,7 @@ static int BarGraphCallback( vlc_object_t *p_this, char const *psz_var,
picture_Release
(
p_BarGraph
->
p_pic
);
picture_Release
(
p_BarGraph
->
p_pic
);
p_BarGraph
->
p_pic
=
NULL
;
p_BarGraph
->
p_pic
=
NULL
;
}
}
p_BarGraph
->
alarm
=
newval
.
i_int
;
p_BarGraph
->
alarm
=
newval
.
b_bool
;
LoadBarGraph
(
p_this
,
p_BarGraph
);
LoadBarGraph
(
p_this
,
p_BarGraph
);
}
}
else
if
(
!
strcmp
(
psz_var
,
"audiobargraph_v-barWidth"
)
)
else
if
(
!
strcmp
(
psz_var
,
"audiobargraph_v-barWidth"
)
)
...
...
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