From aba29b77a5742fc920ec62dbc9ddb6f025759d65 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Wed, 22 Apr 2015 23:17:58 -0700 Subject: [PATCH] media: rename MediaSync.configureSurface/AudioTrack to set... Change-Id: Ia1ebf5747959a89635dd45b8966a201397374c71 --- api/current.txt | 4 ++-- api/system-current.txt | 4 ++-- media/java/android/media/MediaSync.java | 32 ++++++++++++++----------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/api/current.txt b/api/current.txt index cb76015ad1c34..09ef131e04ff3 100644 --- a/api/current.txt +++ b/api/current.txt @@ -16346,8 +16346,6 @@ package android.media { public final class MediaSync { ctor public MediaSync(); - method public void configureAudioTrack(android.media.AudioTrack); - method public void configureSurface(android.view.Surface); method public final android.view.Surface createInputSurface(); method public void flush(); method public android.media.PlaybackSettings getPlaybackSettings(); @@ -16355,9 +16353,11 @@ package android.media { method public android.media.MediaTimestamp getTimestamp(); method public void queueAudio(java.nio.ByteBuffer, int, int, long); method public final void release(); + method public void setAudioTrack(android.media.AudioTrack); method public void setCallback(android.media.MediaSync.Callback, android.os.Handler); method public void setPlaybackRate(float, int); method public void setPlaybackSettings(android.media.PlaybackSettings); + method public void setSurface(android.view.Surface); method public void setSyncSettings(android.media.SyncSettings); field public static final int PLAYBACK_RATE_AUDIO_MODE_DEFAULT = 0; // 0x0 field public static final int PLAYBACK_RATE_AUDIO_MODE_RESAMPLE = 2; // 0x2 diff --git a/api/system-current.txt b/api/system-current.txt index f35ad92860248..26a06c352ef91 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -17561,8 +17561,6 @@ package android.media { public final class MediaSync { ctor public MediaSync(); - method public void configureAudioTrack(android.media.AudioTrack); - method public void configureSurface(android.view.Surface); method public final android.view.Surface createInputSurface(); method public void flush(); method public android.media.PlaybackSettings getPlaybackSettings(); @@ -17570,9 +17568,11 @@ package android.media { method public android.media.MediaTimestamp getTimestamp(); method public void queueAudio(java.nio.ByteBuffer, int, int, long); method public final void release(); + method public void setAudioTrack(android.media.AudioTrack); method public void setCallback(android.media.MediaSync.Callback, android.os.Handler); method public void setPlaybackRate(float, int); method public void setPlaybackSettings(android.media.PlaybackSettings); + method public void setSurface(android.view.Surface); method public void setSyncSettings(android.media.SyncSettings); field public static final int PLAYBACK_RATE_AUDIO_MODE_DEFAULT = 0; // 0x0 field public static final int PLAYBACK_RATE_AUDIO_MODE_RESAMPLE = 2; // 0x2 diff --git a/media/java/android/media/MediaSync.java b/media/java/android/media/MediaSync.java index 43d7dcfb8befa..c1f1a7308616c 100644 --- a/media/java/android/media/MediaSync.java +++ b/media/java/android/media/MediaSync.java @@ -39,13 +39,13 @@ import java.util.List; *

MediaSync is generally used like this: *

  * MediaSync sync = new MediaSync();
- * sync.configureSurface(surface);
+ * sync.setSurface(surface);
  * Surface inputSurface = sync.createInputSurface();
  * ...
  * // MediaCodec videoDecoder = ...;
  * videoDecoder.configure(format, inputSurface, ...);
  * ...
- * sync.configureAudioTrack(audioTrack);
+ * sync.setAudioTrack(audioTrack);
  * sync.setCallback(new MediaSync.Callback() {
  *     {@literal @Override}
  *     public void onReturnAudioBuffer(MediaSync sync, ByteBuffer audioBuffer, int bufferIndex) {
@@ -95,8 +95,8 @@ import java.util.List;
  *
  * 
* - * The client needs to configure corresponding sink (i.e., Surface and AudioTrack) based on - * the stream type it will play. + * The client needs to configure corresponding sink by setting the Surface and/or AudioTrack + * based on the stream type it will play. *

* For video, the client needs to call {@link #createInputSurface} to obtain a surface on * which it will render video frames. @@ -234,29 +234,33 @@ final public class MediaSync { } /** - * Configures the output surface for MediaSync. + * Sets the output surface for MediaSync. + *

+ * Currently, this is only supported in the Initialized state. * * @param surface Specify a surface on which to render the video data. - * @throws IllegalArgumentException if the surface has been released, or is invalid. + * @throws IllegalArgumentException if the surface has been released, is invalid, * or can not be connected. - * @throws IllegalStateException if not in the Initialized state, or another surface - * has already been configured. + * @throws IllegalStateException if setting the surface is not supported, e.g. + * not in the Initialized state, or another surface has already been configured. */ - public void configureSurface(@Nullable Surface surface) { + public void setSurface(@Nullable Surface surface) { native_configureSurface(surface); } private native final void native_configureSurface(@Nullable Surface surface); /** - * Configures the audio track for MediaSync. + * Sets the audio track for MediaSync. + *

+ * Currently, this is only supported in the Initialized state. * * @param audioTrack Specify an AudioTrack through which to render the audio data. * @throws IllegalArgumentException if the audioTrack has been released, or is invalid. - * @throws IllegalStateException if not in the Initialized state, or another audio track - * has already been configured. + * @throws IllegalStateException if setting the audio track is not supported, e.g. + * not in the Initialized state, or another audio track has already been configured. */ - public void configureAudioTrack(@Nullable AudioTrack audioTrack) { + public void setAudioTrack(@Nullable AudioTrack audioTrack) { // AudioTrack has sanity check for configured sample rate. int nativeSampleRateInHz = (audioTrack == null ? 0 : audioTrack.getSampleRate()); @@ -272,7 +276,7 @@ final public class MediaSync { /** * Requests a Surface to use as the input. This may only be called after - * {@link #configureSurface}. + * {@link #setSurface}. *

* The application is responsible for calling release() on the Surface when * done.