Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
3aa60180
Commit
3aa60180
authored
Dec 02, 2013
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc/examples/filtering_video: add some error handling in init_filters()
parent
a12bf9f5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
filtering_video.c
doc/examples/filtering_video.c
+15
-6
No files found.
doc/examples/filtering_video.c
View file @
3aa60180
...
@@ -85,7 +85,7 @@ static int open_input_file(const char *filename)
...
@@ -85,7 +85,7 @@ static int open_input_file(const char *filename)
static
int
init_filters
(
const
char
*
filters_descr
)
static
int
init_filters
(
const
char
*
filters_descr
)
{
{
char
args
[
512
];
char
args
[
512
];
int
ret
;
int
ret
=
0
;
AVFilter
*
buffersrc
=
avfilter_get_by_name
(
"buffer"
);
AVFilter
*
buffersrc
=
avfilter_get_by_name
(
"buffer"
);
AVFilter
*
buffersink
=
avfilter_get_by_name
(
"buffersink"
);
AVFilter
*
buffersink
=
avfilter_get_by_name
(
"buffersink"
);
AVFilterInOut
*
outputs
=
avfilter_inout_alloc
();
AVFilterInOut
*
outputs
=
avfilter_inout_alloc
();
...
@@ -94,6 +94,10 @@ static int init_filters(const char *filters_descr)
...
@@ -94,6 +94,10 @@ static int init_filters(const char *filters_descr)
AVBufferSinkParams
*
buffersink_params
;
AVBufferSinkParams
*
buffersink_params
;
filter_graph
=
avfilter_graph_alloc
();
filter_graph
=
avfilter_graph_alloc
();
if
(
!
outputs
||
!
inputs
||
!
filter_graph
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
end
;
}
/* buffer video source: the decoded frames from the decoder will be inserted here. */
/* buffer video source: the decoded frames from the decoder will be inserted here. */
snprintf
(
args
,
sizeof
(
args
),
snprintf
(
args
,
sizeof
(
args
),
...
@@ -106,7 +110,7 @@ static int init_filters(const char *filters_descr)
...
@@ -106,7 +110,7 @@ static int init_filters(const char *filters_descr)
args
,
NULL
,
filter_graph
);
args
,
NULL
,
filter_graph
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Cannot create buffer source
\n
"
);
av_log
(
NULL
,
AV_LOG_ERROR
,
"Cannot create buffer source
\n
"
);
return
ret
;
goto
end
;
}
}
/* buffer video sink: to terminate the filter chain. */
/* buffer video sink: to terminate the filter chain. */
...
@@ -117,7 +121,7 @@ static int init_filters(const char *filters_descr)
...
@@ -117,7 +121,7 @@ static int init_filters(const char *filters_descr)
av_free
(
buffersink_params
);
av_free
(
buffersink_params
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Cannot create buffer sink
\n
"
);
av_log
(
NULL
,
AV_LOG_ERROR
,
"Cannot create buffer sink
\n
"
);
return
ret
;
goto
end
;
}
}
/* Endpoints for the filter graph. */
/* Endpoints for the filter graph. */
...
@@ -133,11 +137,16 @@ static int init_filters(const char *filters_descr)
...
@@ -133,11 +137,16 @@ static int init_filters(const char *filters_descr)
if
((
ret
=
avfilter_graph_parse_ptr
(
filter_graph
,
filters_descr
,
if
((
ret
=
avfilter_graph_parse_ptr
(
filter_graph
,
filters_descr
,
&
inputs
,
&
outputs
,
NULL
))
<
0
)
&
inputs
,
&
outputs
,
NULL
))
<
0
)
return
ret
;
goto
end
;
if
((
ret
=
avfilter_graph_config
(
filter_graph
,
NULL
))
<
0
)
if
((
ret
=
avfilter_graph_config
(
filter_graph
,
NULL
))
<
0
)
goto
end
;
end:
avfilter_inout_free
(
&
inputs
);
avfilter_inout_free
(
&
outputs
);
return
ret
;
return
ret
;
return
0
;
}
}
static
void
display_frame
(
const
AVFrame
*
frame
,
AVRational
time_base
)
static
void
display_frame
(
const
AVFrame
*
frame
,
AVRational
time_base
)
...
...
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