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
656556b8
authored
Nov 01, 2019
by
andrewlewis
Committed by
Oliver Woodman
Nov 05, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clean up naming for GLSurfaceViews
PiperOrigin-RevId: 277896757
parent
242a0053
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
96 additions
and
81 deletions
RELEASENOTES.md
demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java
demos/main/src/main/res/values/styles.xml
extensions/av1/README.md
extensions/av1/src/main/java/com/google/android/exoplayer2/ext/av1/Libgav1VideoRenderer.java
extensions/vp9/README.md
extensions/vp9/src/androidTest/java/com/google/android/exoplayer2/ext/vp9/VpxPlaybackTest.java
extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/LibvpxVideoRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/C.java
library/core/src/main/java/com/google/android/exoplayer2/Player.java
library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
library/core/src/main/java/com/google/android/exoplayer2/video/VideoDecoderSurfaceView.java → library/core/src/main/java/com/google/android/exoplayer2/video/VideoDecoderGLSurfaceView.java
library/core/src/main/java/com/google/android/exoplayer2/video/VideoDecoderRenderer.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java → library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalGLSurfaceView.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/TouchTracker.java
library/ui/src/main/res/values/attrs.xml
RELEASENOTES.md
View file @
656556b8
...
...
@@ -85,6 +85,7 @@
`C.MSG_SET_OUTPUT_BUFFER_RENDERER`
.
*
Use
`VideoDecoderRenderer`
as an implementation of
`VideoDecoderOutputBufferRenderer`
, instead of
`VideoDecoderSurfaceView`
.
*
Rename
`spherical_view`
surface type to
`spherical_gl_surface_view`
.
*
Add automatic audio becoming noisy handling to
`SimpleExoPlayer`
,
available through
`SimpleExoPlayer.setHandleAudioBecomingNoisy`
.
*
Post
`AudioFocusManager.onAudioFocusChange`
events to eventHandler, avoiding
...
...
demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java
View file @
656556b8
...
...
@@ -69,7 +69,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import
com.google.android.exoplayer2.ui.DebugTextViewHelper
;
import
com.google.android.exoplayer2.ui.PlayerControlView
;
import
com.google.android.exoplayer2.ui.PlayerView
;
import
com.google.android.exoplayer2.ui.spherical.SphericalSurfaceView
;
import
com.google.android.exoplayer2.ui.spherical.Spherical
GL
SurfaceView
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.util.ErrorMessageProvider
;
...
...
@@ -193,7 +193,7 @@ public class PlayerActivity extends AppCompatActivity
finish
();
return
;
}
((
SphericalSurfaceView
)
playerView
.
getVideoSurfaceView
()).
setDefaultStereoMode
(
stereoMode
);
((
Spherical
GL
SurfaceView
)
playerView
.
getVideoSurfaceView
()).
setDefaultStereoMode
(
stereoMode
);
}
if
(
savedInstanceState
!=
null
)
{
...
...
demos/main/src/main/res/values/styles.xml
View file @
656556b8
...
...
@@ -24,7 +24,7 @@
</style>
<style
name=
"PlayerTheme.Spherical"
>
<item
name=
"surface_type"
>
spherical_view
</item>
<item
name=
"surface_type"
>
spherical_
gl_surface_
view
</item>
</style>
</resources>
extensions/av1/README.md
View file @
656556b8
...
...
@@ -96,9 +96,10 @@ gets from the libgav1 decoder:
*
GL rendering using GL shader for color space conversion
*
If you are using
`SimpleExoPlayer`
with
`PlayerView`
, enable this option by
setting
`surface_type`
of
`PlayerView`
to be
`video_decoder_surface_view`
.
setting
`surface_type`
of
`PlayerView`
to be
`video_decoder_gl_surface_view`
.
*
Otherwise, enable this option by sending
`Libgav1VideoRenderer`
a message
of type
`C.MSG_SET_OUTPUT_BUFFER_RENDERER`
with an instance of
of type
`C.MSG_SET_
VIDEO_DECODER_
OUTPUT_BUFFER_RENDERER`
with an instance of
`VideoDecoderOutputBufferRenderer`
as its object.
*
Native rendering using
`ANativeWindow`
...
...
extensions/av1/src/main/java/com/google/android/exoplayer2/ext/av1/Libgav1VideoRenderer.java
View file @
656556b8
...
...
@@ -47,8 +47,8 @@ import com.google.android.exoplayer2.video.VideoRendererEventListener;
* <ul>
* <li>Message with type {@link C#MSG_SET_SURFACE} to set the output surface. The message payload
* should be the target {@link Surface}, or null.
* <li>Message with type {@link C#MSG_SET_
OUTPUT_BUFFER_RENDERER} to set the output buffer
* renderer. The message payload should be the target {@link
* <li>Message with type {@link C#MSG_SET_
VIDEO_DECODER_OUTPUT_BUFFER_RENDERER} to set the output
*
buffer
renderer. The message payload should be the target {@link
* VideoDecoderOutputBufferRenderer}, or null.
* </ul>
*/
...
...
@@ -186,7 +186,7 @@ public class Libgav1VideoRenderer extends SimpleDecoderVideoRenderer {
public
void
handleMessage
(
int
messageType
,
@Nullable
Object
message
)
throws
ExoPlaybackException
{
if
(
messageType
==
C
.
MSG_SET_SURFACE
)
{
setOutputSurface
((
Surface
)
message
);
}
else
if
(
messageType
==
C
.
MSG_SET_OUTPUT_BUFFER_RENDERER
)
{
}
else
if
(
messageType
==
C
.
MSG_SET_
VIDEO_DECODER_
OUTPUT_BUFFER_RENDERER
)
{
setOutputBufferRenderer
((
VideoDecoderOutputBufferRenderer
)
message
);
}
else
{
super
.
handleMessage
(
messageType
,
message
);
...
...
extensions/vp9/README.md
View file @
656556b8
...
...
@@ -114,9 +114,10 @@ gets from the libvpx decoder:
*
GL rendering using GL shader for color space conversion
*
If you are using
`SimpleExoPlayer`
with
`PlayerView`
, enable this option by
setting
`surface_type`
of
`PlayerView`
to be
`video_decoder_surface_view`
.
setting
`surface_type`
of
`PlayerView`
to be
`video_decoder_gl_surface_view`
.
*
Otherwise, enable this option by sending
`LibvpxVideoRenderer`
a message of
type
`C.MSG_SET_OUTPUT_BUFFER_RENDERER`
with an instance of
type
`C.MSG_SET_
VIDEO_DECODER_
OUTPUT_BUFFER_RENDERER`
with an instance of
`VideoDecoderOutputBufferRenderer`
as its object.
*
Native rendering using
`ANativeWindow`
...
...
extensions/vp9/src/androidTest/java/com/google/android/exoplayer2/ext/vp9/VpxPlaybackTest.java
View file @
656556b8
...
...
@@ -32,7 +32,7 @@ import com.google.android.exoplayer2.source.MediaSource;
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
com.google.android.exoplayer2.util.Log
;
import
com.google.android.exoplayer2.video.VideoDecoderSurfaceView
;
import
com.google.android.exoplayer2.video.VideoDecoder
GL
SurfaceView
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
@@ -123,8 +123,8 @@ public class VpxPlaybackTest {
.
createMediaSource
(
uri
);
player
.
createMessage
(
videoRenderer
)
.
setType
(
C
.
MSG_SET_OUTPUT_BUFFER_RENDERER
)
.
setPayload
(
new
VideoDecoder
SurfaceView
(
context
).
get
OutputBufferRenderer
())
.
setType
(
C
.
MSG_SET_
VIDEO_DECODER_
OUTPUT_BUFFER_RENDERER
)
.
setPayload
(
new
VideoDecoder
GLSurfaceView
(
context
).
getVideoDecoder
OutputBufferRenderer
())
.
send
();
player
.
prepare
(
mediaSource
);
player
.
setPlayWhenReady
(
true
);
...
...
extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/LibvpxVideoRenderer.java
View file @
656556b8
...
...
@@ -47,8 +47,8 @@ import com.google.android.exoplayer2.video.VideoRendererEventListener;
* <ul>
* <li>Message with type {@link C#MSG_SET_SURFACE} to set the output surface. The message payload
* should be the target {@link Surface}, or null.
* <li>Message with type {@link C#MSG_SET_
OUTPUT_BUFFER_RENDERER} to set the output buffer
* renderer. The message payload should be the target {@link
* <li>Message with type {@link C#MSG_SET_
VIDEO_DECODER_OUTPUT_BUFFER_RENDERER} to set the output
*
buffer
renderer. The message payload should be the target {@link
* VideoDecoderOutputBufferRenderer}, or null.
* </ul>
*/
...
...
@@ -267,7 +267,7 @@ public class LibvpxVideoRenderer extends SimpleDecoderVideoRenderer {
public
void
handleMessage
(
int
messageType
,
@Nullable
Object
message
)
throws
ExoPlaybackException
{
if
(
messageType
==
C
.
MSG_SET_SURFACE
)
{
setOutputSurface
((
Surface
)
message
);
}
else
if
(
messageType
==
C
.
MSG_SET_OUTPUT_BUFFER_RENDERER
)
{
}
else
if
(
messageType
==
C
.
MSG_SET_
VIDEO_DECODER_
OUTPUT_BUFFER_RENDERER
)
{
setOutputBufferRenderer
((
VideoDecoderOutputBufferRenderer
)
message
);
}
else
if
(
messageType
==
C
.
MSG_SET_VIDEO_FRAME_METADATA_LISTENER
)
{
frameMetadataListener
=
(
VideoFrameMetadataListener
)
message
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/C.java
View file @
656556b8
...
...
@@ -834,8 +834,12 @@ public final class C {
* The type of a message that can be passed to a {@link SimpleDecoderVideoRenderer} via {@link
* ExoPlayer#createMessage(Target)}. The message payload should be the target {@link
* VideoDecoderOutputBufferRenderer}, or null.
*
* <p>This message is intended only for use with extension renderers that expect a {@link
* VideoDecoderOutputBufferRenderer}. For other use cases, an output surface should be passed via
* {@link #MSG_SET_SURFACE} instead.
*/
public
static
final
int
MSG_SET_OUTPUT_BUFFER_RENDERER
=
8
;
public
static
final
int
MSG_SET_
VIDEO_DECODER_
OUTPUT_BUFFER_RENDERER
=
8
;
/**
* Applications or extensions may define custom {@code MSG_*} constants that can be passed to
...
...
library/core/src/main/java/com/google/android/exoplayer2/Player.java
View file @
656556b8
...
...
@@ -283,11 +283,16 @@ public interface Player {
void
clearVideoTextureView
(
TextureView
textureView
);
/**
* Sets the output buffer renderer.
* Sets the video decoder output buffer renderer. This is intended for use only with extension
* renderers that accept {@link C#MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER}. For most use
* cases, an output surface or view should be passed via {@link #setVideoSurface(Surface)} or
* {@link #setVideoSurfaceView(SurfaceView)} instead.
*
* @param outputBufferRenderer The output buffer renderer.
* @param videoDecoderOutputBufferRenderer The video decoder output buffer renderer, or {@code
* null} to clear the output buffer renderer.
*/
void
setOutputBufferRenderer
(
VideoDecoderOutputBufferRenderer
outputBufferRenderer
);
void
setVideoDecoderOutputBufferRenderer
(
@Nullable
VideoDecoderOutputBufferRenderer
videoDecoderOutputBufferRenderer
);
}
/** The text component of a {@link Player}. */
...
...
library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
View file @
656556b8
...
...
@@ -610,15 +610,16 @@ public class SimpleExoPlayer extends BasePlayer
}
@Override
public
void
setOutputBufferRenderer
(
VideoDecoderOutputBufferRenderer
outputBufferRenderer
)
{
public
void
setVideoDecoderOutputBufferRenderer
(
@Nullable
VideoDecoderOutputBufferRenderer
videoDecoderOutputBufferRenderer
)
{
verifyApplicationThread
();
setVideoSurface
(
null
);
for
(
Renderer
renderer
:
renderers
)
{
if
(
renderer
.
getTrackType
()
==
C
.
TRACK_TYPE_VIDEO
)
{
player
.
createMessage
(
renderer
)
.
setType
(
C
.
MSG_SET_OUTPUT_BUFFER_RENDERER
)
.
setPayload
(
o
utputBufferRenderer
)
.
setType
(
C
.
MSG_SET_
VIDEO_DECODER_
OUTPUT_BUFFER_RENDERER
)
.
setPayload
(
videoDecoderO
utputBufferRenderer
)
.
send
();
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/VideoDecoderSurfaceView.java
→
library/core/src/main/java/com/google/android/exoplayer2/video/VideoDecoder
GL
SurfaceView.java
View file @
656556b8
...
...
@@ -20,27 +20,28 @@ import android.opengl.GLSurfaceView;
import
android.util.AttributeSet
;
import
androidx.annotation.Nullable
;
/** A GLSurfaceView extension that scales itself to the given aspect ratio. */
public
class
VideoDecoderSurfaceView
extends
GLSurfaceView
{
/**
* GLSurfaceView for rendering video output. To render video in this view, call {@link
* #getVideoDecoderOutputBufferRenderer()} to get a {@link VideoDecoderOutputBufferRenderer} that
* will render video decoder output buffers in this view.
*
* <p>This view is intended for use only with extension renderers. For other use cases a {@link
* android.view.SurfaceView} or {@link android.view.TextureView} should be used instead.
*/
public
class
VideoDecoderGLSurfaceView
extends
GLSurfaceView
{
private
final
VideoDecoderRenderer
renderer
;
/**
* Creates VideoDecoderSurfaceView.
*
* @param context A {@link Context}.
*/
public
VideoDecoderSurfaceView
(
Context
context
)
{
/** @param context A {@link Context}. */
public
VideoDecoderGLSurfaceView
(
Context
context
)
{
this
(
context
,
/* attrs= */
null
);
}
/**
* Creates VideoDecoderSurfaceView.
*
* @param context A {@link Context}.
* @param attrs Custom attributes.
*/
public
VideoDecoderSurfaceView
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
public
VideoDecoder
GL
SurfaceView
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
renderer
=
new
VideoDecoderRenderer
(
this
);
setPreserveEGLContextOnPause
(
true
);
...
...
@@ -49,12 +50,8 @@ public class VideoDecoderSurfaceView extends GLSurfaceView {
setRenderMode
(
GLSurfaceView
.
RENDERMODE_WHEN_DIRTY
);
}
/**
* Returns the output buffer renderer used.
*
* @return {@link VideoDecoderOutputBuffer}.
*/
public
VideoDecoderOutputBufferRenderer
getOutputBufferRenderer
()
{
/** Returns the {@link VideoDecoderOutputBufferRenderer} that will render frames in this view. */
public
VideoDecoderOutputBufferRenderer
getVideoDecoderOutputBufferRenderer
()
{
return
renderer
;
}
}
library/core/src/main/java/com/google/android/exoplayer2/video/VideoDecoderRenderer.java
View file @
656556b8
...
...
@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.video;
import
android.opengl.GLES20
;
import
android.opengl.GLSurfaceView
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.GlUtil
;
import
java.nio.FloatBuffer
;
...
...
@@ -97,6 +98,7 @@ import javax.microedition.khronos.opengles.GL10;
private
int
[]
previousWidths
;
private
int
[]
previousStrides
;
@Nullable
private
VideoDecoderOutputBuffer
renderedOutputBuffer
;
// Accessed only from the GL thread.
public
VideoDecoderRenderer
(
GLSurfaceView
surfaceView
)
{
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
View file @
656556b8
...
...
@@ -59,12 +59,12 @@ import com.google.android.exoplayer2.trackselection.TrackSelection;
import
com.google.android.exoplayer2.trackselection.TrackSelectionArray
;
import
com.google.android.exoplayer2.ui.AspectRatioFrameLayout.ResizeMode
;
import
com.google.android.exoplayer2.ui.spherical.SingleTapListener
;
import
com.google.android.exoplayer2.ui.spherical.SphericalSurfaceView
;
import
com.google.android.exoplayer2.ui.spherical.Spherical
GL
SurfaceView
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.ErrorMessageProvider
;
import
com.google.android.exoplayer2.util.RepeatModeUtil
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.video.VideoDecoderSurfaceView
;
import
com.google.android.exoplayer2.video.VideoDecoder
GL
SurfaceView
;
import
com.google.android.exoplayer2.video.VideoListener
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
...
...
@@ -131,11 +131,11 @@ import java.util.List;
* <li>Default: {@code fit}
* </ul>
* <li><b>{@code surface_type}</b> - The type of surface view used for video playbacks. Valid
* values are {@code surface_view}, {@code texture_view}, {@code spherical_
view} and {@code
*
none}. Using {@code none} is recommended for audio only applications, since creating the
*
surface can be expensive. Using {@code surface_view} is recommended for video applications.
*
Note, TextureView can only be used in a hardware accelerated window. When render
ed in
* software, TextureView will draw nothing.
* values are {@code surface_view}, {@code texture_view}, {@code spherical_
gl_surface_view},
*
{@code video_decoder_gl_surface_view} and {@code none}. Using {@code none} is recommended
*
for audio only applications, since creating the surface can be expensive. Using {@code
*
surface_view} is recommended for video applications. Note, TextureView can only be us
ed in
*
a hardware accelerated window. When rendered in
software, TextureView will draw nothing.
* <ul>
* <li>Corresponding method: None
* <li>Default: {@code surface_view}
...
...
@@ -276,8 +276,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
private
static
final
int
SURFACE_TYPE_NONE
=
0
;
private
static
final
int
SURFACE_TYPE_SURFACE_VIEW
=
1
;
private
static
final
int
SURFACE_TYPE_TEXTURE_VIEW
=
2
;
private
static
final
int
SURFACE_TYPE_
MONO360
_VIEW
=
3
;
private
static
final
int
SURFACE_TYPE_VIDEO_GL_SURFACE_VIEW
=
4
;
private
static
final
int
SURFACE_TYPE_
SPHERICAL_GL_SURFACE
_VIEW
=
3
;
private
static
final
int
SURFACE_TYPE_VIDEO_
DECODER_
GL_SURFACE_VIEW
=
4
;
// LINT.ThenChange(../../../../../../res/values/attrs.xml)
@Nullable
private
final
AspectRatioFrameLayout
contentFrame
;
...
...
@@ -409,13 +409,13 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
case
SURFACE_TYPE_TEXTURE_VIEW:
surfaceView
=
new
TextureView
(
context
);
break
;
case
SURFACE_TYPE_
MONO360
_VIEW:
Spherical
SurfaceView
sphericalSurfaceView
=
new
Spherical
SurfaceView
(
context
);
sphericalSurfaceView
.
setSingleTapListener
(
componentListener
);
surfaceView
=
sphericalSurfaceView
;
case
SURFACE_TYPE_
SPHERICAL_GL_SURFACE
_VIEW:
Spherical
GLSurfaceView
sphericalGLSurfaceView
=
new
SphericalGL
SurfaceView
(
context
);
spherical
GL
SurfaceView
.
setSingleTapListener
(
componentListener
);
surfaceView
=
spherical
GL
SurfaceView
;
break
;
case
SURFACE_TYPE_VIDEO_GL_SURFACE_VIEW:
surfaceView
=
new
VideoDecoderSurfaceView
(
context
);
case
SURFACE_TYPE_VIDEO_
DECODER_
GL_SURFACE_VIEW:
surfaceView
=
new
VideoDecoder
GL
SurfaceView
(
context
);
break
;
default
:
surfaceView
=
new
SurfaceView
(
context
);
...
...
@@ -547,10 +547,10 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
oldVideoComponent
.
removeVideoListener
(
componentListener
);
if
(
surfaceView
instanceof
TextureView
)
{
oldVideoComponent
.
clearVideoTextureView
((
TextureView
)
surfaceView
);
}
else
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
((
SphericalSurfaceView
)
surfaceView
).
setVideoComponent
(
null
);
}
else
if
(
surfaceView
instanceof
VideoDecoderSurfaceView
)
{
oldVideoComponent
.
setOutputBufferRenderer
(
null
);
}
else
if
(
surfaceView
instanceof
Spherical
GL
SurfaceView
)
{
((
Spherical
GL
SurfaceView
)
surfaceView
).
setVideoComponent
(
null
);
}
else
if
(
surfaceView
instanceof
VideoDecoder
GL
SurfaceView
)
{
oldVideoComponent
.
set
VideoDecoder
OutputBufferRenderer
(
null
);
}
else
if
(
surfaceView
instanceof
SurfaceView
)
{
oldVideoComponent
.
clearVideoSurfaceView
((
SurfaceView
)
surfaceView
);
}
...
...
@@ -575,11 +575,11 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
if
(
newVideoComponent
!=
null
)
{
if
(
surfaceView
instanceof
TextureView
)
{
newVideoComponent
.
setVideoTextureView
((
TextureView
)
surfaceView
);
}
else
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
((
SphericalSurfaceView
)
surfaceView
).
setVideoComponent
(
newVideoComponent
);
}
else
if
(
surfaceView
instanceof
VideoDecoderSurfaceView
)
{
newVideoComponent
.
setOutputBufferRenderer
(
((
VideoDecoder
SurfaceView
)
surfaceView
).
get
OutputBufferRenderer
());
}
else
if
(
surfaceView
instanceof
Spherical
GL
SurfaceView
)
{
((
Spherical
GL
SurfaceView
)
surfaceView
).
setVideoComponent
(
newVideoComponent
);
}
else
if
(
surfaceView
instanceof
VideoDecoder
GL
SurfaceView
)
{
newVideoComponent
.
set
VideoDecoder
OutputBufferRenderer
(
((
VideoDecoder
GLSurfaceView
)
surfaceView
).
getVideoDecoder
OutputBufferRenderer
());
}
else
if
(
surfaceView
instanceof
SurfaceView
)
{
newVideoComponent
.
setVideoSurfaceView
((
SurfaceView
)
surfaceView
);
}
...
...
@@ -1049,12 +1049,15 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
* <li>{@link SurfaceView} by default, or if the {@code surface_type} attribute is set to {@code
* surface_view}.
* <li>{@link TextureView} if {@code surface_type} is {@code texture_view}.
* <li>{@link SphericalSurfaceView} if {@code surface_type} is {@code spherical_view}.
* <li>{@link SphericalGLSurfaceView} if {@code surface_type} is {@code
* spherical_gl_surface_view}.
* <li>{@link VideoDecoderGLSurfaceView} if {@code surface_type} is {@code
* video_decoder_gl_surface_view}.
* <li>{@code null} if {@code surface_type} is {@code none}.
* </ul>
*
* @return The {@link SurfaceView}, {@link TextureView}, {@link Spherical
SurfaceView} or {@code
* null}.
* @return The {@link SurfaceView}, {@link TextureView}, {@link Spherical
GLSurfaceView}, {@link
*
VideoDecoderGLSurfaceView} or {@code
null}.
*/
@Nullable
public
View
getVideoSurfaceView
()
{
...
...
@@ -1122,34 +1125,34 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
/**
* Should be called when the player is visible to the user and if {@code surface_type} is {@code
* spherical_view}. It is the counterpart to {@link #onPause()}.
* spherical_
gl_surface_
view}. It is the counterpart to {@link #onPause()}.
*
* <p>This method should typically be called in {@code Activity.onStart()}, or {@code
* Activity.onResume()} for API versions <= 23.
*/
public
void
onResume
()
{
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
((
SphericalSurfaceView
)
surfaceView
).
onResume
();
if
(
surfaceView
instanceof
Spherical
GL
SurfaceView
)
{
((
Spherical
GL
SurfaceView
)
surfaceView
).
onResume
();
}
}
/**
* Should be called when the player is no longer visible to the user and if {@code surface_type}
* is {@code spherical_view}. It is the counterpart to {@link #onResume()}.
* is {@code spherical_
gl_surface_
view}. It is the counterpart to {@link #onResume()}.
*
* <p>This method should typically be called in {@code Activity.onStop()}, or {@code
* Activity.onPause()} for API versions <= 23.
*/
public
void
onPause
()
{
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
((
SphericalSurfaceView
)
surfaceView
).
onPause
();
if
(
surfaceView
instanceof
Spherical
GL
SurfaceView
)
{
((
Spherical
GL
SurfaceView
)
surfaceView
).
onPause
();
}
}
/**
* Called when there's a change in the aspect ratio of the content being displayed. The default
* implementation sets the aspect ratio of the content frame to that of the content, unless the
* content view is a {@link SphericalSurfaceView} in which case the frame's aspect ratio is
* content view is a {@link Spherical
GL
SurfaceView} in which case the frame's aspect ratio is
* cleared.
*
* @param contentAspectRatio The aspect ratio of the content.
...
...
@@ -1162,7 +1165,7 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
@Nullable
View
contentView
)
{
if
(
contentFrame
!=
null
)
{
contentFrame
.
setAspectRatio
(
contentView
instanceof
SphericalSurfaceView
?
0
:
contentAspectRatio
);
contentView
instanceof
Spherical
GL
SurfaceView
?
0
:
contentAspectRatio
);
}
}
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java
→
library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/Spherical
GL
SurfaceView.java
View file @
656556b8
...
...
@@ -51,7 +51,7 @@ import javax.microedition.khronos.opengles.GL10;
* apply the touch and sensor rotations in the correct order or the user's touch manipulations won't
* match what they expect.
*/
public
final
class
SphericalSurfaceView
extends
GLSurfaceView
{
public
final
class
Spherical
GL
SurfaceView
extends
GLSurfaceView
{
// Arbitrary vertical field of view.
private
static
final
int
FIELD_OF_VIEW_DEGREES
=
90
;
...
...
@@ -73,11 +73,11 @@ public final class SphericalSurfaceView extends GLSurfaceView {
@Nullable
private
Surface
surface
;
@Nullable
private
Player
.
VideoComponent
videoComponent
;
public
SphericalSurfaceView
(
Context
context
)
{
public
Spherical
GL
SurfaceView
(
Context
context
)
{
this
(
context
,
null
);
}
public
SphericalSurfaceView
(
Context
context
,
@Nullable
AttributeSet
attributeSet
)
{
public
Spherical
GL
SurfaceView
(
Context
context
,
@Nullable
AttributeSet
attributeSet
)
{
super
(
context
,
attributeSet
);
mainHandler
=
new
Handler
(
Looper
.
getMainLooper
());
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/TouchTracker.java
View file @
656556b8
...
...
@@ -75,7 +75,7 @@ import androidx.annotation.Nullable;
this
.
listener
=
listener
;
this
.
pxPerDegrees
=
pxPerDegrees
;
gestureDetector
=
new
GestureDetector
(
context
,
this
);
roll
=
SphericalSurfaceView
.
UPRIGHT_ROLL
;
roll
=
Spherical
GL
SurfaceView
.
UPRIGHT_ROLL
;
}
public
void
setSingleTapListener
(
@Nullable
SingleTapListener
listener
)
{
...
...
library/ui/src/main/res/values/attrs.xml
View file @
656556b8
...
...
@@ -29,8 +29,8 @@
<enum
name=
"none"
value=
"0"
/>
<enum
name=
"surface_view"
value=
"1"
/>
<enum
name=
"texture_view"
value=
"2"
/>
<enum
name=
"spherical_view"
value=
"3"
/>
<enum
name=
"video_decoder_surface_view"
value=
"4"
/>
<enum
name=
"spherical_
gl_surface_
view"
value=
"3"
/>
<enum
name=
"video_decoder_
gl_
surface_view"
value=
"4"
/>
</attr>
<!-- Must be kept in sync with RepeatModeUtil -->
...
...
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