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
44671b57
Commit
44671b57
authored
Jun 18, 2014
by
Roman Savchenko
Committed by
Anton Khirnov
Jun 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AVFrame: factor out freeing the side data
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
9affa784
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
frame.c
libavutil/frame.c
+12
-9
No files found.
libavutil/frame.c
View file @
44671b57
...
...
@@ -47,6 +47,15 @@ static void get_frame_defaults(AVFrame *frame)
#endif
}
static
void
free_side_data
(
AVFrameSideData
**
ptr_sd
)
{
AVFrameSideData
*
sd
=
*
ptr_sd
;
av_freep
(
&
sd
->
data
);
av_dict_free
(
&
sd
->
metadata
);
av_freep
(
ptr_sd
);
}
AVFrame
*
av_frame_alloc
(
void
)
{
AVFrame
*
frame
=
av_mallocz
(
sizeof
(
*
frame
));
...
...
@@ -278,9 +287,7 @@ void av_frame_unref(AVFrame *frame)
int
i
;
for
(
i
=
0
;
i
<
frame
->
nb_side_data
;
i
++
)
{
av_freep
(
&
frame
->
side_data
[
i
]
->
data
);
av_dict_free
(
&
frame
->
side_data
[
i
]
->
metadata
);
av_freep
(
&
frame
->
side_data
[
i
]);
free_side_data
(
&
frame
->
side_data
[
i
]);
}
av_freep
(
&
frame
->
side_data
);
...
...
@@ -396,9 +403,7 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
sd_src
->
size
);
if
(
!
sd_dst
)
{
for
(
i
=
0
;
i
<
dst
->
nb_side_data
;
i
++
)
{
av_freep
(
&
dst
->
side_data
[
i
]
->
data
);
av_dict_free
(
&
dst
->
side_data
[
i
]
->
metadata
);
av_freep
(
&
dst
->
side_data
[
i
]);
free_side_data
(
&
dst
->
side_data
[
i
]);
}
av_freep
(
&
dst
->
side_data
);
return
AVERROR
(
ENOMEM
);
...
...
@@ -548,9 +553,7 @@ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
for
(
i
=
0
;
i
<
frame
->
nb_side_data
;
i
++
)
{
AVFrameSideData
*
sd
=
frame
->
side_data
[
i
];
if
(
sd
->
type
==
type
)
{
av_freep
(
&
sd
->
data
);
av_dict_free
(
&
sd
->
metadata
);
av_freep
(
&
frame
->
side_data
[
i
]);
free_side_data
(
&
frame
->
side_data
[
i
]);
frame
->
side_data
[
i
]
=
frame
->
side_data
[
frame
->
nb_side_data
-
1
];
frame
->
nb_side_data
--
;
}
...
...
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