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
06336296
Commit
06336296
authored
Jul 28, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter_chain: make filter_chain_AppendFromString() iterative
(rather than recursive)
parent
8e1a72a2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
46 deletions
+43
-46
src/misc/filter_chain.c
src/misc/filter_chain.c
+43
-46
No files found.
src/misc/filter_chain.c
View file @
06336296
...
...
@@ -2,7 +2,7 @@
* filter_chain.c : Handle chains of filter_t objects.
*****************************************************************************
* Copyright (C) 2008 VLC authors and VideoLAN
*
$Id$
*
Copyright (C) 2008-2014 Rémi Denis-Courmont
*
* Author: Antoine Cellerier <dionoea at videolan dot org>
*
...
...
@@ -92,8 +92,6 @@ static filter_t *filter_chain_AppendFilterInternal( filter_chain_t *,
const
char
*
,
config_chain_t
*
,
const
es_format_t
*
,
const
es_format_t
*
);
static
int
filter_chain_AppendFromStringInternal
(
filter_chain_t
*
,
const
char
*
);
static
int
filter_chain_DeleteFilterInternal
(
filter_chain_t
*
,
filter_t
*
);
static
int
UpdateBufferFunctions
(
filter_chain_t
*
);
...
...
@@ -182,15 +180,50 @@ filter_t *filter_chain_AppendFilter( filter_chain_t *p_chain,
return
p_filter
;
}
int
filter_chain_AppendFromString
(
filter_chain_t
*
p_chain
,
const
char
*
psz_string
)
int
filter_chain_AppendFromString
(
filter_chain_t
*
chain
,
const
char
*
str
)
{
const
int
i_ret
=
filter_chain_AppendFromStringInternal
(
p_chain
,
psz_string
);
if
(
i_ret
<
0
)
return
i_ret
;
char
*
buf
=
NULL
;
int
ret
=
0
;
/* FIXME That one seems bad if a error is returned */
return
UpdateBufferFunctions
(
p_chain
);
while
(
str
!=
NULL
&&
str
[
0
]
!=
'\0'
)
{
config_chain_t
*
cfg
;
char
*
name
;
char
*
next
=
config_ChainCreate
(
&
name
,
&
cfg
,
str
);
str
=
next
;
free
(
buf
);
buf
=
next
;
filter_t
*
filter
=
filter_chain_AppendFilterInternal
(
chain
,
name
,
cfg
,
NULL
,
NULL
);
if
(
filter
==
NULL
)
{
msg_Err
(
chain
->
p_this
,
"Failed while trying to append '%s' "
"to filter chain"
,
name
);
free
(
name
);
free
(
cfg
);
goto
error
;
}
free
(
name
);
ret
++
;
}
if
(
UpdateBufferFunctions
(
chain
)
)
assert
(
0
);
/* should never happen, vf2 alloc cannot fail */
free
(
buf
);
return
ret
;
error:
while
(
ret
>
0
)
/* Unwind */
{
filter_chain_DeleteFilterInternal
(
chain
,
&
chain
->
last
->
filter
);
ret
--
;
}
free
(
buf
);
return
-
1
;
}
int
filter_chain_DeleteFilter
(
filter_chain_t
*
p_chain
,
filter_t
*
p_filter
)
...
...
@@ -447,42 +480,6 @@ error:
return
NULL
;
}
static
int
filter_chain_AppendFromStringInternal
(
filter_chain_t
*
p_chain
,
const
char
*
psz_string
)
{
config_chain_t
*
p_cfg
=
NULL
;
char
*
psz_name
=
NULL
;
char
*
psz_new_string
;
if
(
!
psz_string
||
!*
psz_string
)
return
0
;
psz_new_string
=
config_ChainCreate
(
&
psz_name
,
&
p_cfg
,
psz_string
);
filter_t
*
p_filter
=
filter_chain_AppendFilterInternal
(
p_chain
,
psz_name
,
p_cfg
,
NULL
,
NULL
);
if
(
!
p_filter
)
{
msg_Err
(
p_chain
->
p_this
,
"Failed while trying to append '%s' "
"to filter chain"
,
psz_name
);
free
(
psz_name
);
free
(
p_cfg
);
free
(
psz_new_string
);
return
-
1
;
}
free
(
psz_name
);
const
int
i_ret
=
filter_chain_AppendFromStringInternal
(
p_chain
,
psz_new_string
);
free
(
psz_new_string
);
if
(
i_ret
<
0
)
{
filter_chain_DeleteFilterInternal
(
p_chain
,
p_filter
);
return
i_ret
;
}
return
1
+
i_ret
;
}
static
int
filter_chain_DeleteFilterInternal
(
filter_chain_t
*
p_chain
,
filter_t
*
p_filter
)
{
...
...
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