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
94d1d6c0
Commit
94d1d6c0
authored
Mar 01, 2006
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ODML index parsing support
Originally committed as revision 5081 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
9eb40bcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
3 deletions
+68
-3
avidec.c
libavformat/avidec.c
+68
-3
No files found.
libavformat/avidec.c
View file @
94d1d6c0
...
...
@@ -37,7 +37,7 @@ typedef struct AVIStream {
int
sample_size
;
/* audio only data */
int
start
;
int
cum_len
;
/* temporary storage (used during seek) */
int
64_t
cum_len
;
/* temporary storage (used during seek) */
int
prefix
;
///< normally 'd'<<8 + 'c' or 'w'<<8 + 'b'
int
prefix_count
;
...
...
@@ -85,6 +85,65 @@ static int get_riff(AVIContext *avi, ByteIOContext *pb)
return
0
;
}
static
int
read_braindead_odml_indx
(
AVFormatContext
*
s
,
int
frame_num
){
ByteIOContext
*
pb
=
&
s
->
pb
;
int
longs_pre_entry
=
get_le16
(
pb
);
int
index_sub_type
=
get_byte
(
pb
);
int
index_type
=
get_byte
(
pb
);
int
entries_in_use
=
get_le32
(
pb
);
int
chunk_id
=
get_le32
(
pb
);
int64_t
base
=
get_le64
(
pb
);
int
stream_id
=
10
*
((
chunk_id
&
0xFF
)
-
'0'
)
+
(((
chunk_id
>>
8
)
&
0xFF
)
-
'0'
);
AVStream
*
st
;
AVIStream
*
ast
;
int
i
;
// av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%Ld\n",
// longs_pre_entry,index_type, entries_in_use, chunk_id, base);
if
(
stream_id
>
s
->
nb_streams
||
stream_id
<
0
)
return
-
1
;
st
=
s
->
streams
[
stream_id
];
ast
=
st
->
priv_data
;
if
(
index_sub_type
)
return
-
1
;
get_le32
(
pb
);
if
(
index_type
&&
longs_pre_entry
!=
2
)
return
-
1
;
if
(
index_type
>
1
)
return
-
1
;
for
(
i
=
0
;
i
<
entries_in_use
;
i
++
){
if
(
index_type
){
int64_t
pos
=
get_le32
(
pb
)
+
base
;
int
len
=
get_le32
(
pb
);
av_add_index_entry
(
st
,
pos
,
ast
->
cum_len
,
0
,
(
len
<
0
)
?
0
:
AVINDEX_KEYFRAME
);
len
&=
0x7FFFFFFF
;
if
(
ast
->
sample_size
)
ast
->
cum_len
+=
len
/
ast
->
sample_size
;
else
ast
->
cum_len
++
;
}
else
{
int64_t
offset
=
get_le64
(
pb
);
int
size
=
get_le32
(
pb
);
int
duration
=
get_le32
(
pb
);
int64_t
pos
=
url_ftell
(
pb
);
url_fseek
(
pb
,
offset
+
8
,
SEEK_SET
);
read_braindead_odml_indx
(
s
,
frame_num
);
frame_num
+=
duration
;
url_fseek
(
pb
,
pos
,
SEEK_SET
);
}
}
return
0
;
}
static
int
avi_read_header
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
)
{
AVIContext
*
avi
=
s
->
priv_data
;
...
...
@@ -326,6 +385,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
}
break
;
case
MKTAG
(
'i'
,
'n'
,
'd'
,
'x'
):
i
=
url_ftell
(
pb
);
read_braindead_odml_indx
(
s
,
0
);
avi
->
index_loaded
=
1
;
url_fseek
(
pb
,
i
+
size
,
SEEK_SET
);
break
;
default
:
/* skip tag */
size
+=
(
size
&
1
);
...
...
@@ -344,8 +409,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
return
-
1
;
}
assert
(
!
avi
->
index_loaded
);
avi_load_index
(
s
);
if
(
!
avi
->
index_loaded
)
avi_load_index
(
s
);
avi
->
index_loaded
=
1
;
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