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
8c1c227d
Commit
8c1c227d
authored
May 19, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crop: thread-safety for FilterCallback
parent
d6938fb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
modules/video_filter/crop.c
modules/video_filter/crop.c
+11
-2
No files found.
modules/video_filter/crop.c
View file @
8c1c227d
...
@@ -145,6 +145,7 @@ vlc_module_end ()
...
@@ -145,6 +145,7 @@ vlc_module_end ()
*****************************************************************************/
*****************************************************************************/
struct
vout_sys_t
struct
vout_sys_t
{
{
vlc_mutex_t
lock
;
vout_thread_t
*
p_vout
;
vout_thread_t
*
p_vout
;
unsigned
int
i_x
,
i_y
;
unsigned
int
i_x
,
i_y
;
...
@@ -376,6 +377,7 @@ static int Init( vout_thread_t *p_vout )
...
@@ -376,6 +377,7 @@ static int Init( vout_thread_t *p_vout )
}
}
#ifdef BEST_AUTOCROP
#ifdef BEST_AUTOCROP
vlc_mutex_init
(
&
p_vout
->
p_sys
->
lock
);
var_AddCallback
(
p_vout
,
"ratio-crop"
,
FilterCallback
,
NULL
);
var_AddCallback
(
p_vout
,
"ratio-crop"
,
FilterCallback
,
NULL
);
#endif
#endif
...
@@ -400,6 +402,8 @@ static void End( vout_thread_t *p_vout )
...
@@ -400,6 +402,8 @@ static void End( vout_thread_t *p_vout )
}
}
vout_filter_ReleaseDirectBuffers
(
p_vout
);
vout_filter_ReleaseDirectBuffers
(
p_vout
);
var_DelCallback
(
p_vout
,
"ratio-crop"
,
FilterCallback
,
NULL
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -432,6 +436,7 @@ static int Manage( vout_thread_t *p_vout )
...
@@ -432,6 +436,7 @@ static int Manage( vout_thread_t *p_vout )
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
#ifdef BEST_AUTOCROP
#ifdef BEST_AUTOCROP
/* XXX: not thread-safe with FilterCallback */
msg_Dbg
(
p_vout
,
"cropping at %ix%i+%i+%i, %sautocropping"
,
msg_Dbg
(
p_vout
,
"cropping at %ix%i+%i+%i, %sautocropping"
,
p_vout
->
p_sys
->
i_width
,
p_vout
->
p_sys
->
i_height
,
p_vout
->
p_sys
->
i_width
,
p_vout
->
p_sys
->
i_height
,
p_vout
->
p_sys
->
i_x
,
p_vout
->
p_sys
->
i_y
,
p_vout
->
p_sys
->
i_x
,
p_vout
->
p_sys
->
i_y
,
...
@@ -465,7 +470,9 @@ static int Manage( vout_thread_t *p_vout )
...
@@ -465,7 +470,9 @@ static int Manage( vout_thread_t *p_vout )
vout_filter_AddChild
(
p_vout
,
p_vout
->
p_sys
->
p_vout
,
MouseEvent
);
vout_filter_AddChild
(
p_vout
,
p_vout
->
p_sys
->
p_vout
,
MouseEvent
);
p_vout
->
p_sys
->
b_changed
=
false
;
p_vout
->
p_sys
->
b_changed
=
false
;
vlc_mutex_lock
(
&
p_vout
->
p_sys
->
lock
);
p_vout
->
p_sys
->
i_lastchange
=
0
;
p_vout
->
p_sys
->
i_lastchange
=
0
;
vlc_mutex_unlock
(
&
p_vout
->
p_sys
->
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -532,10 +539,10 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -532,10 +539,10 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
vout_DisplayPicture
(
p_vout
->
p_sys
->
p_vout
,
p_outpic
);
vout_DisplayPicture
(
p_vout
->
p_sys
->
p_vout
,
p_outpic
);
/* The source image may still be in the cache ... parse it! */
/* The source image may still be in the cache ... parse it! */
vlc_mutex_lock
(
&
p_vout
->
p_sys
->
lock
);
if
(
p_vout
->
p_sys
->
b_autocrop
)
if
(
p_vout
->
p_sys
->
b_autocrop
)
{
UpdateStats
(
p_vout
,
p_pic
);
UpdateStats
(
p_vout
,
p_pic
);
}
vlc_mutex_unlock
(
&
p_vout
->
p_sys
->
lock
);
}
}
#ifdef BEST_AUTOCROP
#ifdef BEST_AUTOCROP
...
@@ -848,6 +855,7 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_var,
...
@@ -848,6 +855,7 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_var,
if
(
!
strcmp
(
psz_var
,
"ratio-crop"
)
)
if
(
!
strcmp
(
psz_var
,
"ratio-crop"
)
)
{
{
vlc_mutex_lock
(
&
p_vout
->
p_sys
->
lock
);
if
(
!
strcmp
(
newval
.
psz_string
,
"Auto"
)
)
if
(
!
strcmp
(
newval
.
psz_string
,
"Auto"
)
)
p_vout
->
p_sys
->
i_ratio
=
0
;
p_vout
->
p_sys
->
i_ratio
=
0
;
else
else
...
@@ -865,6 +873,7 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_var,
...
@@ -865,6 +873,7 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_var,
if
(
p_vout
->
p_sys
->
i_ratio
<
p_vout
->
output
.
i_aspect
/
432
)
if
(
p_vout
->
p_sys
->
i_ratio
<
p_vout
->
output
.
i_aspect
/
432
)
p_vout
->
p_sys
->
i_ratio
=
p_vout
->
output
.
i_aspect
/
432
;
p_vout
->
p_sys
->
i_ratio
=
p_vout
->
output
.
i_aspect
/
432
;
}
}
vlc_mutex_unlock
(
&
p_vout
->
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