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
b36bc81c
Commit
b36bc81c
authored
Sep 04, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avplay: add support for seeking to chapter marks
parent
f548f9f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
avplay.c
avplay.c
+33
-0
avplay.texi
doc/avplay.texi
+3
-0
No files found.
avplay.c
View file @
b36bc81c
...
...
@@ -2601,6 +2601,33 @@ static void toggle_audio_display(void)
}
}
static
void
seek_chapter
(
VideoState
*
is
,
int
incr
)
{
int64_t
pos
=
get_master_clock
(
is
)
*
AV_TIME_BASE
;
int
i
;
if
(
!
is
->
ic
->
nb_chapters
)
return
;
/* find the current chapter */
for
(
i
=
0
;
i
<
is
->
ic
->
nb_chapters
;
i
++
)
{
AVChapter
*
ch
=
is
->
ic
->
chapters
[
i
];
if
(
av_compare_ts
(
pos
,
AV_TIME_BASE_Q
,
ch
->
start
,
ch
->
time_base
)
<
0
)
{
i
--
;
break
;
}
}
i
+=
incr
;
i
=
FFMAX
(
i
,
0
);
if
(
i
>=
is
->
ic
->
nb_chapters
)
return
;
av_log
(
NULL
,
AV_LOG_VERBOSE
,
"Seeking to chapter %d.
\n
"
,
i
);
stream_seek
(
is
,
av_rescale_q
(
is
->
ic
->
chapters
[
i
]
->
start
,
is
->
ic
->
chapters
[
i
]
->
time_base
,
AV_TIME_BASE_Q
),
0
,
0
);
}
/* handle an event sent by the GUI */
static
void
event_loop
(
void
)
{
...
...
@@ -2646,6 +2673,12 @@ static void event_loop(void)
case
SDLK_w
:
toggle_audio_display
();
break
;
case
SDLK_PAGEUP
:
seek_chapter
(
cur_stream
,
1
);
break
;
case
SDLK_PAGEDOWN
:
seek_chapter
(
cur_stream
,
-
1
);
break
;
case
SDLK_LEFT
:
incr
=
-
10
.
0
;
goto
do_seek
;
...
...
doc/avplay.texi
View file @
b36bc81c
...
...
@@ -147,6 +147,9 @@ Seek backward/forward 10 seconds.
@item down/up
Seek backward/forward 1 minute.
@item PGDOWN/PGUP
Seek to the previous/next chapter.
@item mouse click
Seek to percentage in file corresponding to fraction of width.
...
...
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