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
bf18aae9
authored
Oct 29, 2021
by
huangdarwin
Committed by
Ian Baker
Nov 09, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
GL: Make ProjectionRenderer's GL Program @MonotonicNonNull.
PiperOrigin-RevId: 406385758
parent
8586127d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
5 deletions
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/spherical/ProjectionRenderer.java
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/spherical/SceneRenderer.java
libraries/transformer/src/main/java/androidx/media3/transformer/TranscodingTransformer.java
libraries/transformer/src/main/java/androidx/media3/transformer/Transformation.java
libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/spherical/ProjectionRenderer.java
View file @
bf18aae9
...
...
@@ -24,6 +24,7 @@ import androidx.annotation.Nullable;
import
androidx.media3.common.C
;
import
androidx.media3.common.util.GlUtil
;
import
java.nio.FloatBuffer
;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
/**
* Utility class to render spherical meshes for video or images. Call {@link #init()} on the GL
...
...
@@ -93,9 +94,9 @@ import java.nio.FloatBuffer;
private
int
stereoMode
;
@Nullable
private
MeshData
leftMeshData
;
@Nullable
private
MeshData
rightMeshData
;
@Nullable
private
GlUtil
.
Program
program
;
private
GlUtil
.
@MonotonicNonNull
Program
program
;
// Program related GL items. These are only valid if
program is non-null
.
// Program related GL items. These are only valid if
Program is valid
.
private
int
mvpMatrixHandle
;
private
int
uTexMatrixHandle
;
private
int
positionHandle
;
...
...
@@ -195,11 +196,10 @@ import java.nio.FloatBuffer;
GLES20
.
glDisableVertexAttribArray
(
texCoordsHandle
);
}
/** Cleans up
the
GL resources. */
/** Cleans up GL resources. */
/* package */
void
shutdown
()
{
if
(
program
!=
null
)
{
program
.
delete
();
program
=
null
;
}
}
...
...
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/spherical/SceneRenderer.java
View file @
bf18aae9
...
...
@@ -129,7 +129,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
projectionRenderer
.
draw
(
textureId
,
tempMatrix
,
rightEye
);
}
/** Cleans up
the
GL resources. */
/** Cleans up GL resources. */
public
void
shutdown
()
{
projectionRenderer
.
shutdown
();
}
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/TranscodingTransformer.java
View file @
bf18aae9
...
...
@@ -43,6 +43,7 @@ import androidx.media3.common.Player;
import
androidx.media3.common.Timeline
;
import
androidx.media3.common.TracksInfo
;
import
androidx.media3.common.util.Clock
;
import
androidx.media3.common.util.Log
;
import
androidx.media3.common.util.UnstableApi
;
import
androidx.media3.common.util.Util
;
import
androidx.media3.exoplayer.DefaultLoadControl
;
...
...
@@ -93,12 +94,16 @@ public final class TranscodingTransformer {
/** A builder for {@link TranscodingTransformer} instances. */
public
static
final
class
Builder
{
// Mandatory field.
private
@MonotonicNonNull
Context
context
;
// Optional fields.
private
@MonotonicNonNull
MediaSourceFactory
mediaSourceFactory
;
private
Muxer
.
Factory
muxerFactory
;
private
boolean
removeAudio
;
private
boolean
removeVideo
;
private
boolean
flattenForSlowMotion
;
private
int
outputHeight
;
private
String
outputMimeType
;
@Nullable
private
String
audioMimeType
;
@Nullable
private
String
videoMimeType
;
...
...
@@ -123,6 +128,7 @@ public final class TranscodingTransformer {
this
.
removeAudio
=
transcodingTransformer
.
transformation
.
removeAudio
;
this
.
removeVideo
=
transcodingTransformer
.
transformation
.
removeVideo
;
this
.
flattenForSlowMotion
=
transcodingTransformer
.
transformation
.
flattenForSlowMotion
;
this
.
outputHeight
=
transcodingTransformer
.
transformation
.
outputHeight
;
this
.
outputMimeType
=
transcodingTransformer
.
transformation
.
outputMimeType
;
this
.
audioMimeType
=
transcodingTransformer
.
transformation
.
audioMimeType
;
this
.
videoMimeType
=
transcodingTransformer
.
transformation
.
videoMimeType
;
...
...
@@ -216,6 +222,21 @@ public final class TranscodingTransformer {
}
/**
* Sets the output resolution for the video, using the output height. The default value is to
* use the same height as the input. Output width will scale to preserve the input video's
* aspect ratio.
*
* <p>For example, a 1920x1440 video can be scaled to 640x480 by calling setResolution(480).
*
* @param outputHeight The output height for the video, in pixels.
* @return This builder.
*/
public
Builder
setResolution
(
int
outputHeight
)
{
this
.
outputHeight
=
outputHeight
;
return
this
;
}
/**
* Sets the MIME type of the output. The default value is {@link MimeTypes#VIDEO_MP4}. Supported
* values are:
*
...
...
@@ -358,6 +379,12 @@ public final class TranscodingTransformer {
checkState
(
muxerFactory
.
supportsOutputMimeType
(
outputMimeType
),
"Unsupported output MIME type: "
+
outputMimeType
);
// TODO(ME): Test with values of 10, 100, 1000).
Log
.
e
(
"TranscodingTransformer"
,
"outputHeight = "
+
outputHeight
);
if
(
outputHeight
==
0
)
{
// TODO(ME): get output height from input video.
outputHeight
=
480
;
}
if
(
audioMimeType
!=
null
)
{
checkSampleMimeType
(
audioMimeType
);
}
...
...
@@ -369,6 +396,7 @@ public final class TranscodingTransformer {
removeAudio
,
removeVideo
,
flattenForSlowMotion
,
outputHeight
,
outputMimeType
,
audioMimeType
,
videoMimeType
);
...
...
@@ -455,6 +483,7 @@ public final class TranscodingTransformer {
checkState
(
!
transformation
.
removeAudio
||
!
transformation
.
removeVideo
,
"Audio and video cannot both be removed."
);
checkState
(!(
transformation
.
removeVideo
));
this
.
context
=
context
;
this
.
mediaSourceFactory
=
mediaSourceFactory
;
this
.
muxerFactory
=
muxerFactory
;
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/Transformation.java
View file @
bf18aae9
...
...
@@ -24,6 +24,7 @@ import androidx.annotation.Nullable;
public
final
boolean
removeAudio
;
public
final
boolean
removeVideo
;
public
final
boolean
flattenForSlowMotion
;
public
final
int
outputHeight
;
public
final
String
outputMimeType
;
@Nullable
public
final
String
audioMimeType
;
@Nullable
public
final
String
videoMimeType
;
...
...
@@ -32,12 +33,14 @@ import androidx.annotation.Nullable;
boolean
removeAudio
,
boolean
removeVideo
,
boolean
flattenForSlowMotion
,
int
outputHeight
,
String
outputMimeType
,
@Nullable
String
audioMimeType
,
@Nullable
String
videoMimeType
)
{
this
.
removeAudio
=
removeAudio
;
this
.
removeVideo
=
removeVideo
;
this
.
flattenForSlowMotion
=
flattenForSlowMotion
;
this
.
outputHeight
=
outputHeight
;
this
.
outputMimeType
=
outputMimeType
;
this
.
audioMimeType
=
audioMimeType
;
this
.
videoMimeType
=
videoMimeType
;
...
...
libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java
View file @
bf18aae9
...
...
@@ -299,11 +299,13 @@ public final class Transformer {
checkState
(
muxerFactory
.
supportsOutputMimeType
(
outputMimeType
),
"Unsupported output MIME type: "
+
outputMimeType
);
int
outputHeight
=
0
;
// TODO(ME): How do we get the input height here?
Transformation
transformation
=
new
Transformation
(
removeAudio
,
removeVideo
,
flattenForSlowMotion
,
outputHeight
,
outputMimeType
,
/* audioMimeType= */
null
,
/* videoMimeType= */
null
);
...
...
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