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
9a39c544
Commit
9a39c544
authored
Nov 24, 2018
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: convert float math to int math in calculate_display_rect
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
2a08faba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
ffplay.c
fftools/ffplay.c
+9
-13
No files found.
fftools/ffplay.c
View file @
9a39c544
...
...
@@ -861,31 +861,27 @@ static void calculate_display_rect(SDL_Rect *rect,
int
scr_xleft
,
int
scr_ytop
,
int
scr_width
,
int
scr_height
,
int
pic_width
,
int
pic_height
,
AVRational
pic_sar
)
{
float
aspect_ratio
;
int
width
,
height
,
x
,
y
;
AVRational
aspect_ratio
=
pic_sar
;
int
64_t
width
,
height
,
x
,
y
;
if
(
pic_sar
.
num
==
0
)
aspect_ratio
=
0
;
else
aspect_ratio
=
av_q2d
(
pic_sar
);
if
(
av_cmp_q
(
aspect_ratio
,
av_make_q
(
0
,
1
))
<=
0
)
aspect_ratio
=
av_make_q
(
1
,
1
);
if
(
aspect_ratio
<=
0
.
0
)
aspect_ratio
=
1
.
0
;
aspect_ratio
*=
(
float
)
pic_width
/
(
float
)
pic_height
;
aspect_ratio
=
av_mul_q
(
aspect_ratio
,
av_make_q
(
pic_width
,
pic_height
));
/* XXX: we suppose the screen has a 1.0 pixel ratio */
height
=
scr_height
;
width
=
lrint
(
height
*
aspect_ratio
)
&
~
1
;
width
=
av_rescale
(
height
,
aspect_ratio
.
num
,
aspect_ratio
.
den
)
&
~
1
;
if
(
width
>
scr_width
)
{
width
=
scr_width
;
height
=
lrint
(
width
/
aspect_ratio
)
&
~
1
;
height
=
av_rescale
(
width
,
aspect_ratio
.
den
,
aspect_ratio
.
num
)
&
~
1
;
}
x
=
(
scr_width
-
width
)
/
2
;
y
=
(
scr_height
-
height
)
/
2
;
rect
->
x
=
scr_xleft
+
x
;
rect
->
y
=
scr_ytop
+
y
;
rect
->
w
=
FFMAX
(
width
,
1
);
rect
->
h
=
FFMAX
(
height
,
1
);
rect
->
w
=
FFMAX
(
(
int
)
width
,
1
);
rect
->
h
=
FFMAX
(
(
int
)
height
,
1
);
}
static
void
get_sdl_pix_fmt_and_blendmode
(
int
format
,
Uint32
*
sdl_pix_fmt
,
SDL_BlendMode
*
sdl_blendmode
)
...
...
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