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
ba571f6b
Commit
ba571f6b
authored
Aug 21, 2011
by
Marton Balint
Committed by
Michael Niedermayer
Aug 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: remove unnecessary if (cur_stream) checks
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
84506ebd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
61 deletions
+49
-61
ffplay.c
ffplay.c
+49
-61
No files found.
ffplay.c
View file @
ba571f6b
...
...
@@ -2694,28 +2694,22 @@ static void event_loop(VideoState *cur_stream)
break
;
case
SDLK_p
:
case
SDLK_SPACE
:
if
(
cur_stream
)
toggle_pause
(
cur_stream
);
toggle_pause
(
cur_stream
);
break
;
case
SDLK_s
:
//S: Step to next frame
if
(
cur_stream
)
step_to_next_frame
(
cur_stream
);
step_to_next_frame
(
cur_stream
);
break
;
case
SDLK_a
:
if
(
cur_stream
)
stream_cycle_channel
(
cur_stream
,
AVMEDIA_TYPE_AUDIO
);
stream_cycle_channel
(
cur_stream
,
AVMEDIA_TYPE_AUDIO
);
break
;
case
SDLK_v
:
if
(
cur_stream
)
stream_cycle_channel
(
cur_stream
,
AVMEDIA_TYPE_VIDEO
);
stream_cycle_channel
(
cur_stream
,
AVMEDIA_TYPE_VIDEO
);
break
;
case
SDLK_t
:
if
(
cur_stream
)
stream_cycle_channel
(
cur_stream
,
AVMEDIA_TYPE_SUBTITLE
);
stream_cycle_channel
(
cur_stream
,
AVMEDIA_TYPE_SUBTITLE
);
break
;
case
SDLK_w
:
if
(
cur_stream
)
toggle_audio_display
(
cur_stream
);
toggle_audio_display
(
cur_stream
);
break
;
case
SDLK_LEFT
:
incr
=
-
10
.
0
;
...
...
@@ -2729,25 +2723,23 @@ static void event_loop(VideoState *cur_stream)
case
SDLK_DOWN
:
incr
=
-
60
.
0
;
do_seek:
if
(
cur_stream
)
{
if
(
seek_by_bytes
)
{
if
(
cur_stream
->
video_stream
>=
0
&&
cur_stream
->
video_current_pos
>=
0
){
pos
=
cur_stream
->
video_current_pos
;
}
else
if
(
cur_stream
->
audio_stream
>=
0
&&
cur_stream
->
audio_pkt
.
pos
>=
0
){
pos
=
cur_stream
->
audio_pkt
.
pos
;
}
else
pos
=
avio_tell
(
cur_stream
->
ic
->
pb
);
if
(
cur_stream
->
ic
->
bit_rate
)
incr
*=
cur_stream
->
ic
->
bit_rate
/
8
.
0
;
else
incr
*=
180000
.
0
;
pos
+=
incr
;
stream_seek
(
cur_stream
,
pos
,
incr
,
1
);
}
else
{
pos
=
get_master_clock
(
cur_stream
);
pos
+=
incr
;
stream_seek
(
cur_stream
,
(
int64_t
)(
pos
*
AV_TIME_BASE
),
(
int64_t
)(
incr
*
AV_TIME_BASE
),
0
);
}
if
(
seek_by_bytes
)
{
if
(
cur_stream
->
video_stream
>=
0
&&
cur_stream
->
video_current_pos
>=
0
){
pos
=
cur_stream
->
video_current_pos
;
}
else
if
(
cur_stream
->
audio_stream
>=
0
&&
cur_stream
->
audio_pkt
.
pos
>=
0
){
pos
=
cur_stream
->
audio_pkt
.
pos
;
}
else
pos
=
avio_tell
(
cur_stream
->
ic
->
pb
);
if
(
cur_stream
->
ic
->
bit_rate
)
incr
*=
cur_stream
->
ic
->
bit_rate
/
8
.
0
;
else
incr
*=
180000
.
0
;
pos
+=
incr
;
stream_seek
(
cur_stream
,
pos
,
incr
,
1
);
}
else
{
pos
=
get_master_clock
(
cur_stream
);
pos
+=
incr
;
stream_seek
(
cur_stream
,
(
int64_t
)(
pos
*
AV_TIME_BASE
),
(
int64_t
)(
incr
*
AV_TIME_BASE
),
0
);
}
break
;
default:
...
...
@@ -2767,39 +2759,35 @@ static void event_loop(VideoState *cur_stream)
break
;
x
=
event
.
motion
.
x
;
}
if
(
cur_stream
)
{
if
(
seek_by_bytes
||
cur_stream
->
ic
->
duration
<=
0
){
uint64_t
size
=
avio_size
(
cur_stream
->
ic
->
pb
);
stream_seek
(
cur_stream
,
size
*
x
/
cur_stream
->
width
,
0
,
1
);
}
else
{
int64_t
ts
;
int
ns
,
hh
,
mm
,
ss
;
int
tns
,
thh
,
tmm
,
tss
;
tns
=
cur_stream
->
ic
->
duration
/
1000000LL
;
thh
=
tns
/
3600
;
tmm
=
(
tns
%
3600
)
/
60
;
tss
=
(
tns
%
60
);
frac
=
x
/
cur_stream
->
width
;
ns
=
frac
*
tns
;
hh
=
ns
/
3600
;
mm
=
(
ns
%
3600
)
/
60
;
ss
=
(
ns
%
60
);
fprintf
(
stderr
,
"Seek to %2.0f%% (%2d:%02d:%02d) of total duration (%2d:%02d:%02d)
\n
"
,
frac
*
100
,
hh
,
mm
,
ss
,
thh
,
tmm
,
tss
);
ts
=
frac
*
cur_stream
->
ic
->
duration
;
if
(
cur_stream
->
ic
->
start_time
!=
AV_NOPTS_VALUE
)
ts
+=
cur_stream
->
ic
->
start_time
;
stream_seek
(
cur_stream
,
ts
,
0
,
0
);
}
if
(
seek_by_bytes
||
cur_stream
->
ic
->
duration
<=
0
){
uint64_t
size
=
avio_size
(
cur_stream
->
ic
->
pb
);
stream_seek
(
cur_stream
,
size
*
x
/
cur_stream
->
width
,
0
,
1
);
}
else
{
int64_t
ts
;
int
ns
,
hh
,
mm
,
ss
;
int
tns
,
thh
,
tmm
,
tss
;
tns
=
cur_stream
->
ic
->
duration
/
1000000LL
;
thh
=
tns
/
3600
;
tmm
=
(
tns
%
3600
)
/
60
;
tss
=
(
tns
%
60
);
frac
=
x
/
cur_stream
->
width
;
ns
=
frac
*
tns
;
hh
=
ns
/
3600
;
mm
=
(
ns
%
3600
)
/
60
;
ss
=
(
ns
%
60
);
fprintf
(
stderr
,
"Seek to %2.0f%% (%2d:%02d:%02d) of total duration (%2d:%02d:%02d)
\n
"
,
frac
*
100
,
hh
,
mm
,
ss
,
thh
,
tmm
,
tss
);
ts
=
frac
*
cur_stream
->
ic
->
duration
;
if
(
cur_stream
->
ic
->
start_time
!=
AV_NOPTS_VALUE
)
ts
+=
cur_stream
->
ic
->
start_time
;
stream_seek
(
cur_stream
,
ts
,
0
,
0
);
}
break
;
case
SDL_VIDEORESIZE
:
if
(
cur_stream
)
{
screen
=
SDL_SetVideoMode
(
event
.
resize
.
w
,
event
.
resize
.
h
,
0
,
SDL_HWSURFACE
|
SDL_RESIZABLE
|
SDL_ASYNCBLIT
|
SDL_HWACCEL
);
screen_width
=
cur_stream
->
width
=
event
.
resize
.
w
;
screen_height
=
cur_stream
->
height
=
event
.
resize
.
h
;
}
screen
=
SDL_SetVideoMode
(
event
.
resize
.
w
,
event
.
resize
.
h
,
0
,
SDL_HWSURFACE
|
SDL_RESIZABLE
|
SDL_ASYNCBLIT
|
SDL_HWACCEL
);
screen_width
=
cur_stream
->
width
=
event
.
resize
.
w
;
screen_height
=
cur_stream
->
height
=
event
.
resize
.
h
;
break
;
case
SDL_QUIT
:
case
FF_QUIT_EVENT
:
...
...
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