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
bfa0b504
Commit
bfa0b504
authored
May 20, 2018
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/mxfdec: store next_klv in KLVPacket
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
d4d29052
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
mxf.h
libavformat/mxf.h
+1
-0
mxfdec.c
libavformat/mxfdec.c
+8
-5
No files found.
libavformat/mxf.h
View file @
bfa0b504
...
...
@@ -62,6 +62,7 @@ typedef struct KLVPacket {
UID
key
;
int64_t
offset
;
uint64_t
length
;
int64_t
next_klv
;
}
KLVPacket
;
typedef
struct
MXFCodecUL
{
...
...
libavformat/mxfdec.c
View file @
bfa0b504
...
...
@@ -392,7 +392,7 @@ static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size)
static
int
klv_read_packet
(
KLVPacket
*
klv
,
AVIOContext
*
pb
)
{
int64_t
length
;
int64_t
length
,
pos
;
if
(
!
mxf_read_sync
(
pb
,
mxf_klv_key
,
4
))
return
AVERROR_INVALIDDATA
;
klv
->
offset
=
avio_tell
(
pb
)
-
4
;
...
...
@@ -402,6 +402,10 @@ static int klv_read_packet(KLVPacket *klv, AVIOContext *pb)
if
(
length
<
0
)
return
length
;
klv
->
length
=
length
;
pos
=
avio_tell
(
pb
);
if
(
pos
>
INT64_MAX
-
length
)
return
AVERROR_INVALIDDATA
;
klv
->
next_klv
=
pos
+
length
;
return
0
;
}
...
...
@@ -3264,7 +3268,7 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
IS_KLV_KEY
(
klv
.
key
,
mxf_avid_essence_element_key
))
{
int
body_sid
=
find_body_sid_by_offset
(
mxf
,
klv
.
offset
);
int
index
=
mxf_get_stream_index
(
s
,
&
klv
,
body_sid
);
int64_t
next_ofs
,
next_klv
;
int64_t
next_ofs
;
AVStream
*
st
;
if
(
index
<
0
)
{
...
...
@@ -3279,10 +3283,9 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
if
(
s
->
streams
[
index
]
->
discard
==
AVDISCARD_ALL
)
goto
skip
;
next_klv
=
avio_tell
(
s
->
pb
)
+
klv
.
length
;
next_ofs
=
mxf_set_current_edit_unit
(
mxf
,
klv
.
offset
);
if
(
next_ofs
>=
0
&&
next_klv
>
next_ofs
)
{
if
(
next_ofs
>=
0
&&
klv
.
next_klv
>
next_ofs
)
{
/* if this check is hit then it's possible OPAtom was treated as OP1a
* truncate the packet since it's probably very large (>2 GiB is common) */
avpriv_request_sample
(
s
,
...
...
@@ -3314,7 +3317,7 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
return
ret
;
/* seek for truncated packets */
avio_seek
(
s
->
pb
,
next_klv
,
SEEK_SET
);
avio_seek
(
s
->
pb
,
klv
.
next_klv
,
SEEK_SET
);
return
0
;
}
else
...
...
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