OSDN Git Service

New player type values for Open SL ES
authorJean-Michel Trivi <jmtrivi@google.com>
Mon, 26 Dec 2016 23:20:21 +0000 (15:20 -0800)
committerJean-Michel Trivi <jmtrivi@google.com>
Tue, 27 Dec 2016 00:03:22 +0000 (16:03 -0800)
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
media/java/android/media/AudioPlaybackConfiguration.java
media/java/android/media/IAudioService.aidl

index 0a75c85..5e08b9a 100644 (file)
@@ -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
   }
 
index 3382cd9..e610f0b 100644 (file)
@@ -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";
         }
index 151b4d5..d53c937 100644 (file)
@@ -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
 }