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
6d6ccbae
Commit
6d6ccbae
authored
Oct 20, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/decoding_encoding: add missing checks on avcodec_alloc_context3()
parent
04bf2e7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
decoding_encoding.c
doc/examples/decoding_encoding.c
+17
-0
No files found.
doc/examples/decoding_encoding.c
View file @
6d6ccbae
...
...
@@ -121,6 +121,10 @@ static void audio_encode_example(const char *filename)
}
c
=
avcodec_alloc_context3
(
codec
);
if
(
!
c
)
{
fprintf
(
stderr
,
"Could not allocate audio codec context
\n
"
);
exit
(
1
);
}
/* put sample parameters */
c
->
bit_rate
=
64000
;
...
...
@@ -252,6 +256,10 @@ static void audio_decode_example(const char *outfilename, const char *filename)
}
c
=
avcodec_alloc_context3
(
codec
);
if
(
!
c
)
{
fprintf
(
stderr
,
"Could not allocate audio codec context
\n
"
);
exit
(
1
);
}
/* open it */
if
(
avcodec_open2
(
c
,
codec
,
NULL
)
<
0
)
{
...
...
@@ -346,6 +354,10 @@ static void video_encode_example(const char *filename, int codec_id)
}
c
=
avcodec_alloc_context3
(
codec
);
if
(
!
c
)
{
fprintf
(
stderr
,
"Could not allocate video codec context
\n
"
);
exit
(
1
);
}
/* put sample parameters */
c
->
bit_rate
=
400000
;
...
...
@@ -501,6 +513,11 @@ static void video_decode_example(const char *outfilename, const char *filename)
}
c
=
avcodec_alloc_context3
(
codec
);
if
(
!
c
)
{
fprintf
(
stderr
,
"Could not allocate video codec context
\n
"
);
exit
(
1
);
}
if
(
codec
->
capabilities
&
CODEC_CAP_TRUNCATED
)
c
->
flags
|=
CODEC_FLAG_TRUNCATED
;
/* we do not send complete frames */
...
...
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