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
799f57ac
Commit
799f57ac
authored
Jun 04, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: use AVFrame API properly in pad_last_frame().
This also simplifies the code.
parent
8835c554
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
utils.c
libavcodec/utils.c
+8
-15
No files found.
libavcodec/utils.c
View file @
799f57ac
...
@@ -1119,26 +1119,22 @@ int ff_alloc_packet(AVPacket *avpkt, int size)
...
@@ -1119,26 +1119,22 @@ int ff_alloc_packet(AVPacket *avpkt, int size)
static
int
pad_last_frame
(
AVCodecContext
*
s
,
AVFrame
**
dst
,
const
AVFrame
*
src
)
static
int
pad_last_frame
(
AVCodecContext
*
s
,
AVFrame
**
dst
,
const
AVFrame
*
src
)
{
{
AVFrame
*
frame
=
NULL
;
AVFrame
*
frame
=
NULL
;
uint8_t
*
buf
=
NULL
;
int
ret
;
int
ret
;
if
(
!
(
frame
=
avcodec_alloc_frame
()))
if
(
!
(
frame
=
avcodec_alloc_frame
()))
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
*
frame
=
*
src
;
if
((
ret
=
av_samples_get_buffer_size
(
&
frame
->
linesize
[
0
],
s
->
channels
,
frame
->
format
=
src
->
format
;
s
->
frame_size
,
s
->
sample_fmt
,
0
))
<
0
)
frame
->
channel_layout
=
src
->
channel_layout
;
frame
->
nb_samples
=
s
->
frame_size
;
ret
=
av_frame_get_buffer
(
frame
,
32
);
if
(
ret
<
0
)
goto
fail
;
goto
fail
;
if
(
!
(
buf
=
av_malloc
(
ret
)))
{
ret
=
av_frame_copy_props
(
frame
,
src
);
ret
=
AVERROR
(
ENOMEM
);
if
(
ret
<
0
)
goto
fail
;
goto
fail
;
}
frame
->
nb_samples
=
s
->
frame_size
;
if
((
ret
=
avcodec_fill_audio_frame
(
frame
,
s
->
channels
,
s
->
sample_fmt
,
buf
,
ret
,
0
))
<
0
)
goto
fail
;
if
((
ret
=
av_samples_copy
(
frame
->
extended_data
,
src
->
extended_data
,
0
,
0
,
if
((
ret
=
av_samples_copy
(
frame
->
extended_data
,
src
->
extended_data
,
0
,
0
,
src
->
nb_samples
,
s
->
channels
,
s
->
sample_fmt
))
<
0
)
src
->
nb_samples
,
s
->
channels
,
s
->
sample_fmt
))
<
0
)
goto
fail
;
goto
fail
;
...
@@ -1152,10 +1148,7 @@ static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src)
...
@@ -1152,10 +1148,7 @@ static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src)
return
0
;
return
0
;
fail:
fail:
if
(
frame
->
extended_data
!=
frame
->
data
)
av_frame_free
(
&
frame
);
av_freep
(
&
frame
->
extended_data
);
av_freep
(
&
buf
);
av_freep
(
&
frame
);
return
ret
;
return
ret
;
}
}
...
...
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