Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e65f7264
authored
Nov 17, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Allow video format filtering without viewport constraint.
parent
80e829d7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
library/src/main/java/com/google/android/exoplayer/chunk/VideoFormatSelectorUtil.java
library/src/main/java/com/google/android/exoplayer/chunk/VideoFormatSelectorUtil.java
View file @
e65f7264
...
@@ -82,10 +82,10 @@ public final class VideoFormatSelectorUtil {
...
@@ -82,10 +82,10 @@ public final class VideoFormatSelectorUtil {
* viewport during playback.
* viewport during playback.
* @param viewportWidth The width in pixels of the viewport within which the video will be
* @param viewportWidth The width in pixels of the viewport within which the video will be
* displayed. If the viewport size may change, this should be set to the maximum possible
* displayed. If the viewport size may change, this should be set to the maximum possible
* width.
* width.
-1 if selection should not be constrained by a viewport.
* @param viewportHeight The height in pixels of the viewport within which the video will be
* @param viewportHeight The height in pixels of the viewport within which the video will be
* displayed. If the viewport size may change, this should be set to the maximum possible
* displayed. If the viewport size may change, this should be set to the maximum possible
* height.
* height.
-1 if selection should not be constrained by a viewport.
* @return An array holding the indices of the selected formats.
* @return An array holding the indices of the selected formats.
* @throws DecoderQueryException
* @throws DecoderQueryException
*/
*/
...
@@ -107,7 +107,7 @@ public final class VideoFormatSelectorUtil {
...
@@ -107,7 +107,7 @@ public final class VideoFormatSelectorUtil {
// Keep track of the number of pixels of the selected format whose resolution is the
// Keep track of the number of pixels of the selected format whose resolution is the
// smallest to exceed the maximum size at which it can be displayed within the viewport.
// smallest to exceed the maximum size at which it can be displayed within the viewport.
// We'll discard formats of higher resolution in a second pass.
// We'll discard formats of higher resolution in a second pass.
if
(
format
.
width
>
0
&&
format
.
height
>
0
)
{
if
(
format
.
width
>
0
&&
format
.
height
>
0
&&
viewportWidth
>
0
&&
viewportHeight
>
0
)
{
Point
maxVideoSizeInViewport
=
getMaxVideoSizeInViewport
(
orientationMayChange
,
Point
maxVideoSizeInViewport
=
getMaxVideoSizeInViewport
(
orientationMayChange
,
viewportWidth
,
viewportHeight
,
format
.
width
,
format
.
height
);
viewportWidth
,
viewportHeight
,
format
.
width
,
format
.
height
);
int
videoPixels
=
format
.
width
*
format
.
height
;
int
videoPixels
=
format
.
width
*
format
.
height
;
...
@@ -123,6 +123,7 @@ public final class VideoFormatSelectorUtil {
...
@@ -123,6 +123,7 @@ public final class VideoFormatSelectorUtil {
// Second pass to filter out formats that exceed maxVideoPixelsToRetain. These formats are have
// Second pass to filter out formats that exceed maxVideoPixelsToRetain. These formats are have
// unnecessarily high resolution given the size at which the video will be displayed within the
// unnecessarily high resolution given the size at which the video will be displayed within the
// viewport.
// viewport.
if
(
maxVideoPixelsToRetain
!=
Integer
.
MAX_VALUE
)
{
for
(
int
i
=
selectedIndexList
.
size
()
-
1
;
i
>=
0
;
i
--)
{
for
(
int
i
=
selectedIndexList
.
size
()
-
1
;
i
>=
0
;
i
--)
{
Format
format
=
formatWrappers
.
get
(
selectedIndexList
.
get
(
i
)).
getFormat
();
Format
format
=
formatWrappers
.
get
(
selectedIndexList
.
get
(
i
)).
getFormat
();
if
(
format
.
width
>
0
&&
format
.
height
>
0
if
(
format
.
width
>
0
&&
format
.
height
>
0
...
@@ -130,6 +131,7 @@ public final class VideoFormatSelectorUtil {
...
@@ -130,6 +131,7 @@ public final class VideoFormatSelectorUtil {
selectedIndexList
.
remove
(
i
);
selectedIndexList
.
remove
(
i
);
}
}
}
}
}
return
Util
.
toArray
(
selectedIndexList
);
return
Util
.
toArray
(
selectedIndexList
);
}
}
...
...
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