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
465aa53f
Commit
465aa53f
authored
Jul 30, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asfdec: move packet_obj_size to ASFStream
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
cb6d02df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
asf.h
libavformat/asf.h
+1
-0
asfdec.c
libavformat/asfdec.c
+14
-15
No files found.
libavformat/asf.h
View file @
465aa53f
...
...
@@ -39,6 +39,7 @@ typedef struct ASFStream {
/* use for reading */
AVPacket
pkt
;
int
frag_offset
;
int
packet_obj_size
;
int
timestamp
;
int64_t
duration
;
...
...
libavformat/asfdec.c
View file @
465aa53f
...
...
@@ -67,7 +67,6 @@ typedef struct {
unsigned
int
packet_frag_size
;
int64_t
packet_frag_timestamp
;
int
packet_multi_size
;
int
packet_obj_size
;
int
packet_time_delta
;
int
packet_time_start
;
int64_t
packet_pos
;
...
...
@@ -1006,10 +1005,10 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb)
if
(
asf
->
packet_replic_size
>=
8
)
{
int64_t
end
=
avio_tell
(
pb
)
+
asf
->
packet_replic_size
;
AVRational
aspect
;
asf
->
packet_obj_size
=
avio_rl32
(
pb
);
if
(
asf
->
packet_obj_size
>=
(
1
<<
24
)
||
asf
->
packet_obj_size
<=
0
)
{
asf
st
->
packet_obj_size
=
avio_rl32
(
pb
);
if
(
asf
st
->
packet_obj_size
>=
(
1
<<
24
)
||
asfst
->
packet_obj_size
<=
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"packet_obj_size invalid
\n
"
);
asf
->
packet_obj_size
=
0
;
asf
st
->
packet_obj_size
=
0
;
return
AVERROR_INVALIDDATA
;
}
asf
->
packet_frag_timestamp
=
avio_rl32
(
pb
);
// timestamp
...
...
@@ -1157,37 +1156,37 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
// frag_offset is here used as the beginning timestamp
asf
->
packet_frag_timestamp
=
asf
->
packet_time_start
;
asf
->
packet_time_start
+=
asf
->
packet_time_delta
;
asf
->
packet_obj_size
=
asf
->
packet_frag_size
=
avio_r8
(
pb
);
asf
_st
->
packet_obj_size
=
asf
->
packet_frag_size
=
avio_r8
(
pb
);
asf
->
packet_size_left
--
;
asf
->
packet_multi_size
--
;
if
(
asf
->
packet_multi_size
<
asf
->
packet_obj_size
)
{
if
(
asf
->
packet_multi_size
<
asf
_st
->
packet_obj_size
)
{
asf
->
packet_time_start
=
0
;
avio_skip
(
pb
,
asf
->
packet_multi_size
);
asf
->
packet_size_left
-=
asf
->
packet_multi_size
;
continue
;
}
asf
->
packet_multi_size
-=
asf
->
packet_obj_size
;
asf
->
packet_multi_size
-=
asf
_st
->
packet_obj_size
;
}
if
(
asf_st
->
frag_offset
+
asf
->
packet_frag_size
<=
asf_st
->
pkt
.
size
&&
asf_st
->
frag_offset
+
asf
->
packet_frag_size
>
asf
->
packet_obj_size
)
{
asf_st
->
frag_offset
+
asf
->
packet_frag_size
>
asf
_st
->
packet_obj_size
)
{
av_log
(
s
,
AV_LOG_INFO
,
"ignoring invalid packet_obj_size (%d %d %d %d)
\n
"
,
asf_st
->
frag_offset
,
asf
->
packet_frag_size
,
asf
->
packet_obj_size
,
asf_st
->
pkt
.
size
);
asf
->
packet_obj_size
=
asf_st
->
pkt
.
size
;
asf
_st
->
packet_obj_size
,
asf_st
->
pkt
.
size
);
asf
_st
->
packet_obj_size
=
asf_st
->
pkt
.
size
;
}
if
(
asf_st
->
pkt
.
size
!=
asf
->
packet_obj_size
||
if
(
asf_st
->
pkt
.
size
!=
asf
_st
->
packet_obj_size
||
// FIXME is this condition sufficient?
asf_st
->
frag_offset
+
asf
->
packet_frag_size
>
asf_st
->
pkt
.
size
)
{
if
(
asf_st
->
pkt
.
data
)
{
av_log
(
s
,
AV_LOG_INFO
,
"freeing incomplete packet size %d, new %d
\n
"
,
asf_st
->
pkt
.
size
,
asf
->
packet_obj_size
);
asf_st
->
pkt
.
size
,
asf
_st
->
packet_obj_size
);
asf_st
->
frag_offset
=
0
;
av_free_packet
(
&
asf_st
->
pkt
);
}
/* new packet */
av_new_packet
(
&
asf_st
->
pkt
,
asf
->
packet_obj_size
);
av_new_packet
(
&
asf_st
->
pkt
,
asf
_st
->
packet_obj_size
);
asf_st
->
seq
=
asf
->
packet_seq
;
asf_st
->
pkt
.
dts
=
asf
->
packet_frag_timestamp
-
asf
->
hdr
.
preroll
;
asf_st
->
pkt
.
stream_index
=
asf
->
stream_index
;
...
...
@@ -1208,7 +1207,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
asf
->
stream_index
,
asf
->
packet_key_frame
,
asf_st
->
pkt
.
flags
&
AV_PKT_FLAG_KEY
,
s
->
streams
[
asf
->
stream_index
]
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
,
asf
->
packet_obj_size
);
asf
_st
->
packet_obj_size
);
if
(
s
->
streams
[
asf
->
stream_index
]
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
asf
->
packet_key_frame
=
1
;
if
(
asf
->
packet_key_frame
)
...
...
@@ -1361,13 +1360,13 @@ static void asf_reset_header(AVFormatContext *s)
asf
->
packet_frag_size
=
0
;
asf
->
packet_frag_timestamp
=
0
;
asf
->
packet_multi_size
=
0
;
asf
->
packet_obj_size
=
0
;
asf
->
packet_time_delta
=
0
;
asf
->
packet_time_start
=
0
;
for
(
i
=
0
;
i
<
128
;
i
++
)
{
asf_st
=
&
asf
->
streams
[
i
];
av_free_packet
(
&
asf_st
->
pkt
);
asf_st
->
packet_obj_size
=
0
;
asf_st
->
frag_offset
=
0
;
asf_st
->
seq
=
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