Loading api/current.txt +4 −1 Original line number Diff line number Diff line Loading @@ -26141,10 +26141,11 @@ package android.media { } public final class MediaTimestamp { ctor public MediaTimestamp(long, long, @FloatRange(from=0.0f, to=java.lang.Float.MAX_VALUE) float); method public long getAnchorMediaTimeUs(); method public long getAnchorSystemNanoTime(); method @Deprecated public long getAnchorSytemNanoTime(); method public float getMediaClockRate(); method @FloatRange(from=0.0f, to=java.lang.Float.MAX_VALUE) public float getMediaClockRate(); field public static final android.media.MediaTimestamp TIMESTAMP_UNKNOWN; } Loading Loading @@ -26472,6 +26473,7 @@ package android.media { } public final class SubtitleData { ctor public SubtitleData(int, long, long, @NonNull byte[]); method @NonNull public byte[] getData(); method public long getDurationUs(); method public long getStartTimeUs(); Loading Loading @@ -26512,6 +26514,7 @@ package android.media { } public final class TimedMetaData { ctor public TimedMetaData(long, @NonNull byte[]); method public byte[] getMetaData(); method public long getTimestamp(); } api/system-current.txt +0 −21 Original line number Diff line number Diff line Loading @@ -3574,13 +3574,6 @@ package android.media { field public static final int RADIO_TUNER = 1998; // 0x7ce } public static final class MediaTimestamp.Builder { ctor public MediaTimestamp.Builder(); ctor public MediaTimestamp.Builder(@NonNull android.media.MediaTimestamp); method @NonNull public android.media.MediaTimestamp build(); method @NonNull public android.media.MediaTimestamp.Builder setMediaTimestamp(long, long, float); } public class PlayerProxy { method public void pause(); method public void setPan(float); Loading @@ -3590,20 +3583,6 @@ package android.media { method public void stop(); } public static final class SubtitleData.Builder { ctor public SubtitleData.Builder(); ctor public SubtitleData.Builder(@NonNull android.media.SubtitleData); method @NonNull public android.media.SubtitleData build(); method @NonNull public android.media.SubtitleData.Builder setSubtitleData(int, long, long, @NonNull byte[]); } public static final class TimedMetaData.Builder { ctor public TimedMetaData.Builder(); ctor public TimedMetaData.Builder(@NonNull android.media.TimedMetaData); method @NonNull public android.media.TimedMetaData build(); method @NonNull public android.media.TimedMetaData.Builder setTimedMetaData(long, @NonNull byte[]); } } package android.media.audiopolicy { Loading media/apex/java/android/media/MediaPlayer2.java +13 −20 Original line number Diff line number Diff line Loading @@ -274,8 +274,7 @@ import java.util.concurrent.atomic.AtomicLong; * successful transition. Any other value will be an error. Call {@link #getState()} to * determine the current state. </p> */ public class MediaPlayer2 implements AutoCloseable , AudioRouting { public class MediaPlayer2 implements AutoCloseable, AudioRouting { static { System.loadLibrary("media2_jni"); native_init(); Loading Loading @@ -1810,12 +1809,10 @@ public class MediaPlayer2 implements AutoCloseable public MediaTimestamp getTimestamp() { try { // TODO: get the timestamp from native side return new MediaTimestamp.Builder() .setMediaTimestamp( return new MediaTimestamp( getCurrentPosition() * 1000L, System.nanoTime(), getState() == PLAYER_STATE_PLAYING ? getPlaybackParams().getSpeed() : 0.f) .build(); getState() == PLAYER_STATE_PLAYING ? getPlaybackParams().getSpeed() : 0.f); } catch (IllegalStateException e) { return null; } Loading Loading @@ -2643,13 +2640,11 @@ public class MediaPlayer2 implements AutoCloseable return; } Iterator<Value> in = playerMsg.getValuesList().iterator(); SubtitleData data = new SubtitleData.Builder() .setSubtitleData( SubtitleData data = new SubtitleData( in.next().getInt32Value(), // trackIndex in.next().getInt64Value(), // startTimeUs in.next().getInt64Value(), // durationUs in.next().getBytesValue().toByteArray()) // data .build(); in.next().getBytesValue().toByteArray()); // data sendEvent(new EventNotifier() { @Override public void notify(EventCallback callback) { Loading @@ -2673,11 +2668,9 @@ public class MediaPlayer2 implements AutoCloseable return; } Iterator<Value> in = playerMsg.getValuesList().iterator(); data = new TimedMetaData.Builder() .setTimedMetaData( data = new TimedMetaData( in.next().getInt64Value(), // timestampUs in.next().getBytesValue().toByteArray()) // metaData .build(); in.next().getBytesValue().toByteArray()); // metaData } else { data = null; } Loading media/java/android/media/MediaTimestamp.java +15 −74 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ package android.media; import android.annotation.NonNull; import android.annotation.SystemApi; import android.annotation.FloatRange; /** * An immutable object that represents the linear correlation between the media time Loading Loading @@ -76,6 +75,7 @@ public final class MediaTimestamp * greater than 1.0 if media clock is faster than the system clock; * less than 1.0 if media clock is slower than the system clock. */ @FloatRange(from = 0.0f, to = Float.MAX_VALUE) public float getMediaClockRate() { return clockRate; } Loading @@ -87,11 +87,19 @@ public final class MediaTimestamp /** @hide - accessor shorthand */ public final float clockRate; /** @hide */ MediaTimestamp(long mediaUs, long systemNs, float rate) { mediaTimeUs = mediaUs; nanoTime = systemNs; clockRate = rate; /** * Constructor. * * @param mediaTimeUs the media time of the anchor in microseconds * @param nanoTimeNs the {@link java.lang.System#nanoTime system time} corresponding to the * media time in nanoseconds. * @param clockRate the rate of the media clock in relation to the system time. */ public MediaTimestamp(long mediaTimeUs, long nanoTimeNs, @FloatRange(from = 0.0f, to = Float.MAX_VALUE) float clockRate) { this.mediaTimeUs = mediaTimeUs; this.nanoTime = nanoTimeNs; this.clockRate = clockRate; } /** @hide */ Loading Loading @@ -120,71 +128,4 @@ public final class MediaTimestamp + " clockRate=" + clockRate + "}"; } /** * Builder class for {@link MediaTimestamp} objects. * <p> Here is an example where <code>Builder</code> is used to define the * {@link MediaTimestamp}: * * <pre class="prettyprint"> * MediaTimestamp mts = new MediaTimestamp.Builder() * .setMediaTimestamp(mediaTime, systemTime, rate) * .build(); * </pre> * @hide */ @SystemApi public static final class Builder { long mMediaTimeUs; long mNanoTime; float mClockRate = 1.0f; /** * Constructs a new Builder with the defaults. */ public Builder() { } /** * Constructs a new Builder from a given {@link MediaTimestamp} instance * @param mts the {@link MediaTimestamp} object whose data will be reused * in the new Builder. */ public Builder(@NonNull MediaTimestamp mts) { if (mts == null) { throw new IllegalArgumentException("null MediaTimestamp is not allowed"); } mMediaTimeUs = mts.mediaTimeUs; mNanoTime = mts.nanoTime; mClockRate = mts.clockRate; } /** * Combines all of the fields that have been set and return a new * {@link MediaTimestamp} object. * * @return a new {@link MediaTimestamp} object */ public @NonNull MediaTimestamp build() { return new MediaTimestamp(mMediaTimeUs, mNanoTime, mClockRate); } /** * Sets the info of media timestamp. * * @param mediaTimeUs the media time of the anchor in microseconds * @param nanoTime the {@link java.lang.System#nanoTime system time} corresponding to * the media time in nanoseconds. * @param clockRate the rate of the media clock in relation to the system time. * @return the same Builder instance. */ public @NonNull Builder setMediaTimestamp( long mediaTimeUs, long nanoTime, float clockRate) { mMediaTimeUs = mediaTimeUs; mNanoTime = nanoTime; mClockRate = clockRate; return this; } } } media/java/android/media/SubtitleData.java +13 −81 Original line number Diff line number Diff line Loading @@ -17,11 +17,8 @@ package android.media; import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Parcel; import java.util.Arrays; /** * Class encapsulating subtitle data, as received through the * {@link MediaPlayer.OnSubtitleDataListener} interface. Loading Loading @@ -82,12 +79,23 @@ public final class SubtitleData } } /** @hide */ /** * Constructor. * * @param trackIndex the index of the media player track which contains this subtitle data. * @param startTimeUs the start time in microsecond for the subtitle data * @param durationUs the duration in microsecond for the subtitle data * @param data the data array for the subtitle data. It should not be null. * No data copying is made. */ public SubtitleData(int trackIndex, long startTimeUs, long durationUs, @NonNull byte[] data) { if (data == null) { throw new IllegalArgumentException("null data is not allowed"); } mTrackIndex = trackIndex; mStartTimeUs = startTimeUs; mDurationUs = durationUs; mData = (data != null ? data : new byte[0]); mData = data; } /** Loading Loading @@ -141,80 +149,4 @@ public final class SubtitleData return true; } /** * Builder class for {@link SubtitleData} objects. * <p> Here is an example where <code>Builder</code> is used to define the * {@link SubtitleData}: * * <pre class="prettyprint"> * SubtitleData sd = new SubtitleData.Builder() * .setSubtitleData(trackIndex, startTime, duration, data) * .build(); * </pre> * @hide */ @SystemApi public static final class Builder { private int mTrackIndex; private long mStartTimeUs; private long mDurationUs; private byte[] mData = new byte[0]; /** * Constructs a new Builder with the defaults. */ public Builder() { } /** * Constructs a new Builder from a given {@link SubtitleData} instance * @param sd the {@link SubtitleData} object whose data will be reused * in the new Builder. It should not be null. The data array is copied. */ public Builder(@NonNull SubtitleData sd) { if (sd == null) { throw new IllegalArgumentException("null SubtitleData is not allowed"); } mTrackIndex = sd.mTrackIndex; mStartTimeUs = sd.mStartTimeUs; mDurationUs = sd.mDurationUs; if (sd.mData != null) { mData = Arrays.copyOf(sd.mData, sd.mData.length); } } /** * Combines all of the fields that have been set and return a new * {@link SubtitleData} object. <code>IllegalStateException</code> will be * thrown if there is conflict between fields. * * @return a new {@link SubtitleData} object */ public @NonNull SubtitleData build() { return new SubtitleData(mTrackIndex, mStartTimeUs, mDurationUs, mData); } /** * Sets the info of subtitle data. * * @param trackIndex the index of the media player track which contains this subtitle data. * @param startTimeUs the start time in microsecond for the subtile data * @param durationUs the duration in microsecond for the subtile data * @param data the data array for the subtile data. It should not be null. * No data copying is made. * @return the same Builder instance. */ public @NonNull Builder setSubtitleData( int trackIndex, long startTimeUs, long durationUs, @NonNull byte[] data) { if (data == null) { throw new IllegalArgumentException("null data is not allowed"); } mTrackIndex = trackIndex; mStartTimeUs = startTimeUs; mDurationUs = durationUs; mData = data; return this; } } } Loading
api/current.txt +4 −1 Original line number Diff line number Diff line Loading @@ -26141,10 +26141,11 @@ package android.media { } public final class MediaTimestamp { ctor public MediaTimestamp(long, long, @FloatRange(from=0.0f, to=java.lang.Float.MAX_VALUE) float); method public long getAnchorMediaTimeUs(); method public long getAnchorSystemNanoTime(); method @Deprecated public long getAnchorSytemNanoTime(); method public float getMediaClockRate(); method @FloatRange(from=0.0f, to=java.lang.Float.MAX_VALUE) public float getMediaClockRate(); field public static final android.media.MediaTimestamp TIMESTAMP_UNKNOWN; } Loading Loading @@ -26472,6 +26473,7 @@ package android.media { } public final class SubtitleData { ctor public SubtitleData(int, long, long, @NonNull byte[]); method @NonNull public byte[] getData(); method public long getDurationUs(); method public long getStartTimeUs(); Loading Loading @@ -26512,6 +26514,7 @@ package android.media { } public final class TimedMetaData { ctor public TimedMetaData(long, @NonNull byte[]); method public byte[] getMetaData(); method public long getTimestamp(); }
api/system-current.txt +0 −21 Original line number Diff line number Diff line Loading @@ -3574,13 +3574,6 @@ package android.media { field public static final int RADIO_TUNER = 1998; // 0x7ce } public static final class MediaTimestamp.Builder { ctor public MediaTimestamp.Builder(); ctor public MediaTimestamp.Builder(@NonNull android.media.MediaTimestamp); method @NonNull public android.media.MediaTimestamp build(); method @NonNull public android.media.MediaTimestamp.Builder setMediaTimestamp(long, long, float); } public class PlayerProxy { method public void pause(); method public void setPan(float); Loading @@ -3590,20 +3583,6 @@ package android.media { method public void stop(); } public static final class SubtitleData.Builder { ctor public SubtitleData.Builder(); ctor public SubtitleData.Builder(@NonNull android.media.SubtitleData); method @NonNull public android.media.SubtitleData build(); method @NonNull public android.media.SubtitleData.Builder setSubtitleData(int, long, long, @NonNull byte[]); } public static final class TimedMetaData.Builder { ctor public TimedMetaData.Builder(); ctor public TimedMetaData.Builder(@NonNull android.media.TimedMetaData); method @NonNull public android.media.TimedMetaData build(); method @NonNull public android.media.TimedMetaData.Builder setTimedMetaData(long, @NonNull byte[]); } } package android.media.audiopolicy { Loading
media/apex/java/android/media/MediaPlayer2.java +13 −20 Original line number Diff line number Diff line Loading @@ -274,8 +274,7 @@ import java.util.concurrent.atomic.AtomicLong; * successful transition. Any other value will be an error. Call {@link #getState()} to * determine the current state. </p> */ public class MediaPlayer2 implements AutoCloseable , AudioRouting { public class MediaPlayer2 implements AutoCloseable, AudioRouting { static { System.loadLibrary("media2_jni"); native_init(); Loading Loading @@ -1810,12 +1809,10 @@ public class MediaPlayer2 implements AutoCloseable public MediaTimestamp getTimestamp() { try { // TODO: get the timestamp from native side return new MediaTimestamp.Builder() .setMediaTimestamp( return new MediaTimestamp( getCurrentPosition() * 1000L, System.nanoTime(), getState() == PLAYER_STATE_PLAYING ? getPlaybackParams().getSpeed() : 0.f) .build(); getState() == PLAYER_STATE_PLAYING ? getPlaybackParams().getSpeed() : 0.f); } catch (IllegalStateException e) { return null; } Loading Loading @@ -2643,13 +2640,11 @@ public class MediaPlayer2 implements AutoCloseable return; } Iterator<Value> in = playerMsg.getValuesList().iterator(); SubtitleData data = new SubtitleData.Builder() .setSubtitleData( SubtitleData data = new SubtitleData( in.next().getInt32Value(), // trackIndex in.next().getInt64Value(), // startTimeUs in.next().getInt64Value(), // durationUs in.next().getBytesValue().toByteArray()) // data .build(); in.next().getBytesValue().toByteArray()); // data sendEvent(new EventNotifier() { @Override public void notify(EventCallback callback) { Loading @@ -2673,11 +2668,9 @@ public class MediaPlayer2 implements AutoCloseable return; } Iterator<Value> in = playerMsg.getValuesList().iterator(); data = new TimedMetaData.Builder() .setTimedMetaData( data = new TimedMetaData( in.next().getInt64Value(), // timestampUs in.next().getBytesValue().toByteArray()) // metaData .build(); in.next().getBytesValue().toByteArray()); // metaData } else { data = null; } Loading
media/java/android/media/MediaTimestamp.java +15 −74 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ package android.media; import android.annotation.NonNull; import android.annotation.SystemApi; import android.annotation.FloatRange; /** * An immutable object that represents the linear correlation between the media time Loading Loading @@ -76,6 +75,7 @@ public final class MediaTimestamp * greater than 1.0 if media clock is faster than the system clock; * less than 1.0 if media clock is slower than the system clock. */ @FloatRange(from = 0.0f, to = Float.MAX_VALUE) public float getMediaClockRate() { return clockRate; } Loading @@ -87,11 +87,19 @@ public final class MediaTimestamp /** @hide - accessor shorthand */ public final float clockRate; /** @hide */ MediaTimestamp(long mediaUs, long systemNs, float rate) { mediaTimeUs = mediaUs; nanoTime = systemNs; clockRate = rate; /** * Constructor. * * @param mediaTimeUs the media time of the anchor in microseconds * @param nanoTimeNs the {@link java.lang.System#nanoTime system time} corresponding to the * media time in nanoseconds. * @param clockRate the rate of the media clock in relation to the system time. */ public MediaTimestamp(long mediaTimeUs, long nanoTimeNs, @FloatRange(from = 0.0f, to = Float.MAX_VALUE) float clockRate) { this.mediaTimeUs = mediaTimeUs; this.nanoTime = nanoTimeNs; this.clockRate = clockRate; } /** @hide */ Loading Loading @@ -120,71 +128,4 @@ public final class MediaTimestamp + " clockRate=" + clockRate + "}"; } /** * Builder class for {@link MediaTimestamp} objects. * <p> Here is an example where <code>Builder</code> is used to define the * {@link MediaTimestamp}: * * <pre class="prettyprint"> * MediaTimestamp mts = new MediaTimestamp.Builder() * .setMediaTimestamp(mediaTime, systemTime, rate) * .build(); * </pre> * @hide */ @SystemApi public static final class Builder { long mMediaTimeUs; long mNanoTime; float mClockRate = 1.0f; /** * Constructs a new Builder with the defaults. */ public Builder() { } /** * Constructs a new Builder from a given {@link MediaTimestamp} instance * @param mts the {@link MediaTimestamp} object whose data will be reused * in the new Builder. */ public Builder(@NonNull MediaTimestamp mts) { if (mts == null) { throw new IllegalArgumentException("null MediaTimestamp is not allowed"); } mMediaTimeUs = mts.mediaTimeUs; mNanoTime = mts.nanoTime; mClockRate = mts.clockRate; } /** * Combines all of the fields that have been set and return a new * {@link MediaTimestamp} object. * * @return a new {@link MediaTimestamp} object */ public @NonNull MediaTimestamp build() { return new MediaTimestamp(mMediaTimeUs, mNanoTime, mClockRate); } /** * Sets the info of media timestamp. * * @param mediaTimeUs the media time of the anchor in microseconds * @param nanoTime the {@link java.lang.System#nanoTime system time} corresponding to * the media time in nanoseconds. * @param clockRate the rate of the media clock in relation to the system time. * @return the same Builder instance. */ public @NonNull Builder setMediaTimestamp( long mediaTimeUs, long nanoTime, float clockRate) { mMediaTimeUs = mediaTimeUs; mNanoTime = nanoTime; mClockRate = clockRate; return this; } } }
media/java/android/media/SubtitleData.java +13 −81 Original line number Diff line number Diff line Loading @@ -17,11 +17,8 @@ package android.media; import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Parcel; import java.util.Arrays; /** * Class encapsulating subtitle data, as received through the * {@link MediaPlayer.OnSubtitleDataListener} interface. Loading Loading @@ -82,12 +79,23 @@ public final class SubtitleData } } /** @hide */ /** * Constructor. * * @param trackIndex the index of the media player track which contains this subtitle data. * @param startTimeUs the start time in microsecond for the subtitle data * @param durationUs the duration in microsecond for the subtitle data * @param data the data array for the subtitle data. It should not be null. * No data copying is made. */ public SubtitleData(int trackIndex, long startTimeUs, long durationUs, @NonNull byte[] data) { if (data == null) { throw new IllegalArgumentException("null data is not allowed"); } mTrackIndex = trackIndex; mStartTimeUs = startTimeUs; mDurationUs = durationUs; mData = (data != null ? data : new byte[0]); mData = data; } /** Loading Loading @@ -141,80 +149,4 @@ public final class SubtitleData return true; } /** * Builder class for {@link SubtitleData} objects. * <p> Here is an example where <code>Builder</code> is used to define the * {@link SubtitleData}: * * <pre class="prettyprint"> * SubtitleData sd = new SubtitleData.Builder() * .setSubtitleData(trackIndex, startTime, duration, data) * .build(); * </pre> * @hide */ @SystemApi public static final class Builder { private int mTrackIndex; private long mStartTimeUs; private long mDurationUs; private byte[] mData = new byte[0]; /** * Constructs a new Builder with the defaults. */ public Builder() { } /** * Constructs a new Builder from a given {@link SubtitleData} instance * @param sd the {@link SubtitleData} object whose data will be reused * in the new Builder. It should not be null. The data array is copied. */ public Builder(@NonNull SubtitleData sd) { if (sd == null) { throw new IllegalArgumentException("null SubtitleData is not allowed"); } mTrackIndex = sd.mTrackIndex; mStartTimeUs = sd.mStartTimeUs; mDurationUs = sd.mDurationUs; if (sd.mData != null) { mData = Arrays.copyOf(sd.mData, sd.mData.length); } } /** * Combines all of the fields that have been set and return a new * {@link SubtitleData} object. <code>IllegalStateException</code> will be * thrown if there is conflict between fields. * * @return a new {@link SubtitleData} object */ public @NonNull SubtitleData build() { return new SubtitleData(mTrackIndex, mStartTimeUs, mDurationUs, mData); } /** * Sets the info of subtitle data. * * @param trackIndex the index of the media player track which contains this subtitle data. * @param startTimeUs the start time in microsecond for the subtile data * @param durationUs the duration in microsecond for the subtile data * @param data the data array for the subtile data. It should not be null. * No data copying is made. * @return the same Builder instance. */ public @NonNull Builder setSubtitleData( int trackIndex, long startTimeUs, long durationUs, @NonNull byte[] data) { if (data == null) { throw new IllegalArgumentException("null data is not allowed"); } mTrackIndex = trackIndex; mStartTimeUs = startTimeUs; mDurationUs = durationUs; mData = data; return this; } } }