From 807313917f269be8d2ed0ba6942775c3b85ba3a9 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Mon, 26 Dec 2016 15:20:21 -0800 Subject: [PATCH] New player type values for Open SL ES Define new player types to describe the two types of AudioPlayer in OpenSL ES: those with a buffer queue source, those that play from a given URI or FD. Add a warning in the interface description of AudioService that changes should be reflected in the native interface too. Test: make, NDK tests to follow Bug: 30955183 Change-Id: I7b530ea6e3b13f238f662ce8b9612e7df574a9c5 --- api/system-current.txt | 3 ++- .../android/media/AudioPlaybackConfiguration.java | 25 ++++++++++++++++------ media/java/android/media/IAudioService.aidl | 9 ++++++++ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 0a75c85c0988..5e08b9abb229 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -21789,7 +21789,8 @@ package android.media { field public static final int PLAYER_TYPE_JAM_AUDIOTRACK = 1; // 0x1 field public static final int PLAYER_TYPE_JAM_MEDIAPLAYER = 2; // 0x2 field public static final int PLAYER_TYPE_JAM_SOUNDPOOL = 3; // 0x3 - field public static final int PLAYER_TYPE_SLES_AUDIOPLAYER = 11; // 0xb + field public static final int PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE = 11; // 0xb + field public static final int PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD = 12; // 0xc field public static final int PLAYER_TYPE_UNKNOWN = -1; // 0xffffffff } diff --git a/media/java/android/media/AudioPlaybackConfiguration.java b/media/java/android/media/AudioPlaybackConfiguration.java index 3382cd95163c..e610f0b7a1c3 100644 --- a/media/java/android/media/AudioPlaybackConfiguration.java +++ b/media/java/android/media/AudioPlaybackConfiguration.java @@ -36,6 +36,9 @@ import java.util.Objects; public final class AudioPlaybackConfiguration implements Parcelable { private final static String TAG = new String("AudioPlaybackConfiguration"); + /** @hide */ + public final static int PLAYER_PIID_INVALID = -1; + // information about the implementation /** * @hide @@ -63,10 +66,16 @@ public final class AudioPlaybackConfiguration implements Parcelable { public final static int PLAYER_TYPE_JAM_SOUNDPOOL = 3; /** * @hide - * Player backed by a C OpenSL ES AudioPlayer player + * Player backed by a C OpenSL ES AudioPlayer player with a BufferQueue source + */ + @SystemApi + public final static int PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE = 11; + /** + * @hide + * Player backed by a C OpenSL ES AudioPlayer player with a URI or FD source */ @SystemApi - public final static int PLAYER_TYPE_SLES_AUDIOPLAYER = 11; + public final static int PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD = 12; /** @hide */ @IntDef({ @@ -74,7 +83,8 @@ public final class AudioPlaybackConfiguration implements Parcelable { PLAYER_TYPE_JAM_AUDIOTRACK, PLAYER_TYPE_JAM_MEDIAPLAYER, PLAYER_TYPE_JAM_SOUNDPOOL, - PLAYER_TYPE_SLES_AUDIOPLAYER + PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE, + PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD, }) @Retention(RetentionPolicy.SOURCE) public @interface PlayerType {} @@ -214,8 +224,8 @@ public final class AudioPlaybackConfiguration implements Parcelable { * @hide * Return the type of player linked to this configuration. The return value is one of * {@link #PLAYER_TYPE_JAM_AUDIOTRACK}, {@link #PLAYER_TYPE_JAM_MEDIAPLAYER}, - * {@link #PLAYER_TYPE_JAM_SOUNDPOOL}, {@link #PLAYER_TYPE_SLES_AUDIOPLAYER}, - * or {@link #PLAYER_TYPE_UNKNOWN}. + * {@link #PLAYER_TYPE_JAM_SOUNDPOOL}, {@link #PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE}, + * {@link #PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD}, or {@link #PLAYER_TYPE_UNKNOWN}. * @return the type of the player. */ @SystemApi @@ -360,7 +370,10 @@ public final class AudioPlaybackConfiguration implements Parcelable { case PLAYER_TYPE_JAM_AUDIOTRACK: return "android.media.AudioTrack"; case PLAYER_TYPE_JAM_MEDIAPLAYER: return "android.media.MediaPlayer"; case PLAYER_TYPE_JAM_SOUNDPOOL: return "android.media.SoundPool"; - case PLAYER_TYPE_SLES_AUDIOPLAYER: return "OpenSL ES AudioPlayer"; + case PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE: + return "OpenSL ES AudioPlayer (Buffer Queue)"; + case PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD: + return "OpenSL ES AudioPlayer (URI/FD)"; default: return "unknown player type - FIXME"; } diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl index 151b4d58fd65..d53c9371a483 100644 --- a/media/java/android/media/IAudioService.aidl +++ b/media/java/android/media/IAudioService.aidl @@ -42,6 +42,13 @@ import android.view.KeyEvent; */ interface IAudioService { + // WARNING: When methods are inserted or deleted, the transaction IDs in + // frameworks/native/include/audiomanager/IAudioManager.h must be updated to match the order + // in this file. + // + // When a method's argument list is changed, BnAudioManager's corresponding serialization code + // (if any) in frameworks/native/services/audiomanager/IAudioManager.cpp must be updated. + oneway void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, String callingPackage, String caller); @@ -182,4 +189,6 @@ interface IAudioService { oneway void playerEvent(in int piid, in int event); oneway void releasePlayer(in int piid); + + // WARNING: read warning at top of file, it is recommended to add new methods at the end } -- 2.11.0