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
27bdfd29
Commit
27bdfd29
authored
Dec 15, 2014
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/mxfdec: Factorize mxf_read_close().
This will allow to fix leaks in a subsequent commit.
parent
fd77fbb3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
29 deletions
+33
-29
mxfdec.c
libavformat/mxfdec.c
+33
-29
No files found.
libavformat/mxfdec.c
View file @
27bdfd29
...
...
@@ -282,6 +282,38 @@ static const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x
#define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
static
void
mxf_free_metadataset
(
MXFMetadataSet
**
ctx
)
{
MXFIndexTableSegment
*
seg
;
switch
((
*
ctx
)
->
type
)
{
case
Descriptor
:
av_freep
(
&
((
MXFDescriptor
*
)
*
ctx
)
->
extradata
);
break
;
case
MultipleDescriptor
:
av_freep
(
&
((
MXFDescriptor
*
)
*
ctx
)
->
sub_descriptors_refs
);
break
;
case
Sequence
:
av_freep
(
&
((
MXFSequence
*
)
*
ctx
)
->
structural_components_refs
);
break
;
case
EssenceGroup
:
av_freep
(
&
((
MXFEssenceGroup
*
)
*
ctx
)
->
structural_components_refs
);
break
;
case
SourcePackage
:
case
MaterialPackage
:
av_freep
(
&
((
MXFPackage
*
)
*
ctx
)
->
tracks_refs
);
av_freep
(
&
((
MXFPackage
*
)
*
ctx
)
->
name
);
break
;
case
IndexTableSegment
:
seg
=
(
MXFIndexTableSegment
*
)
*
ctx
;
av_freep
(
&
seg
->
temporal_offset_entries
);
av_freep
(
&
seg
->
flag_entries
);
av_freep
(
&
seg
->
stream_offset_entries
);
default:
break
;
}
av_freep
(
ctx
);
}
static
int64_t
klv_decode_ber_length
(
AVIOContext
*
pb
)
{
uint64_t
size
=
avio_r8
(
pb
);
...
...
@@ -2831,7 +2863,6 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
static
int
mxf_read_close
(
AVFormatContext
*
s
)
{
MXFContext
*
mxf
=
s
->
priv_data
;
MXFIndexTableSegment
*
seg
;
int
i
;
av_freep
(
&
mxf
->
packages_refs
);
...
...
@@ -2840,34 +2871,7 @@ static int mxf_read_close(AVFormatContext *s)
s
->
streams
[
i
]
->
priv_data
=
NULL
;
for
(
i
=
0
;
i
<
mxf
->
metadata_sets_count
;
i
++
)
{
switch
(
mxf
->
metadata_sets
[
i
]
->
type
)
{
case
Descriptor
:
av_freep
(
&
((
MXFDescriptor
*
)
mxf
->
metadata_sets
[
i
])
->
extradata
);
break
;
case
MultipleDescriptor
:
av_freep
(
&
((
MXFDescriptor
*
)
mxf
->
metadata_sets
[
i
])
->
sub_descriptors_refs
);
break
;
case
Sequence
:
av_freep
(
&
((
MXFSequence
*
)
mxf
->
metadata_sets
[
i
])
->
structural_components_refs
);
break
;
case
EssenceGroup
:
av_freep
(
&
((
MXFEssenceGroup
*
)
mxf
->
metadata_sets
[
i
])
->
structural_components_refs
);
break
;
case
SourcePackage
:
case
MaterialPackage
:
av_freep
(
&
((
MXFPackage
*
)
mxf
->
metadata_sets
[
i
])
->
tracks_refs
);
av_freep
(
&
((
MXFPackage
*
)
mxf
->
metadata_sets
[
i
])
->
name
);
break
;
case
IndexTableSegment
:
seg
=
(
MXFIndexTableSegment
*
)
mxf
->
metadata_sets
[
i
];
av_freep
(
&
seg
->
temporal_offset_entries
);
av_freep
(
&
seg
->
flag_entries
);
av_freep
(
&
seg
->
stream_offset_entries
);
break
;
default:
break
;
}
av_freep
(
&
mxf
->
metadata_sets
[
i
]);
mxf_free_metadataset
(
mxf
->
metadata_sets
+
i
);
}
av_freep
(
&
mxf
->
partitions
);
av_freep
(
&
mxf
->
metadata_sets
);
...
...
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