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
30a43f2d
Commit
30a43f2d
authored
Mar 01, 2006
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add size to AVIndex
Originally committed as revision 5083 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
26d6d032
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
14 deletions
+19
-14
asf.c
libavformat/asf.c
+1
-1
avformat.h
libavformat/avformat.h
+3
-3
avidec.c
libavformat/avidec.c
+8
-5
mpeg.c
libavformat/mpeg.c
+1
-1
nut.c
libavformat/nut.c
+1
-0
rm.c
libavformat/rm.c
+2
-2
utils.c
libavformat/utils.c
+3
-2
No files found.
libavformat/asf.c
View file @
30a43f2d
...
@@ -813,7 +813,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
...
@@ -813,7 +813,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
assert
((
asf_st
->
packet_pos
-
s
->
data_offset
)
%
asf
->
packet_size
==
0
);
assert
((
asf_st
->
packet_pos
-
s
->
data_offset
)
%
asf
->
packet_size
==
0
);
pos
=
asf_st
->
packet_pos
;
pos
=
asf_st
->
packet_pos
;
av_add_index_entry
(
s
->
streams
[
i
],
pos
,
pts
,
pos
-
start_pos
[
i
]
+
1
,
AVINDEX_KEYFRAME
);
av_add_index_entry
(
s
->
streams
[
i
],
pos
,
p
kt
->
size
,
p
ts
,
pos
-
start_pos
[
i
]
+
1
,
AVINDEX_KEYFRAME
);
start_pos
[
i
]
=
asf_st
->
packet_pos
+
1
;
start_pos
[
i
]
=
asf_st
->
packet_pos
+
1
;
if
(
pkt
->
stream_index
==
stream_index
)
if
(
pkt
->
stream_index
==
stream_index
)
...
...
libavformat/avformat.h
View file @
30a43f2d
...
@@ -208,8 +208,8 @@ typedef struct AVIndexEntry {
...
@@ -208,8 +208,8 @@ typedef struct AVIndexEntry {
int64_t
pos
;
int64_t
pos
;
int64_t
timestamp
;
int64_t
timestamp
;
#define AVINDEX_KEYFRAME 0x0001
#define AVINDEX_KEYFRAME 0x0001
/* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed */
int
flags
:
2
;
int
flags
;
int
size
:
30
;
//yeah trying to keep the size of this small to reduce memory requirements (its 24 vs 32 byte due to possible 8byte align)
int
min_distance
;
/* min distance between this and the previous keyframe, used to avoid unneeded searching */
int
min_distance
;
/* min distance between this and the previous keyframe, used to avoid unneeded searching */
}
AVIndexEntry
;
}
AVIndexEntry
;
...
@@ -641,7 +641,7 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits,
...
@@ -641,7 +641,7 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits,
int
av_find_default_stream_index
(
AVFormatContext
*
s
);
int
av_find_default_stream_index
(
AVFormatContext
*
s
);
int
av_index_search_timestamp
(
AVStream
*
st
,
int64_t
timestamp
,
int
flags
);
int
av_index_search_timestamp
(
AVStream
*
st
,
int64_t
timestamp
,
int
flags
);
int
av_add_index_entry
(
AVStream
*
st
,
int
av_add_index_entry
(
AVStream
*
st
,
int64_t
pos
,
int64_t
timestamp
,
int
distance
,
int
flags
);
int64_t
pos
,
int64_t
timestamp
,
int
size
,
int
distance
,
int
flags
);
int
av_seek_frame_binary
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
target_ts
,
int
flags
);
int
av_seek_frame_binary
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
target_ts
,
int
flags
);
/* media file output */
/* media file output */
...
...
libavformat/avidec.c
View file @
30a43f2d
...
@@ -55,6 +55,7 @@ typedef struct {
...
@@ -55,6 +55,7 @@ typedef struct {
}
AVIContext
;
}
AVIContext
;
static
int
avi_load_index
(
AVFormatContext
*
s
);
static
int
avi_load_index
(
AVFormatContext
*
s
);
static
int
guess_ni_flag
(
AVFormatContext
*
s
);
#ifdef DEBUG
#ifdef DEBUG
static
void
print_tag
(
const
char
*
str
,
unsigned
int
tag
,
int
size
)
static
void
print_tag
(
const
char
*
str
,
unsigned
int
tag
,
int
size
)
...
@@ -118,12 +119,14 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
...
@@ -118,12 +119,14 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
for
(
i
=
0
;
i
<
entries_in_use
;
i
++
){
for
(
i
=
0
;
i
<
entries_in_use
;
i
++
){
if
(
index_type
){
if
(
index_type
){
int64_t
pos
=
get_le32
(
pb
)
+
base
;
int64_t
pos
=
get_le32
(
pb
)
+
base
-
8
;
int
len
=
get_le32
(
pb
);
int
len
=
get_le32
(
pb
);
int
key
=
len
>=
0
;
av_add_index_entry
(
st
,
pos
,
ast
->
cum_len
,
0
,
(
len
<
0
)
?
0
:
AVINDEX_KEYFRAME
);
len
&=
0x7FFFFFFF
;
len
&=
0x7FFFFFFF
;
//av_log(s, AV_LOG_ERROR, "pos:%Ld, len:%X\n", pos, len);
av_add_index_entry
(
st
,
pos
,
ast
->
cum_len
,
len
,
0
,
key
?
AVINDEX_KEYFRAME
:
0
);
if
(
ast
->
sample_size
)
if
(
ast
->
sample_size
)
ast
->
cum_len
+=
len
/
ast
->
sample_size
;
ast
->
cum_len
+=
len
/
ast
->
sample_size
;
else
else
...
@@ -412,6 +415,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -412,6 +415,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if
(
!
avi
->
index_loaded
)
if
(
!
avi
->
index_loaded
)
avi_load_index
(
s
);
avi_load_index
(
s
);
avi
->
index_loaded
=
1
;
avi
->
index_loaded
=
1
;
avi
->
non_interleaved
|=
guess_ni_flag
(
s
);
return
0
;
return
0
;
}
}
...
@@ -699,7 +703,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)
...
@@ -699,7 +703,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)
if
(
last_pos
==
pos
)
if
(
last_pos
==
pos
)
avi
->
non_interleaved
=
1
;
avi
->
non_interleaved
=
1
;
else
else
av_add_index_entry
(
st
,
pos
,
ast
->
cum_len
,
0
,
(
flags
&
AVIIF_INDEX
)
?
AVINDEX_KEYFRAME
:
0
);
av_add_index_entry
(
st
,
pos
,
ast
->
cum_len
,
len
,
0
,
(
flags
&
AVIIF_INDEX
)
?
AVINDEX_KEYFRAME
:
0
);
if
(
ast
->
sample_size
)
if
(
ast
->
sample_size
)
ast
->
cum_len
+=
len
/
ast
->
sample_size
;
ast
->
cum_len
+=
len
/
ast
->
sample_size
;
else
else
...
@@ -768,7 +772,6 @@ static int avi_load_index(AVFormatContext *s)
...
@@ -768,7 +772,6 @@ static int avi_load_index(AVFormatContext *s)
}
}
}
}
the_end
:
the_end
:
avi
->
non_interleaved
|=
guess_ni_flag
(
s
);
url_fseek
(
pb
,
pos
,
SEEK_SET
);
url_fseek
(
pb
,
pos
,
SEEK_SET
);
return
0
;
return
0
;
}
}
...
...
libavformat/mpeg.c
View file @
30a43f2d
...
@@ -1541,7 +1541,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
...
@@ -1541,7 +1541,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
int
i
;
int
i
;
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
){
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
){
if
(
startcode
==
s
->
streams
[
i
]
->
id
)
{
if
(
startcode
==
s
->
streams
[
i
]
->
id
)
{
av_add_index_entry
(
s
->
streams
[
i
],
*
ppos
,
dts
,
0
,
AVINDEX_KEYFRAME
/* FIXME keyframe? */
);
av_add_index_entry
(
s
->
streams
[
i
],
*
ppos
,
dts
,
0
,
0
,
AVINDEX_KEYFRAME
/* FIXME keyframe? */
);
}
}
}
}
}
}
...
...
libavformat/nut.c
View file @
30a43f2d
...
@@ -1192,6 +1192,7 @@ static int decode_frame_header(NUTContext *nut, int *key_frame_ret, int64_t *pts
...
@@ -1192,6 +1192,7 @@ static int decode_frame_header(NUTContext *nut, int *key_frame_ret, int64_t *pts
s
->
streams
[
stream_id
],
s
->
streams
[
stream_id
],
frame_start
,
frame_start
,
pts
,
pts
,
0
,
frame_start
-
nut
->
stream
[
stream_id
].
last_sync_pos
,
frame_start
-
nut
->
stream
[
stream_id
].
last_sync_pos
,
AVINDEX_KEYFRAME
);
AVINDEX_KEYFRAME
);
nut
->
stream
[
stream_id
].
last_sync_pos
=
frame_start
;
nut
->
stream
[
stream_id
].
last_sync_pos
=
frame_start
;
...
...
libavformat/rm.c
View file @
30a43f2d
...
@@ -982,7 +982,7 @@ resync:
...
@@ -982,7 +982,7 @@ resync:
if
(
flags
&
2
){
if
(
flags
&
2
){
pkt
->
flags
|=
PKT_FLAG_KEY
;
pkt
->
flags
|=
PKT_FLAG_KEY
;
if
((
seq
&
0x7F
)
==
1
)
if
((
seq
&
0x7F
)
==
1
)
av_add_index_entry
(
st
,
pos
,
timestamp
,
0
,
AVINDEX_KEYFRAME
);
av_add_index_entry
(
st
,
pos
,
timestamp
,
0
,
0
,
AVINDEX_KEYFRAME
);
}
}
}
}
...
@@ -1054,7 +1054,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
...
@@ -1054,7 +1054,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
if
((
flags
&
2
)
&&
(
seq
&
0x7F
)
==
1
){
if
((
flags
&
2
)
&&
(
seq
&
0x7F
)
==
1
){
// av_log(s, AV_LOG_DEBUG, "%d %d-%d %Ld %d\n", flags, stream_index2, stream_index, dts, seq);
// av_log(s, AV_LOG_DEBUG, "%d %d-%d %Ld %d\n", flags, stream_index2, stream_index, dts, seq);
av_add_index_entry
(
st
,
pos
,
dts
,
0
,
AVINDEX_KEYFRAME
);
av_add_index_entry
(
st
,
pos
,
dts
,
0
,
0
,
AVINDEX_KEYFRAME
);
if
(
stream_index2
==
stream_index
)
if
(
stream_index2
==
stream_index
)
break
;
break
;
}
}
...
...
libavformat/utils.c
View file @
30a43f2d
...
@@ -1131,7 +1131,7 @@ static void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t time
...
@@ -1131,7 +1131,7 @@ static void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t time
* @param timestamp timestamp in the timebase of the given stream
* @param timestamp timestamp in the timebase of the given stream
*/
*/
int
av_add_index_entry
(
AVStream
*
st
,
int
av_add_index_entry
(
AVStream
*
st
,
int64_t
pos
,
int64_t
timestamp
,
int
distance
,
int
flags
)
int64_t
pos
,
int64_t
timestamp
,
int
size
,
int
distance
,
int
flags
)
{
{
AVIndexEntry
*
entries
,
*
ie
;
AVIndexEntry
*
entries
,
*
ie
;
int
index
;
int
index
;
...
@@ -1168,6 +1168,7 @@ int av_add_index_entry(AVStream *st,
...
@@ -1168,6 +1168,7 @@ int av_add_index_entry(AVStream *st,
ie
->
pos
=
pos
;
ie
->
pos
=
pos
;
ie
->
timestamp
=
timestamp
;
ie
->
timestamp
=
timestamp
;
ie
->
min_distance
=
distance
;
ie
->
min_distance
=
distance
;
ie
->
size
=
size
;
ie
->
flags
=
flags
;
ie
->
flags
=
flags
;
return
index
;
return
index
;
...
@@ -1193,7 +1194,7 @@ static void av_build_index_raw(AVFormatContext *s)
...
@@ -1193,7 +1194,7 @@ static void av_build_index_raw(AVFormatContext *s)
if
(
pkt
->
stream_index
==
0
&&
st
->
parser
&&
if
(
pkt
->
stream_index
==
0
&&
st
->
parser
&&
(
pkt
->
flags
&
PKT_FLAG_KEY
))
{
(
pkt
->
flags
&
PKT_FLAG_KEY
))
{
av_add_index_entry
(
st
,
st
->
parser
->
frame_offset
,
pkt
->
dts
,
av_add_index_entry
(
st
,
st
->
parser
->
frame_offset
,
pkt
->
dts
,
0
,
AVINDEX_KEYFRAME
);
0
,
0
,
AVINDEX_KEYFRAME
);
}
}
av_free_packet
(
pkt
);
av_free_packet
(
pkt
);
}
}
...
...
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