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
37e85dac
Commit
37e85dac
authored
Dec 06, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seeking in rm 2nd try
Originally committed as revision 3738 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
bc17df09
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
17 deletions
+31
-17
rm.c
libavformat/rm.c
+31
-17
No files found.
libavformat/rm.c
View file @
37e85dac
...
@@ -720,13 +720,14 @@ static int get_num(ByteIOContext *pb, int *len)
...
@@ -720,13 +720,14 @@ static int get_num(ByteIOContext *pb, int *len)
/* multiple of 20 bytes for ra144 (ugly) */
/* multiple of 20 bytes for ra144 (ugly) */
#define RAW_PACKET_SIZE 1000
#define RAW_PACKET_SIZE 1000
static
int
sync
(
AVFormatContext
*
s
,
int64_t
*
timestamp
,
int
*
flags
,
int
*
stream_index
){
static
int
sync
(
AVFormatContext
*
s
,
int64_t
*
timestamp
,
int
*
flags
,
int
*
stream_index
,
int64_t
*
pos
){
RMContext
*
rm
=
s
->
priv_data
;
RMContext
*
rm
=
s
->
priv_data
;
ByteIOContext
*
pb
=
&
s
->
pb
;
ByteIOContext
*
pb
=
&
s
->
pb
;
int
len
,
num
,
res
,
i
;
int
len
,
num
,
res
,
i
;
AVStream
*
st
;
AVStream
*
st
;
while
(
!
url_feof
(
pb
)){
while
(
!
url_feof
(
pb
)){
*
pos
=
url_ftell
(
pb
);
if
(
rm
->
remaining_len
>
0
){
if
(
rm
->
remaining_len
>
0
){
num
=
rm
->
current_stream
;
num
=
rm
->
current_stream
;
len
=
rm
->
remaining_len
;
len
=
rm
->
remaining_len
;
...
@@ -744,8 +745,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
...
@@ -744,8 +745,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
*
timestamp
=
get_be32
(
pb
);
*
timestamp
=
get_be32
(
pb
);
res
=
get_byte
(
pb
);
/* reserved */
res
=
get_byte
(
pb
);
/* reserved */
*
flags
=
get_byte
(
pb
);
/* flags */
*
flags
=
get_byte
(
pb
);
/* flags */
// av_log(s, AV_LOG_DEBUG, "%d %Ld %X %X\n", num, *timestamp, *flags, res);
len
-=
12
;
len
-=
12
;
}
}
...
@@ -773,7 +773,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -773,7 +773,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
ByteIOContext
*
pb
=
&
s
->
pb
;
ByteIOContext
*
pb
=
&
s
->
pb
;
AVStream
*
st
;
AVStream
*
st
;
int
i
,
len
,
tmp
,
j
;
int
i
,
len
,
tmp
,
j
;
int64_t
timestamp
;
int64_t
timestamp
,
pos
;
uint8_t
*
ptr
;
uint8_t
*
ptr
;
int
flags
;
int
flags
;
...
@@ -790,7 +790,9 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -790,7 +790,9 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt
->
size
=
len
;
pkt
->
size
=
len
;
st
=
s
->
streams
[
0
];
st
=
s
->
streams
[
0
];
}
else
{
}
else
{
len
=
sync
(
s
,
&
timestamp
,
&
flags
,
&
i
);
int
seq
=
1
;
len
=
sync
(
s
,
&
timestamp
,
&
flags
,
&
i
,
&
pos
);
if
(
len
<
0
)
if
(
len
<
0
)
return
AVERROR_IO
;
return
AVERROR_IO
;
st
=
s
->
streams
[
i
];
st
=
s
->
streams
[
i
];
...
@@ -800,8 +802,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -800,8 +802,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
h
=
get_byte
(
pb
);
len
--
;
h
=
get_byte
(
pb
);
len
--
;
if
(
!
(
h
&
0x40
)){
if
(
!
(
h
&
0x40
)){
int
seq
=
get_byte
(
pb
);
seq
=
get_byte
(
pb
);
len
--
;
len
--
;
}
}
if
((
h
&
0xc0
)
==
0x40
){
if
((
h
&
0xc0
)
==
0x40
){
...
@@ -838,8 +839,11 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -838,8 +839,11 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
}
}
#endif
#endif
pkt
->
pts
=
timestamp
;
pkt
->
pts
=
timestamp
;
if
(
flags
&
2
)
if
(
flags
&
2
)
{
pkt
->
flags
|=
PKT_FLAG_KEY
;
pkt
->
flags
|=
PKT_FLAG_KEY
;
if
((
seq
&
0x7F
)
==
1
)
av_add_index_entry
(
st
,
pos
,
timestamp
,
0
,
AVINDEX_KEYFRAME
);
}
}
}
/* for AC3, needs to swap bytes */
/* for AC3, needs to swap bytes */
...
@@ -880,7 +884,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
...
@@ -880,7 +884,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
{
{
RMContext
*
rm
=
s
->
priv_data
;
RMContext
*
rm
=
s
->
priv_data
;
int64_t
pos
,
dts
;
int64_t
pos
,
dts
;
int
stream_index2
,
flags
,
len
;
int
stream_index2
,
flags
,
len
,
h
;
pos
=
*
ppos
;
pos
=
*
ppos
;
...
@@ -890,18 +894,28 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
...
@@ -890,18 +894,28 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
url_fseek
(
&
s
->
pb
,
pos
,
SEEK_SET
);
url_fseek
(
&
s
->
pb
,
pos
,
SEEK_SET
);
rm
->
remaining_len
=
0
;
rm
->
remaining_len
=
0
;
for
(;;){
for
(;;){
pos
=
url_ftell
(
&
s
->
pb
);
int
seq
=
1
;
len
=
sync
(
s
,
&
dts
,
&
flags
,
&
stream_index2
);
AVStream
*
st
;
len
=
sync
(
s
,
&
dts
,
&
flags
,
&
stream_index2
,
&
pos
);
if
(
len
<
0
)
if
(
len
<
0
)
return
AV_NOPTS_VALUE
;
return
AV_NOPTS_VALUE
;
av_log
(
s
,
AV_LOG_DEBUG
,
"%d %d-%d %Ld
\n
"
,
flags
,
stream_index2
,
stream_index
,
dts
);
if
(
flags
&
2
){
st
=
s
->
streams
[
stream_index2
];
av_add_index_entry
(
s
->
streams
[
stream_index2
],
pos
,
dts
,
0
,
AVINDEX_KEYFRAME
);
if
(
st
->
codec
.
codec_type
==
CODEC_TYPE_VIDEO
)
{
if
(
stream_index2
==
stream_index
){
h
=
get_byte
(
&
s
->
pb
);
len
--
;
break
;
if
(
!
(
h
&
0x40
)){
seq
=
get_byte
(
&
s
->
pb
);
len
--
;
}
}
}
}
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_add_index_entry
(
st
,
pos
,
dts
,
0
,
AVINDEX_KEYFRAME
);
if
(
stream_index2
==
stream_index
)
break
;
}
url_fskip
(
&
s
->
pb
,
len
);
url_fskip
(
&
s
->
pb
,
len
);
}
}
*
ppos
=
pos
;
*
ppos
=
pos
;
...
...
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