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
90bc4232
Commit
90bc4232
authored
Jul 20, 2016
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mov: Wrap stsc index and count compare in a separate function
parent
209ee680
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
mov.c
libavformat/mov.c
+10
-5
No files found.
libavformat/mov.c
View file @
90bc4232
...
...
@@ -1961,12 +1961,17 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return
0
;
}
static
inline
int
mov_stsc_index_valid
(
int
index
,
int
count
)
{
return
index
+
1
<
count
;
}
/* Compute the samples value for the stsc entry at the given index. */
static
inline
int
mov_get_stsc_samples
(
MOVStreamContext
*
sc
,
int
index
)
{
int
chunk_count
;
if
(
index
<
sc
->
stsc_count
-
1
)
if
(
mov_stsc_index_valid
(
index
,
sc
->
stsc_count
)
)
chunk_count
=
sc
->
stsc_data
[
index
+
1
].
first
-
sc
->
stsc_data
[
index
].
first
;
else
chunk_count
=
sc
->
chunk_count
-
(
sc
->
stsc_data
[
index
].
first
-
1
);
...
...
@@ -2333,7 +2338,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
for
(
i
=
0
;
i
<
sc
->
chunk_count
;
i
++
)
{
current_offset
=
sc
->
chunk_offsets
[
i
];
while
(
stsc_index
+
1
<
sc
->
stsc_count
&&
while
(
mov_stsc_index_valid
(
stsc_index
,
sc
->
stsc_count
)
&&
i
+
1
==
sc
->
stsc_data
[
stsc_index
+
1
].
first
)
stsc_index
++
;
for
(
j
=
0
;
j
<
sc
->
stsc_data
[
stsc_index
].
count
;
j
++
)
{
...
...
@@ -2413,7 +2418,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
count
=
(
chunk_samples
+
1023
)
/
1024
;
}
if
(
i
<
sc
->
stsc_count
-
1
)
if
(
mov_stsc_index_valid
(
i
,
sc
->
stsc_count
)
)
chunk_count
=
sc
->
stsc_data
[
i
+
1
].
first
-
sc
->
stsc_data
[
i
].
first
;
else
chunk_count
=
sc
->
chunk_count
-
(
sc
->
stsc_data
[
i
].
first
-
1
);
...
...
@@ -2434,7 +2439,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
// populate index
for
(
i
=
0
;
i
<
sc
->
chunk_count
;
i
++
)
{
current_offset
=
sc
->
chunk_offsets
[
i
];
if
(
stsc_index
+
1
<
sc
->
stsc_count
&&
if
(
mov_stsc_index_valid
(
stsc_index
,
sc
->
stsc_count
)
&&
i
+
1
==
sc
->
stsc_data
[
stsc_index
+
1
].
first
)
stsc_index
++
;
chunk_samples
=
sc
->
stsc_data
[
stsc_index
].
count
;
...
...
@@ -3680,7 +3685,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
/* Keep track of the stsc index for the given sample, then check
* if the stsd index is different from the last used one. */
sc
->
stsc_sample
++
;
if
(
sc
->
stsc_index
+
1
<
sc
->
stsc_count
&&
if
(
mov_stsc_index_valid
(
sc
->
stsc_index
,
sc
->
stsc_count
)
&&
mov_get_stsc_samples
(
sc
,
sc
->
stsc_index
)
==
sc
->
stsc_sample
)
{
sc
->
stsc_index
++
;
sc
->
stsc_sample
=
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