diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-01-31 17:35:13 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-01-31 17:35:13 +0000 |
commit | d73433cf253652fd2e819618d463b4ba08a506b5 (patch) | |
tree | 3c85fec32a37db613c3e3d70a772465988888087 | |
parent | 9c9b866e1fbb41112f47d5550c1d8482b31cb1bf (diff) | |
parent | a3aac960ba353982e37fac6c1866ffe2b7dc95ae (diff) |
Merge "VideoSize: replace with Size"
-rw-r--r-- | api/current.txt | 9 | ||||
-rw-r--r-- | media/Android.bp | 1 | ||||
-rw-r--r-- | media/apex/java/android/media/MediaPlayer2.java | 10 | ||||
-rw-r--r-- | media/apex/java/android/media/VideoSize.java | 89 |
4 files changed, 7 insertions, 102 deletions
diff --git a/api/current.txt b/api/current.txt index b65150c34f69..7fcee9f447ac 100644 --- a/api/current.txt +++ b/api/current.txt @@ -25506,7 +25506,7 @@ package android.media { method @Nullable public android.media.MediaTimestamp getTimestamp(); method @NonNull public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo(); method @NonNull public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo(@NonNull android.media.DataSourceDesc); - method public android.media.VideoSize getVideoSize(); + method public android.util.Size getVideoSize(); method public boolean isLooping(); method public Object loopCurrent(boolean); method public Object notifyWhenCommandLabelReached(@NonNull Object); @@ -25648,7 +25648,7 @@ package android.media { method public void onMediaTimeDiscontinuity(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaTimestamp); method public void onSubtitleData(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.SubtitleData); method public void onTimedMetaDataAvailable(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.TimedMetaData); - method public void onVideoSizeChanged(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.VideoSize); + method public void onVideoSizeChanged(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.util.Size); } public static final class MediaPlayer2.MetricsConstants { @@ -26553,11 +26553,6 @@ package android.media { method @NonNull public android.media.UriDataSourceDesc.Builder setDataSource(@NonNull android.content.Context, @NonNull android.net.Uri, @Nullable java.util.Map<java.lang.String,java.lang.String>, @Nullable java.util.List<java.net.HttpCookie>); } - public final class VideoSize { - method public int getHeight(); - method public int getWidth(); - } - public interface VolumeAutomation { method @NonNull public android.media.VolumeShaper createVolumeShaper(@NonNull android.media.VolumeShaper.Configuration); } diff --git a/media/Android.bp b/media/Android.bp index d7b8dd23bd6b..c7d5ace1e85d 100644 --- a/media/Android.bp +++ b/media/Android.bp @@ -75,7 +75,6 @@ filegroup { "apex/java/android/media/UriDataSourceDesc.java", "apex/java/android/media/FileDataSourceDesc.java", "apex/java/android/media/CallbackDataSourceDesc.java", - "apex/java/android/media/VideoSize.java", "apex/java/android/media/Media2Utils.java", "apex/java/android/media/MediaPlayer2Utils.java", "apex/java/android/media/MediaPlayer2.java", diff --git a/media/apex/java/android/media/MediaPlayer2.java b/media/apex/java/android/media/MediaPlayer2.java index 0fd496bda251..925ca0dd8a7d 100644 --- a/media/apex/java/android/media/MediaPlayer2.java +++ b/media/apex/java/android/media/MediaPlayer2.java @@ -41,6 +41,7 @@ import android.os.PersistableBundle; import android.os.PowerManager; import android.util.Log; import android.util.Pair; +import android.util.Size; import android.view.Surface; import android.view.SurfaceHolder; @@ -62,7 +63,6 @@ import java.net.URL; import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; @@ -300,7 +300,7 @@ public class MediaPlayer2 implements AutoCloseable private final AtomicLong mSrcIdGenerator = new AtomicLong(0); private volatile float mVolume = 1.0f; - private VideoSize mVideoSize = new VideoSize(0, 0); + private Size mVideoSize = new Size(0, 0); private static ExecutorService sDrmThreadPool = Executors.newCachedThreadPool(); @@ -1527,7 +1527,7 @@ public class MediaPlayer2 implements AutoCloseable * notification {@code EventCallback.onVideoSizeChanged} when the size * is available. */ - public VideoSize getVideoSize() { + public Size getVideoSize() { return mVideoSize; } @@ -2527,7 +2527,7 @@ public class MediaPlayer2 implements AutoCloseable final int width = msg.arg1; final int height = msg.arg2; - mVideoSize = new VideoSize(width, height); + mVideoSize = new Size(width, height); sendEvent(new EventNotifier() { @Override public void notify(EventCallback callback) { @@ -2766,7 +2766,7 @@ public class MediaPlayer2 implements AutoCloseable * @param size the size of the video */ public void onVideoSizeChanged( - @NonNull MediaPlayer2 mp, @NonNull DataSourceDesc dsd, @NonNull VideoSize size) { } + @NonNull MediaPlayer2 mp, @NonNull DataSourceDesc dsd, @NonNull Size size) { } /** * Called to indicate an avaliable timed text diff --git a/media/apex/java/android/media/VideoSize.java b/media/apex/java/android/media/VideoSize.java deleted file mode 100644 index 19631e09853d..000000000000 --- a/media/apex/java/android/media/VideoSize.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.media; - -/** - * Immutable class for describing width and height dimensions. - */ -public final class VideoSize { - /** - * Create a new immutable VideoSize instance. - * - * @param width The width of the video size - * @param height The height of the video size - */ - VideoSize(int width, int height) { - mWidth = width; - mHeight = height; - } - - /** - * Get the width of the video size - * @return width - */ - public int getWidth() { - return mWidth; - } - - /** - * Get the height of the video size - * @return height - */ - public int getHeight() { - return mHeight; - } - - /** - * Check if this video size is equal to another video size. - * <p> - * Two video sizes are equal if and only if both their widths and heights are - * equal. - * </p> - * <p> - * A video size object is never equal to any other type of object. - * </p> - * - * @return {@code true} if the objects were equal, {@code false} otherwise - */ - @Override - public boolean equals(final Object obj) { - if (obj == null) { - return false; - } - if (this == obj) { - return true; - } - if (obj instanceof VideoSize) { - VideoSize other = (VideoSize) obj; - return mWidth == other.mWidth && mHeight == other.mHeight; - } - return false; - } - - /** - * Return the video size represented as a string with the format {@code "WxH"} - * - * @return string representation of the video size - */ - @Override - public String toString() { - return mWidth + "x" + mHeight; - } - - private final int mWidth; - private final int mHeight; -} |