Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80731391 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

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
parent 2c80a038
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
  }
+19 −6
Original line number Diff line number Diff line
@@ -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";
        }
+9 −0
Original line number Diff line number Diff line
@@ -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
}