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
ac075dbf
Commit
ac075dbf
authored
Jul 28, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spu: use filter_chain_ForEach() and simplify
parent
0a592271
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
33 deletions
+17
-33
src/video_output/vout_subpictures.c
src/video_output/vout_subpictures.c
+17
-33
No files found.
src/video_output/vout_subpictures.c
View file @
ac075dbf
...
@@ -156,11 +156,6 @@ static void SpuHeapClean(spu_heap_t *heap)
...
@@ -156,11 +156,6 @@ static void SpuHeapClean(spu_heap_t *heap)
}
}
}
}
struct
filter_owner_sys_t
{
spu_t
*
spu
;
int
channel
;
};
static
void
FilterRelease
(
filter_t
*
filter
)
static
void
FilterRelease
(
filter_t
*
filter
)
{
{
if
(
filter
->
p_module
)
if
(
filter
->
p_module
)
...
@@ -1159,11 +1154,11 @@ static int CropCallback(vlc_object_t *object, char const *var,
...
@@ -1159,11 +1154,11 @@ static int CropCallback(vlc_object_t *object, char const *var,
static
subpicture_t
*
sub_new_buffer
(
filter_t
*
filter
)
static
subpicture_t
*
sub_new_buffer
(
filter_t
*
filter
)
{
{
filter_owner_sys_t
*
sys
=
filter
->
owner
.
sys
;
int
channel
=
(
intptr_t
)
filter
->
owner
.
sys
;
subpicture_t
*
subpicture
=
subpicture_New
(
NULL
);
subpicture_t
*
subpicture
=
subpicture_New
(
NULL
);
if
(
subpicture
)
if
(
subpicture
)
subpicture
->
i_channel
=
sys
->
channel
;
subpicture
->
i_channel
=
channel
;
return
subpicture
;
return
subpicture
;
}
}
...
@@ -1173,30 +1168,24 @@ static void sub_del_buffer(filter_t *filter, subpicture_t *subpic)
...
@@ -1173,30 +1168,24 @@ static void sub_del_buffer(filter_t *filter, subpicture_t *subpic)
subpicture_Delete
(
subpic
);
subpicture_Delete
(
subpic
);
}
}
static
int
SubSource
Allocation
Init
(
filter_t
*
filter
,
void
*
data
)
static
int
SubSourceInit
(
filter_t
*
filter
,
void
*
data
)
{
{
spu_t
*
spu
=
data
;
spu_t
*
spu
=
data
;
int
channel
=
spu_RegisterChannel
(
spu
);
filter_owner_sys_t
*
sys
=
malloc
(
sizeof
(
*
sys
));
filter
->
owner
.
sys
=
(
void
*
)(
intptr_t
)
channel
;
if
(
!
sys
)
return
VLC_EGENERIC
;
filter
->
owner
.
sub
.
buffer_new
=
sub_new_buffer
;
filter
->
owner
.
sub
.
buffer_new
=
sub_new_buffer
;
filter
->
owner
.
sub
.
buffer_del
=
sub_del_buffer
;
filter
->
owner
.
sub
.
buffer_del
=
sub_del_buffer
;
filter
->
owner
.
sys
=
sys
;
sys
->
channel
=
spu_RegisterChannel
(
spu
);
sys
->
spu
=
spu
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
void
SubSourceAllocationClean
(
filter_t
*
filter
)
static
int
SubSourceClean
(
filter_t
*
filter
,
void
*
data
)
{
{
filter_owner_sys_t
*
sys
=
filter
->
owner
.
sys
;
spu_t
*
spu
=
data
;
int
channel
=
(
intptr_t
)
filter
->
owner
.
sys
;
spu_ClearChannel
(
s
ys
->
spu
,
sys
->
channel
);
spu_ClearChannel
(
s
pu
,
channel
);
free
(
sys
)
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -1239,13 +1228,9 @@ spu_t *spu_Create(vlc_object_t *object)
...
@@ -1239,13 +1228,9 @@ spu_t *spu_Create(vlc_object_t *object)
vlc_mutex_init
(
&
sys
->
source_chain_lock
);
vlc_mutex_init
(
&
sys
->
source_chain_lock
);
vlc_mutex_init
(
&
sys
->
filter_chain_lock
);
vlc_mutex_init
(
&
sys
->
filter_chain_lock
);
sys
->
source_chain
=
filter_chain_New
(
spu
,
"sub source"
,
false
,
sys
->
source_chain
=
filter_chain_New
(
spu
,
"sub source"
,
false
,
SubSourceAllocationInit
,
NULL
,
NULL
,
NULL
);
SubSourceAllocationClean
,
spu
);
sys
->
filter_chain
=
filter_chain_New
(
spu
,
"sub filter"
,
false
,
sys
->
filter_chain
=
filter_chain_New
(
spu
,
"sub filter"
,
false
,
NULL
,
NULL
,
NULL
,
NULL
);
NULL
,
spu
);
/* Load text and scale module */
/* Load text and scale module */
sys
->
text
=
SpuRenderCreateAndLoadText
(
spu
);
sys
->
text
=
SpuRenderCreateAndLoadText
(
spu
);
...
@@ -1284,6 +1269,7 @@ void spu_Destroy(spu_t *spu)
...
@@ -1284,6 +1269,7 @@ void spu_Destroy(spu_t *spu)
if
(
sys
->
scale
)
if
(
sys
->
scale
)
FilterRelease
(
sys
->
scale
);
FilterRelease
(
sys
->
scale
);
filter_chain_ForEach
(
sys
->
source_chain
,
SubSourceClean
,
spu
);
filter_chain_Delete
(
sys
->
source_chain
);
filter_chain_Delete
(
sys
->
source_chain
);
filter_chain_Delete
(
sys
->
filter_chain
);
filter_chain_Delete
(
sys
->
filter_chain
);
vlc_mutex_destroy
(
&
sys
->
source_chain_lock
);
vlc_mutex_destroy
(
&
sys
->
source_chain_lock
);
...
@@ -1446,13 +1432,11 @@ subpicture_t *spu_Render(spu_t *spu,
...
@@ -1446,13 +1432,11 @@ subpicture_t *spu_Render(spu_t *spu,
vlc_mutex_lock
(
&
sys
->
source_chain_lock
);
vlc_mutex_lock
(
&
sys
->
source_chain_lock
);
if
(
chain_update
)
{
if
(
chain_update
)
{
if
(
*
chain_update
)
{
filter_chain_ForEach
(
sys
->
source_chain
,
SubSourceClean
,
spu
);
filter_chain_Reset
(
sys
->
source_chain
,
NULL
,
NULL
);
filter_chain_Reset
(
sys
->
source_chain
,
NULL
,
NULL
);
filter_chain_AppendFromString
(
spu
->
p
->
source_chain
,
chain_update
);
filter_chain_AppendFromString
(
spu
->
p
->
source_chain
,
chain_update
);
}
filter_chain_ForEach
(
sys
->
source_chain
,
SubSourceInit
,
spu
);
else
if
(
filter_chain_GetLength
(
spu
->
p
->
source_chain
)
>
0
)
filter_chain_Reset
(
sys
->
source_chain
,
NULL
,
NULL
);
free
(
chain_update
);
free
(
chain_update
);
}
}
...
...
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