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
7df37bef
Commit
7df37bef
authored
May 19, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract: thread-safety
parent
57eefa00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
modules/video_filter/extract.c
modules/video_filter/extract.c
+21
-10
No files found.
modules/video_filter/extract.c
View file @
7df37bef
...
...
@@ -93,8 +93,9 @@ static const char *const ppsz_filter_options[] = {
enum
{
RED
=
0xFF0000
,
GREEN
=
0x00FF00
,
BLUE
=
0x0000FF
};
struct
filter_sys_t
{
int
i_color
;
vlc_mutex_t
lock
;
int
*
projection_matrix
;
uint32_t
i_color
;
};
/*****************************************************************************
...
...
@@ -140,12 +141,12 @@ static int Create( vlc_object_t *p_this )
p_filter
->
p_sys
->
i_color
=
var_CreateGetIntegerCommand
(
p_filter
,
FILTER_PREFIX
"component"
);
var_AddCallback
(
p_filter
,
FILTER_PREFIX
"component"
,
ExtractCallback
,
p_filter
->
p_sys
);
/* Matrix won't be used for RED, GREEN or BLUE in planar formats */
make_projection_matrix
(
p_filter
,
p_filter
->
p_sys
->
i_color
,
p_filter
->
p_sys
->
projection_matrix
);
vlc_mutex_init
(
&
p_filter
->
p_sys
->
lock
);
var_AddCallback
(
p_filter
,
FILTER_PREFIX
"component"
,
ExtractCallback
,
p_filter
->
p_sys
);
p_filter
->
pf_video_filter
=
Filter
;
...
...
@@ -158,9 +159,13 @@ static int Create( vlc_object_t *p_this )
static
void
Destroy
(
vlc_object_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
->
projection_matrix
);
free
(
p_filter
->
p_sys
);
var_DelCallback
(
p_filter
,
FILTER_PREFIX
"component"
,
ExtractCallback
,
p_sys
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
free
(
p_sys
->
projection_matrix
);
free
(
p_sys
);
}
/*****************************************************************************
...
...
@@ -169,6 +174,7 @@ static void Destroy( vlc_object_t *p_this )
static
picture_t
*
Filter
(
filter_t
*
p_filter
,
picture_t
*
p_pic
)
{
picture_t
*
p_outpic
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
if
(
!
p_pic
)
return
NULL
;
...
...
@@ -179,13 +185,14 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return
NULL
;
}
vlc_mutex_lock
(
&
p_sys
->
lock
);
switch
(
p_pic
->
format
.
i_chroma
)
{
case
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
):
case
VLC_FOURCC
(
'I'
,
'Y'
,
'U'
,
'V'
):
case
VLC_FOURCC
(
'J'
,
'4'
,
'2'
,
'0'
):
case
VLC_FOURCC
(
'Y'
,
'V'
,
'1'
,
'2'
):
switch
(
p_
filter
->
p_
sys
->
i_color
)
switch
(
p_sys
->
i_color
)
{
case
RED
:
get_red_from_yuv420
(
p_pic
,
p_outpic
,
...
...
@@ -202,7 +209,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
default:
get_custom_from_yuv420
(
p_pic
,
p_outpic
,
Y_PLANE
,
U_PLANE
,
V_PLANE
,
p_
filter
->
p_
sys
->
projection_matrix
);
p_sys
->
projection_matrix
);
break
;
}
break
;
...
...
@@ -226,22 +233,24 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
default:
get_custom_from_yuv422
(
p_pic
,
p_outpic
,
Y_PLANE
,
U_PLANE
,
V_PLANE
,
p_
filter
->
p_
sys
->
projection_matrix
);
p_sys
->
projection_matrix
);
break
;
}
break
;
CASE_PACKED_YUV_422
get_custom_from_packedyuv422
(
p_pic
,
p_outpic
,
p_
filter
->
p_
sys
->
projection_matrix
);
p_sys
->
projection_matrix
);
break
;
default:
vlc_mutex_unlock
(
&
p_sys
->
lock
);
msg_Warn
(
p_filter
,
"Unsupported input chroma (%4s)"
,
(
char
*
)
&
(
p_pic
->
format
.
i_chroma
)
);
picture_Release
(
p_pic
);
return
NULL
;
}
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
CopyInfoAndRelease
(
p_outpic
,
p_pic
);
}
...
...
@@ -760,6 +769,7 @@ static int ExtractCallback( vlc_object_t *p_this, char const *psz_var,
VLC_UNUSED
(
oldval
);
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
vlc_mutex_lock
(
&
p_sys
->
lock
);
if
(
!
strcmp
(
psz_var
,
FILTER_PREFIX
"component"
)
)
{
p_sys
->
i_color
=
newval
.
i_int
;
...
...
@@ -771,5 +781,6 @@ static int ExtractCallback( vlc_object_t *p_this, char const *psz_var,
{
msg_Warn
(
p_this
,
"Unknown callback command."
);
}
vlc_mutex_unlock
(
&
p_sys
->
lock
);
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