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
3a6ccf4f
Commit
3a6ccf4f
authored
Sep 29, 2006
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rudimentary binary seek
Originally committed as revision 6382 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
1159f634
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
mxf.c
libavformat/mxf.c
+30
-1
No files found.
libavformat/mxf.c
View file @
3a6ccf4f
...
...
@@ -976,6 +976,35 @@ static int mxf_probe(AVProbeData *p) {
return
0
;
}
/* rudimentary binary seek */
/* XXX: use MXF Index */
static
int
mxf_read_seek
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
sample_time
,
int
flags
)
{
AVStream
*
st
=
s
->
streams
[
stream_index
];
offset_t
pos
=
url_ftell
(
&
s
->
pb
);
int64_t
seconds
;
int
i
;
if
(
!
s
->
bit_rate
||
sample_time
<
0
)
return
-
1
;
seconds
=
av_rescale
(
sample_time
,
st
->
time_base
.
num
,
st
->
time_base
.
den
);
url_fseek
(
&
s
->
pb
,
(
s
->
bit_rate
*
seconds
)
>>
3
,
SEEK_SET
);
/* sync on KLV essence element */
for
(
i
=
0
;
i
<
12
&&
url_ftell
(
&
s
->
pb
)
<
s
->
file_size
;
i
++
)
{
int
b
=
get_byte
(
&
s
->
pb
);
if
(
b
==
mxf_essence_element_key
[
0
])
i
=
0
;
else
if
(
b
!=
mxf_essence_element_key
[
i
])
i
=
-
1
;
}
if
(
i
==
12
)
{
/* found KLV key */
url_fseek
(
&
s
->
pb
,
-
12
,
SEEK_CUR
);
av_update_cur_dts
(
s
,
st
,
sample_time
);
return
0
;
}
url_fseek
(
&
s
->
pb
,
pos
,
SEEK_SET
);
return
-
1
;
}
AVInputFormat
mxf_demuxer
=
{
"mxf"
,
...
...
@@ -985,5 +1014,5 @@ AVInputFormat mxf_demuxer = {
mxf_read_header
,
mxf_read_packet
,
mxf_read_close
,
NULL
,
mxf_read_seek
,
};
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