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
59712f39
Commit
59712f39
authored
May 19, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gradient: callback thread-safety
parent
7df37bef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
modules/video_filter/gradient.c
modules/video_filter/gradient.c
+24
-7
No files found.
modules/video_filter/gradient.c
View file @
59712f39
...
@@ -108,6 +108,7 @@ static const char *const ppsz_filter_options[] = {
...
@@ -108,6 +108,7 @@ static const char *const ppsz_filter_options[] = {
*****************************************************************************/
*****************************************************************************/
struct
filter_sys_t
struct
filter_sys_t
{
{
vlc_mutex_t
lock
;
int
i_mode
;
int
i_mode
;
/* For the gradient mode */
/* For the gradient mode */
...
@@ -189,6 +190,7 @@ static int Create( vlc_object_t *p_this )
...
@@ -189,6 +190,7 @@ static int Create( vlc_object_t *p_this )
p_filter
->
p_sys
->
b_cartoon
=
p_filter
->
p_sys
->
b_cartoon
=
var_CreateGetBoolCommand
(
p_filter
,
FILTER_PREFIX
"cartoon"
);
var_CreateGetBoolCommand
(
p_filter
,
FILTER_PREFIX
"cartoon"
);
vlc_mutex_init
(
&
p_filter
->
p_sys
->
lock
);
var_AddCallback
(
p_filter
,
FILTER_PREFIX
"mode"
,
var_AddCallback
(
p_filter
,
FILTER_PREFIX
"mode"
,
GradientCallback
,
p_filter
->
p_sys
);
GradientCallback
,
p_filter
->
p_sys
);
var_AddCallback
(
p_filter
,
FILTER_PREFIX
"type"
,
var_AddCallback
(
p_filter
,
FILTER_PREFIX
"type"
,
...
@@ -211,13 +213,22 @@ static int Create( vlc_object_t *p_this )
...
@@ -211,13 +213,22 @@ static int Create( vlc_object_t *p_this )
static
void
Destroy
(
vlc_object_t
*
p_this
)
static
void
Destroy
(
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
;
free
(
p_filter
->
p_sys
->
p_buf32
);
free
(
p_filter
->
p_sys
->
p_buf32_bis
);
var_DelCallback
(
p_filter
,
FILTER_PREFIX
"mode"
,
free
(
p_filter
->
p_sys
->
p_buf8
);
GradientCallback
,
p_sys
);
free
(
p_filter
->
p_sys
->
p_pre_hough
);
var_DelCallback
(
p_filter
,
FILTER_PREFIX
"type"
,
GradientCallback
,
p_sys
);
free
(
p_filter
->
p_sys
);
var_DelCallback
(
p_filter
,
FILTER_PREFIX
"cartoon"
,
GradientCallback
,
p_sys
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
free
(
p_sys
->
p_buf32
);
free
(
p_sys
->
p_buf32_bis
);
free
(
p_sys
->
p_buf8
);
free
(
p_sys
->
p_pre_hough
);
free
(
p_sys
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -240,6 +251,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -240,6 +251,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return
NULL
;
return
NULL
;
}
}
vlc_mutex_lock
(
&
p_filter
->
p_sys
->
lock
);
switch
(
p_filter
->
p_sys
->
i_mode
)
switch
(
p_filter
->
p_sys
->
i_mode
)
{
{
case
EDGE
:
case
EDGE
:
...
@@ -257,6 +269,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -257,6 +269,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
default:
default:
break
;
break
;
}
}
vlc_mutex_unlock
(
&
p_filter
->
p_sys
->
lock
);
return
CopyInfoAndRelease
(
p_outpic
,
p_pic
);
return
CopyInfoAndRelease
(
p_outpic
,
p_pic
);
}
}
...
@@ -757,6 +770,8 @@ static int GradientCallback( vlc_object_t *p_this, char const *psz_var,
...
@@ -757,6 +770,8 @@ static int GradientCallback( vlc_object_t *p_this, char const *psz_var,
{
{
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
oldval
);
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
vlc_mutex_lock
(
&
p_sys
->
lock
);
if
(
!
strcmp
(
psz_var
,
FILTER_PREFIX
"mode"
)
)
if
(
!
strcmp
(
psz_var
,
FILTER_PREFIX
"mode"
)
)
{
{
if
(
!
strcmp
(
newval
.
psz_string
,
"gradient"
)
)
if
(
!
strcmp
(
newval
.
psz_string
,
"gradient"
)
)
...
@@ -785,5 +800,7 @@ static int GradientCallback( vlc_object_t *p_this, char const *psz_var,
...
@@ -785,5 +800,7 @@ static int GradientCallback( vlc_object_t *p_this, char const *psz_var,
{
{
p_sys
->
b_cartoon
=
newval
.
b_bool
;
p_sys
->
b_cartoon
=
newval
.
b_bool
;
}
}
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
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