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
2fb0fcd2
Commit
2fb0fcd2
authored
Mar 04, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Marquee: use private lock and fix a tiny race condition
parent
46962c8e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
modules/video_filter/marq.c
modules/video_filter/marq.c
+12
-7
No files found.
modules/video_filter/marq.c
View file @
2fb0fcd2
...
@@ -69,6 +69,8 @@ static const char *const ppsz_color_descriptions[] = {
...
@@ -69,6 +69,8 @@ static const char *const ppsz_color_descriptions[] = {
*****************************************************************************/
*****************************************************************************/
struct
filter_sys_t
struct
filter_sys_t
{
{
vlc_mutex_t
lock
;
int
i_xoff
,
i_yoff
;
/* offsets for the display string in the video window */
int
i_xoff
,
i_yoff
;
/* offsets for the display string in the video window */
int
i_pos
;
/* permit relative positioning (top, bottom, left, right, center) */
int
i_pos
;
/* permit relative positioning (top, bottom, left, right, center) */
int
i_timeout
;
int
i_timeout
;
...
@@ -201,6 +203,7 @@ static int CreateFilter( vlc_object_t *p_this )
...
@@ -201,6 +203,7 @@ static int CreateFilter( vlc_object_t *p_this )
if
(
p_sys
==
NULL
)
if
(
p_sys
==
NULL
)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
vlc_mutex_init
(
&
p_sys
->
lock
);
p_sys
->
p_style
=
malloc
(
sizeof
(
text_style_t
)
);
p_sys
->
p_style
=
malloc
(
sizeof
(
text_style_t
)
);
memcpy
(
p_sys
->
p_style
,
&
default_text_style
,
sizeof
(
text_style_t
)
);
memcpy
(
p_sys
->
p_style
,
&
default_text_style
,
sizeof
(
text_style_t
)
);
...
@@ -255,6 +258,7 @@ static void DestroyFilter( vlc_object_t *p_this )
...
@@ -255,6 +258,7 @@ static void DestroyFilter( vlc_object_t *p_this )
DEL_VAR
(
"marq-opacity"
);
DEL_VAR
(
"marq-opacity"
);
DEL_VAR
(
"marq-size"
);
DEL_VAR
(
"marq-size"
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
free
(
p_sys
);
free
(
p_sys
);
}
}
...
@@ -269,10 +273,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -269,10 +273,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
subpicture_t
*
p_spu
=
NULL
;
subpicture_t
*
p_spu
=
NULL
;
video_format_t
fmt
;
video_format_t
fmt
;
vlc_mutex_lock
(
&
p_sys
->
lock
);
if
(
p_sys
->
last_time
+
p_sys
->
i_refresh
>
date
)
if
(
p_sys
->
last_time
+
p_sys
->
i_refresh
>
date
)
return
NULL
;
goto
out
;
vlc_object_lock
(
p_filter
);
if
(
p_sys
->
b_need_update
==
false
)
if
(
p_sys
->
b_need_update
==
false
)
goto
out
;
goto
out
;
...
@@ -323,7 +326,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -323,7 +326,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu
->
p_region
->
p_style
=
p_sys
->
p_style
;
p_spu
->
p_region
->
p_style
=
p_sys
->
p_style
;
out:
out:
vlc_
object_unlock
(
p_filter
);
vlc_
mutex_unlock
(
&
p_sys
->
lock
);
return
p_spu
;
return
p_spu
;
}
}
...
@@ -334,10 +337,12 @@ static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
...
@@ -334,10 +337,12 @@ static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t
oldval
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
void
*
p_data
)
{
{
VLC_UNUSED
(
oldval
);
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
vlc_object_lock
(
p_this
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
p_this
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
if
(
!
strncmp
(
psz_var
,
"marq-marquee"
,
7
)
)
if
(
!
strncmp
(
psz_var
,
"marq-marquee"
,
7
)
)
{
{
free
(
p_sys
->
psz_marquee
);
free
(
p_sys
->
psz_marquee
);
...
@@ -378,6 +383,6 @@ static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
...
@@ -378,6 +383,6 @@ static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
p_sys
->
i_xoff
=
-
1
;
/* force to relative positioning */
p_sys
->
i_xoff
=
-
1
;
/* force to relative positioning */
}
}
p_sys
->
b_need_update
=
true
;
p_sys
->
b_need_update
=
true
;
vlc_
object_unlock
(
p_this
);
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