Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
1565cbc6
Commit
1565cbc6
authored
Mar 31, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: make avfilter_free() remove the filter from its graph.
parent
11136726
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
7 deletions
+31
-7
avfilter.c
libavfilter/avfilter.c
+3
-0
avfilter.h
libavfilter/avfilter.h
+2
-1
avfiltergraph.c
libavfilter/avfiltergraph.c
+17
-2
graphparser.c
libavfilter/graphparser.c
+4
-4
internal.h
libavfilter/internal.h
+5
-0
No files found.
libavfilter/avfilter.c
View file @
1565cbc6
...
@@ -430,6 +430,9 @@ void avfilter_free(AVFilterContext *filter)
...
@@ -430,6 +430,9 @@ void avfilter_free(AVFilterContext *filter)
int
i
;
int
i
;
AVFilterLink
*
link
;
AVFilterLink
*
link
;
if
(
filter
->
graph
)
ff_filter_graph_remove_filter
(
filter
->
graph
,
filter
);
if
(
filter
->
filter
->
uninit
)
if
(
filter
->
filter
->
uninit
)
filter
->
filter
->
uninit
(
filter
);
filter
->
filter
->
uninit
(
filter
);
...
...
libavfilter/avfilter.h
View file @
1565cbc6
...
@@ -658,7 +658,8 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
...
@@ -658,7 +658,8 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
int
avfilter_init_filter
(
AVFilterContext
*
filter
,
const
char
*
args
,
void
*
opaque
);
int
avfilter_init_filter
(
AVFilterContext
*
filter
,
const
char
*
args
,
void
*
opaque
);
/**
/**
* Free a filter context.
* Free a filter context. This will also remove the filter from its
* filtergraph's list of filters.
*
*
* @param filter the filter to free
* @param filter the filter to free
*/
*/
...
...
libavfilter/avfiltergraph.c
View file @
1565cbc6
...
@@ -46,12 +46,27 @@ AVFilterGraph *avfilter_graph_alloc(void)
...
@@ -46,12 +46,27 @@ AVFilterGraph *avfilter_graph_alloc(void)
return
ret
;
return
ret
;
}
}
void
ff_filter_graph_remove_filter
(
AVFilterGraph
*
graph
,
AVFilterContext
*
filter
)
{
int
i
;
for
(
i
=
0
;
i
<
graph
->
nb_filters
;
i
++
)
{
if
(
graph
->
filters
[
i
]
==
filter
)
{
FFSWAP
(
AVFilterContext
*
,
graph
->
filters
[
i
],
graph
->
filters
[
graph
->
nb_filters
-
1
]);
graph
->
nb_filters
--
;
return
;
}
}
}
void
avfilter_graph_free
(
AVFilterGraph
**
graph
)
void
avfilter_graph_free
(
AVFilterGraph
**
graph
)
{
{
if
(
!*
graph
)
if
(
!*
graph
)
return
;
return
;
for
(;
(
*
graph
)
->
nb_filters
>
0
;
(
*
graph
)
->
nb_filters
--
)
avfilter_free
((
*
graph
)
->
filters
[(
*
graph
)
->
nb_filters
-
1
]);
while
((
*
graph
)
->
nb_filters
)
avfilter_free
((
*
graph
)
->
filters
[
0
]);
av_freep
(
&
(
*
graph
)
->
scale_sws_opts
);
av_freep
(
&
(
*
graph
)
->
scale_sws_opts
);
av_freep
(
&
(
*
graph
)
->
resample_lavr_opts
);
av_freep
(
&
(
*
graph
)
->
resample_lavr_opts
);
av_freep
(
&
(
*
graph
)
->
filters
);
av_freep
(
&
(
*
graph
)
->
filters
);
...
...
libavfilter/graphparser.c
View file @
1565cbc6
...
@@ -430,8 +430,8 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
...
@@ -430,8 +430,8 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
return
0
;
return
0
;
fail:
fail:
for
(;
graph
->
nb_filters
>
0
;
graph
->
nb_filters
--
)
while
(
graph
->
nb_filters
)
avfilter_free
(
graph
->
filters
[
graph
->
nb_filters
-
1
]);
avfilter_free
(
graph
->
filters
[
0
]);
av_freep
(
&
graph
->
filters
);
av_freep
(
&
graph
->
filters
);
avfilter_inout_free
(
&
open_inputs
);
avfilter_inout_free
(
&
open_inputs
);
avfilter_inout_free
(
&
open_outputs
);
avfilter_inout_free
(
&
open_outputs
);
...
@@ -495,8 +495,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
...
@@ -495,8 +495,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
fail:
fail:
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
for
(;
graph
->
nb_filters
>
0
;
graph
->
nb_filters
--
)
while
(
graph
->
nb_filters
)
avfilter_free
(
graph
->
filters
[
graph
->
nb_filters
-
1
]);
avfilter_free
(
graph
->
filters
[
0
]);
av_freep
(
&
graph
->
filters
);
av_freep
(
&
graph
->
filters
);
}
}
avfilter_inout_free
(
&
inputs
);
avfilter_inout_free
(
&
inputs
);
...
...
libavfilter/internal.h
View file @
1565cbc6
...
@@ -206,4 +206,9 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame);
...
@@ -206,4 +206,9 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame);
*/
*/
AVFilterContext
*
ff_filter_alloc
(
const
AVFilter
*
filter
,
const
char
*
inst_name
);
AVFilterContext
*
ff_filter_alloc
(
const
AVFilter
*
filter
,
const
char
*
inst_name
);
/**
* Remove a filter from a graph;
*/
void
ff_filter_graph_remove_filter
(
AVFilterGraph
*
graph
,
AVFilterContext
*
filter
);
#endif
/* AVFILTER_INTERNAL_H */
#endif
/* AVFILTER_INTERNAL_H */
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