Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
536
Issue boards
Milestones
Wiki
Code
Merge requests
19
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
34aa12ef
Commit
34aa12ef
authored
2 years ago
by
Nicolas Pomepuy
Browse files
Options
Downloads
Patches
Plain Diff
Improve libvlc aspect ratios
parent
1346e5dd
No related branches found
No related tags found
1 merge request
!1221
Implement ML 0.11.x API changes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libvlc/src/org/videolan/libvlc/MediaPlayer.java
+26
-6
26 additions, 6 deletions
libvlc/src/org/videolan/libvlc/MediaPlayer.java
libvlc/src/org/videolan/libvlc/VideoHelper.java
+25
-12
25 additions, 12 deletions
libvlc/src/org/videolan/libvlc/VideoHelper.java
with
51 additions
and
18 deletions
libvlc/src/org/videolan/libvlc/MediaPlayer.java
+
26
−
6
View file @
34aa12ef
...
...
@@ -393,12 +393,32 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
//Video size constants
public
enum
ScaleType
{
SURFACE_BEST_FIT
,
SURFACE_FIT_SCREEN
,
SURFACE_FILL
,
SURFACE_16_9
,
SURFACE_4_3
,
SURFACE_ORIGINAL
SURFACE_BEST_FIT
(
null
),
SURFACE_FIT_SCREEN
(
null
),
SURFACE_FILL
(
null
),
SURFACE_16_9
(
16
F
/
9
F
),
SURFACE_4_3
(
4
F
/
3
F
),
SURFACE_16_10
(
16
F
/
10
F
),
SURFACE_221_1
(
2.21
F
),
SURFACE_235_1
(
2.35
F
),
SURFACE_239_1
(
2.39
F
),
SURFACE_5_4
(
5
F
/
4
F
),
SURFACE_ORIGINAL
(
null
);
private
final
Float
ratio
;
ScaleType
(
Float
ratio
)
{
this
.
ratio
=
ratio
;
}
public
Float
getRatio
()
{
return
ratio
;
}
static
public
ScaleType
[]
getMainScaleTypes
()
{
return
new
ScaleType
[]{
SURFACE_BEST_FIT
,
SURFACE_FIT_SCREEN
,
SURFACE_FILL
,
SURFACE_16_9
,
SURFACE_4_3
,
SURFACE_ORIGINAL
};
}
}
public
static
final
int
SURFACE_SCALES_COUNT
=
ScaleType
.
values
().
length
;
...
...
This diff is collapsed.
Click to expand it.
libvlc/src/org/videolan/libvlc/VideoHelper.java
+
25
−
12
View file @
34aa12ef
...
...
@@ -175,6 +175,26 @@ class VideoHelper implements IVLCVout.OnNewVideoLayoutListener {
mMediaPlayer
.
setAspectRatio
(
"16:9"
);
mMediaPlayer
.
setScale
(
0
);
break
;
case
SURFACE_16_10:
mMediaPlayer
.
setAspectRatio
(
"16:10"
);
mMediaPlayer
.
setScale
(
0
);
break
;
case
SURFACE_221_1:
mMediaPlayer
.
setAspectRatio
(
"2.21:1"
);
mMediaPlayer
.
setScale
(
0
);
break
;
case
SURFACE_235_1:
mMediaPlayer
.
setAspectRatio
(
"2.35:1"
);
mMediaPlayer
.
setScale
(
0
);
break
;
case
SURFACE_239_1:
mMediaPlayer
.
setAspectRatio
(
"2.39:1"
);
mMediaPlayer
.
setScale
(
0
);
break
;
case
SURFACE_5_4:
mMediaPlayer
.
setAspectRatio
(
"5:4"
);
mMediaPlayer
.
setScale
(
0
);
break
;
case
SURFACE_4_3:
mMediaPlayer
.
setAspectRatio
(
"4:3"
);
mMediaPlayer
.
setScale
(
0
);
...
...
@@ -277,24 +297,17 @@ class VideoHelper implements IVLCVout.OnNewVideoLayoutListener {
break
;
case
SURFACE_FILL:
break
;
case
SURFACE_16_9:
ar
=
16.0
/
9.0
;
if
(
dar
<
ar
)
dh
=
dw
/
ar
;
else
dw
=
dh
*
ar
;
case
SURFACE_ORIGINAL:
dh
=
mVideoVisibleHeight
;
dw
=
vw
;
break
;
case
SURFACE_4_3
:
ar
=
4.0
/
3.0
;
default
:
ar
=
mCurrentScaleType
.
getRatio
()
;
if
(
dar
<
ar
)
dh
=
dw
/
ar
;
else
dw
=
dh
*
ar
;
break
;
case
SURFACE_ORIGINAL:
dh
=
mVideoVisibleHeight
;
dw
=
vw
;
break
;
}
// set display size
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment