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
c012c6f1
Commit
c012c6f1
authored
Nov 05, 2015
by
Paul B Mahol
Committed by
Vittorio Giovara
Nov 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
segafilm: implement seeking
Signed-off-by:
Vittorio Giovara
<
vittorio.giovara@gmail.com
>
parent
2ec112f7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
segafilm.c
libavformat/segafilm.c
+23
-0
No files found.
libavformat/segafilm.c
View file @
c012c6f1
...
...
@@ -240,6 +240,11 @@ static int film_read_header(AVFormatContext *s)
film
->
sample_table
[
i
].
stream
=
film
->
video_stream_index
;
film
->
sample_table
[
i
].
pts
=
AV_RB32
(
&
scratch
[
8
])
&
0x7FFFFFFF
;
film
->
sample_table
[
i
].
keyframe
=
(
scratch
[
8
]
&
0x80
)
?
0
:
1
;
av_add_index_entry
(
s
->
streams
[
film
->
video_stream_index
],
film
->
sample_table
[
i
].
sample_offset
,
film
->
sample_table
[
i
].
pts
,
film
->
sample_table
[
i
].
sample_size
,
0
,
film
->
sample_table
[
i
].
keyframe
);
}
}
...
...
@@ -288,6 +293,23 @@ static int film_read_packet(AVFormatContext *s,
return
ret
;
}
static
int
film_read_seek
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
timestamp
,
int
flags
)
{
FilmDemuxContext
*
film
=
s
->
priv_data
;
AVStream
*
st
=
s
->
streams
[
stream_index
];
int
ret
=
av_index_search_timestamp
(
st
,
timestamp
,
flags
);
if
(
ret
<
0
)
return
ret
;
ret
=
avio_seek
(
s
->
pb
,
st
->
index_entries
[
ret
].
pos
,
SEEK_SET
);
if
(
ret
<
0
)
return
ret
;
film
->
current_sample
=
ret
;
return
0
;
}
AVInputFormat
ff_segafilm_demuxer
=
{
.
name
=
"film_cpk"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Sega FILM / CPK"
),
...
...
@@ -296,4 +318,5 @@ AVInputFormat ff_segafilm_demuxer = {
.
read_header
=
film_read_header
,
.
read_packet
=
film_read_packet
,
.
read_close
=
film_read_close
,
.
read_seek
=
film_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