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
16437648
Commit
16437648
authored
May 24, 2014
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: use frame queue to determine last used pos
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
5a5128ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
ffplay.c
ffplay.c
+15
-7
No files found.
ffplay.c
View file @
16437648
...
@@ -263,7 +263,6 @@ typedef struct VideoState {
...
@@ -263,7 +263,6 @@ typedef struct VideoState {
int
video_stream
;
int
video_stream
;
AVStream
*
video_st
;
AVStream
*
video_st
;
PacketQueue
videoq
;
PacketQueue
videoq
;
int64_t
video_current_pos
;
// current displayed file pos
double
max_frame_duration
;
// maximum duration of a frame - above this, we consider the jump a timestamp discontinuity
double
max_frame_duration
;
// maximum duration of a frame - above this, we consider the jump a timestamp discontinuity
#if !CONFIG_AVFILTER
#if !CONFIG_AVFILTER
struct
SwsContext
*
img_convert_ctx
;
struct
SwsContext
*
img_convert_ctx
;
...
@@ -637,6 +636,16 @@ static int frame_queue_nb_remaining(FrameQueue *f)
...
@@ -637,6 +636,16 @@ static int frame_queue_nb_remaining(FrameQueue *f)
return
f
->
size
-
f
->
rindex_shown
;
return
f
->
size
-
f
->
rindex_shown
;
}
}
/* return last shown position */
static
int64_t
frame_queue_last_pos
(
FrameQueue
*
f
)
{
Frame
*
fp
=
&
f
->
queue
[
f
->
rindex
];
if
(
f
->
rindex_shown
&&
fp
->
serial
==
f
->
pktq
->
serial
)
return
fp
->
pos
;
else
return
-
1
;
}
static
inline
void
fill_rectangle
(
SDL_Surface
*
screen
,
static
inline
void
fill_rectangle
(
SDL_Surface
*
screen
,
int
x
,
int
y
,
int
w
,
int
h
,
int
color
,
int
update
)
int
x
,
int
y
,
int
w
,
int
h
,
int
color
,
int
update
)
{
{
...
@@ -1432,7 +1441,6 @@ static void update_video_pts(VideoState *is, double pts, int64_t pos, int serial
...
@@ -1432,7 +1441,6 @@ static void update_video_pts(VideoState *is, double pts, int64_t pos, int serial
/* update current video pts */
/* update current video pts */
set_clock
(
&
is
->
vidclk
,
pts
,
serial
);
set_clock
(
&
is
->
vidclk
,
pts
,
serial
);
sync_clock_to_slave
(
&
is
->
extclk
,
&
is
->
vidclk
);
sync_clock_to_slave
(
&
is
->
extclk
,
&
is
->
vidclk
);
is
->
video_current_pos
=
pos
;
}
}
/* called to display each frame */
/* called to display each frame */
...
@@ -1472,7 +1480,6 @@ retry:
...
@@ -1472,7 +1480,6 @@ retry:
if
(
vp
->
serial
!=
is
->
videoq
.
serial
)
{
if
(
vp
->
serial
!=
is
->
videoq
.
serial
)
{
frame_queue_next
(
&
is
->
pictq
);
frame_queue_next
(
&
is
->
pictq
);
is
->
video_current_pos
=
-
1
;
redisplay
=
0
;
redisplay
=
0
;
goto
retry
;
goto
retry
;
}
}
...
@@ -3385,11 +3392,12 @@ static void event_loop(VideoState *cur_stream)
...
@@ -3385,11 +3392,12 @@ static void event_loop(VideoState *cur_stream)
incr
=
-
60
.
0
;
incr
=
-
60
.
0
;
do_seek:
do_seek:
if
(
seek_by_bytes
)
{
if
(
seek_by_bytes
)
{
if
(
cur_stream
->
video_stream
>=
0
&&
cur_stream
->
video_current_pos
>=
0
)
{
pos
=
-
1
;
pos
=
cur_stream
->
video_current_pos
;
if
(
pos
<
0
&&
cur_stream
->
video_stream
>=
0
)
}
else
if
(
cur_stream
->
audio_stream
>=
0
&&
cur_stream
->
audio_pkt
.
pos
>=
0
)
{
pos
=
frame_queue_last_pos
(
&
cur_stream
->
pictq
);
if
(
pos
<
0
&&
cur_stream
->
audio_stream
>=
0
)
pos
=
cur_stream
->
audio_pkt
.
pos
;
pos
=
cur_stream
->
audio_pkt
.
pos
;
}
else
if
(
pos
<
0
)
pos
=
avio_tell
(
cur_stream
->
ic
->
pb
);
pos
=
avio_tell
(
cur_stream
->
ic
->
pb
);
if
(
cur_stream
->
ic
->
bit_rate
)
if
(
cur_stream
->
ic
->
bit_rate
)
incr
*=
cur_stream
->
ic
->
bit_rate
/
8
.
0
;
incr
*=
cur_stream
->
ic
->
bit_rate
/
8
.
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