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
d5e53d11
authored
Dec 17, 2018
by
olly
Committed by
Oliver Woodman
Dec 18, 2018
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add Player.MetadataComponent for completeness
PiperOrigin-RevId: 225795581
parent
9198e4cf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
11 deletions
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java
library/core/src/main/java/com/google/android/exoplayer2/Player.java
library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
View file @
d5e53d11
...
...
@@ -266,21 +266,30 @@ public final class CastPlayer extends BasePlayer {
// Player implementation.
@Override
@Nullable
public
AudioComponent
getAudioComponent
()
{
return
null
;
}
@Override
@Nullable
public
VideoComponent
getVideoComponent
()
{
return
null
;
}
@Override
@Nullable
public
TextComponent
getTextComponent
()
{
return
null
;
}
@Override
@Nullable
public
MetadataComponent
getMetadataComponent
()
{
return
null
;
}
@Override
public
Looper
getApplicationLooper
()
{
return
Looper
.
getMainLooper
();
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java
View file @
d5e53d11
...
...
@@ -145,21 +145,30 @@ import java.util.concurrent.CopyOnWriteArrayList;
}
@Override
@Nullable
public
AudioComponent
getAudioComponent
()
{
return
null
;
}
@Override
@Nullable
public
VideoComponent
getVideoComponent
()
{
return
null
;
}
@Override
@Nullable
public
TextComponent
getTextComponent
()
{
return
null
;
}
@Override
@Nullable
public
MetadataComponent
getMetadataComponent
()
{
return
null
;
}
@Override
public
Looper
getPlaybackLooper
()
{
return
internalPlayer
.
getPlaybackLooper
();
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/Player.java
View file @
d5e53d11
...
...
@@ -26,6 +26,7 @@ import com.google.android.exoplayer2.C.VideoScalingMode;
import
com.google.android.exoplayer2.audio.AudioAttributes
;
import
com.google.android.exoplayer2.audio.AudioListener
;
import
com.google.android.exoplayer2.audio.AuxEffectInfo
;
import
com.google.android.exoplayer2.metadata.MetadataOutput
;
import
com.google.android.exoplayer2.source.TrackGroupArray
;
import
com.google.android.exoplayer2.text.TextOutput
;
import
com.google.android.exoplayer2.trackselection.TrackSelectionArray
;
...
...
@@ -299,6 +300,24 @@ public interface Player {
void
removeTextOutput
(
TextOutput
listener
);
}
/** The metadata component of a {@link Player}. */
interface
MetadataComponent
{
/**
* Adds a {@link MetadataOutput} to receive metadata.
*
* @param output The output to register.
*/
void
addMetadataOutput
(
MetadataOutput
output
);
/**
* Removes a {@link MetadataOutput}.
*
* @param output The output to remove.
*/
void
removeMetadataOutput
(
MetadataOutput
output
);
}
/**
* Listener of changes in player state. All methods have no-op default implementations to allow
* selective overrides.
...
...
@@ -534,6 +553,12 @@ public interface Player {
TextComponent
getTextComponent
();
/**
* Returns the component of this player for metadata output, or null if metadata is not supported.
*/
@Nullable
MetadataComponent
getMetadataComponent
();
/**
* Returns the {@link Looper} associated with the application thread that's used to access the
* player and on which player events are received.
*/
...
...
library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
View file @
d5e53d11
...
...
@@ -65,7 +65,11 @@ import java.util.concurrent.CopyOnWriteArraySet;
*/
@TargetApi
(
16
)
public
class
SimpleExoPlayer
extends
BasePlayer
implements
ExoPlayer
,
Player
.
AudioComponent
,
Player
.
VideoComponent
,
Player
.
TextComponent
{
implements
ExoPlayer
,
Player
.
AudioComponent
,
Player
.
VideoComponent
,
Player
.
TextComponent
,
Player
.
MetadataComponent
{
/** @deprecated Use {@link com.google.android.exoplayer2.video.VideoListener}. */
@Deprecated
...
...
@@ -243,20 +247,29 @@ public class SimpleExoPlayer extends BasePlayer
}
@Override
@Nullable
public
AudioComponent
getAudioComponent
()
{
return
this
;
}
@Override
@Nullable
public
VideoComponent
getVideoComponent
()
{
return
this
;
}
@Override
@Nullable
public
TextComponent
getTextComponent
()
{
return
this
;
}
@Override
@Nullable
public
MetadataComponent
getMetadataComponent
()
{
return
this
;
}
/**
* Sets the video scaling mode.
*
...
...
@@ -713,20 +726,12 @@ public class SimpleExoPlayer extends BasePlayer
removeTextOutput
(
output
);
}
/**
* Adds a {@link MetadataOutput} to receive metadata.
*
* @param listener The output to register.
*/
@Override
public
void
addMetadataOutput
(
MetadataOutput
listener
)
{
metadataOutputs
.
add
(
listener
);
}
/**
* Removes a {@link MetadataOutput}.
*
* @param listener The output to remove.
*/
@Override
public
void
removeMetadataOutput
(
MetadataOutput
listener
)
{
metadataOutputs
.
remove
(
listener
);
}
...
...
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java
View file @
d5e53d11
...
...
@@ -50,6 +50,11 @@ public abstract class StubExoPlayer extends BasePlayer implements ExoPlayer {
}
@Override
public
MetadataComponent
getMetadataComponent
()
{
throw
new
UnsupportedOperationException
();
}
@Override
public
Looper
getPlaybackLooper
()
{
throw
new
UnsupportedOperationException
();
}
...
...
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