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
8bd3fb71
Commit
8bd3fb71
authored
Jun 30, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
colorthres: remove a call to var_GetInteger inside the filter function (use a
callback instead).
parent
4fa2ca55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
11 deletions
+70
-11
modules/video_filter/colorthres.c
modules/video_filter/colorthres.c
+70
-11
No files found.
modules/video_filter/colorthres.c
View file @
8bd3fb71
/*****************************************************************************
* colorthres.c: Theshold color based on similarity to reference color
*****************************************************************************
* Copyright (C) 2000-200
6
the VideoLAN team
* Copyright (C) 2000-200
9
the VideoLAN team
* $Id$
*
* Authors: Sigmund Augdal <dnumgis@videolan.org>
...
...
@@ -83,11 +83,22 @@ static const char *const ppsz_filter_options[] = {
"color"
,
"saturationthes"
,
"similaritythres"
,
NULL
};
/*****************************************************************************
* callback prototypes
*****************************************************************************/
static
int
FilterCallback
(
vlc_object_t
*
,
char
const
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
/*****************************************************************************
* filter_sys_t: adjust filter method descriptor
*****************************************************************************/
struct
filter_sys_t
{
int
i_simthres
;
int
i_satthres
;
int
i_color
;
vlc_mutex_t
lock
;
};
/*****************************************************************************
...
...
@@ -98,6 +109,7 @@ struct filter_sys_t
static
int
Create
(
vlc_object_t
*
p_this
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
;
switch
(
p_filter
->
fmt_in
.
video
.
i_chroma
)
{
...
...
@@ -116,17 +128,25 @@ static int Create( vlc_object_t *p_this )
return
VLC_EGENERIC
;
}
config_ChainParse
(
p_filter
,
CFG_PREFIX
,
ppsz_filter_options
,
p_filter
->
p_cfg
);
var_Create
(
p_filter
,
CFG_PREFIX
"color"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
|
VLC_VAR_ISCOMMAND
);
var_Create
(
p_filter
,
CFG_PREFIX
"similaritythres"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
|
VLC_VAR_ISCOMMAND
);
var_Create
(
p_filter
,
CFG_PREFIX
"saturationthres"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
|
VLC_VAR_ISCOMMAND
);
/* Allocate structure */
p_filter
->
p_sys
=
malloc
(
sizeof
(
filter_sys_t
)
);
p_
sys
=
p_
filter
->
p_sys
=
malloc
(
sizeof
(
filter_sys_t
)
);
if
(
p_filter
->
p_sys
==
NULL
)
return
VLC_ENOMEM
;
config_ChainParse
(
p_filter
,
CFG_PREFIX
,
ppsz_filter_options
,
p_filter
->
p_cfg
);
p_sys
->
i_color
=
var_CreateGetIntegerCommand
(
p_filter
,
CFG_PREFIX
"color"
);
p_sys
->
i_simthres
=
var_CreateGetIntegerCommand
(
p_filter
,
CFG_PREFIX
"similaritythres"
);
p_sys
->
i_satthres
=
var_CreateGetIntegerCommand
(
p_filter
,
CFG_PREFIX
"saturationthres"
);
vlc_mutex_init
(
&
p_sys
->
lock
);
var_AddCallback
(
p_filter
,
CFG_PREFIX
"color"
,
FilterCallback
,
NULL
);
var_AddCallback
(
p_filter
,
CFG_PREFIX
"similaritythres"
,
FilterCallback
,
NULL
);
var_AddCallback
(
p_filter
,
CFG_PREFIX
"saturationthres"
,
FilterCallback
,
NULL
);
p_filter
->
pf_video_filter
=
Filter
;
return
VLC_SUCCESS
;
...
...
@@ -140,6 +160,12 @@ static int Create( vlc_object_t *p_this )
static
void
Destroy
(
vlc_object_t
*
p_this
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
var_DelCallback
(
p_filter
,
CFG_PREFIX
"color"
,
FilterCallback
,
NULL
);
var_DelCallback
(
p_filter
,
CFG_PREFIX
"similaritythres"
,
FilterCallback
,
NULL
);
var_DelCallback
(
p_filter
,
CFG_PREFIX
"saturationthres"
,
FilterCallback
,
NULL
);
vlc_mutex_destroy
(
&
p_filter
->
p_sys
->
lock
);
free
(
p_filter
->
p_sys
);
}
...
...
@@ -153,11 +179,15 @@ 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
;
uint8_t
*
p_in_y
,
*
p_in_u
,
*
p_in_v
,
*
p_in_end_u
;
uint8_t
*
p_out_y
,
*
p_out_u
,
*
p_out_v
;
int
i_simthres
=
var_GetInteger
(
p_filter
,
"colorthres-similaritythres"
);
int
i_satthres
=
var_GetInteger
(
p_filter
,
"colorthres-saturationthres"
);
int
i_color
=
var_GetInteger
(
p_filter
,
"colorthres-color"
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
int
i_simthres
=
p_sys
->
i_simthres
;
int
i_satthres
=
p_sys
->
i_satthres
;
int
i_color
=
p_sys
->
i_color
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
if
(
!
p_pic
)
return
NULL
;
...
...
@@ -225,3 +255,32 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return
CopyInfoAndRelease
(
p_outpic
,
p_pic
);
}
static
int
FilterCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
(
void
)
oldval
;
(
void
)
p_data
;
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
if
(
!
strcmp
(
psz_var
,
CFG_PREFIX
"color"
)
)
{
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
i_color
=
newval
.
i_int
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
}
else
if
(
!
strcmp
(
psz_var
,
CFG_PREFIX
"similaritythres"
)
)
{
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
i_simthres
=
newval
.
i_int
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
}
else
/* CFG_PREFIX "saturationthres" */
{
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
i_satthres
=
newval
.
i_int
;
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