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
90756e67
Commit
90756e67
authored
Feb 18, 2018
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/mxfdec: use binary search in mxf_absolute_bodysid_offset
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
3aaf97e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
mxfdec.c
libavformat/mxfdec.c
+14
-8
No files found.
libavformat/mxfdec.c
View file @
90756e67
...
...
@@ -1347,24 +1347,30 @@ static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segment
*/
static
int
mxf_absolute_bodysid_offset
(
MXFContext
*
mxf
,
int
body_sid
,
int64_t
offset
,
int64_t
*
offset_out
)
{
int
x
;
MXFPartition
*
last_p
=
NULL
;
int
a
,
b
,
m
,
m0
;
if
(
offset
<
0
)
return
AVERROR
(
EINVAL
);
for
(
x
=
0
;
x
<
mxf
->
partitions_count
;
x
++
)
{
MXFPartition
*
p
=
&
mxf
->
partitions
[
x
]
;
a
=
-
1
;
b
=
mxf
->
partitions_count
;
if
(
p
->
body_sid
!=
body_sid
)
continue
;
while
(
b
-
a
>
1
)
{
m0
=
m
=
(
a
+
b
)
>>
1
;
if
(
p
->
body_offset
>
offset
)
break
;
while
(
m
<
b
&&
mxf
->
partitions
[
m
].
body_sid
!=
body_sid
)
m
++
;
last_p
=
p
;
if
(
m
<
b
&&
mxf
->
partitions
[
m
].
body_offset
<=
offset
)
a
=
m
;
else
b
=
m0
;
}
if
(
a
>=
0
)
last_p
=
&
mxf
->
partitions
[
a
];
if
(
last_p
&&
(
!
last_p
->
essence_length
||
last_p
->
essence_length
>
(
offset
-
last_p
->
body_offset
)))
{
*
offset_out
=
last_p
->
essence_offset
+
(
offset
-
last_p
->
body_offset
);
return
0
;
...
...
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