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

Commit 9788e7f5 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "audio: Squashed commit of LPA support from CAF" into ics

parents 44a85a17 ef930d15
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -120,6 +120,10 @@ public:
        INPUT_CLOSED,
        INPUT_CONFIG_CHANGED,
        STREAM_CONFIG_CHANGED,
#ifdef WITH_QCOM_LPA
        A2DP_OUTPUT_STATE,
        EFFECT_CONFIG_CHANGED,
#endif
        NUM_CONFIG_EVENTS
    };

@@ -151,6 +155,15 @@ public:
                                        uint32_t format = AUDIO_FORMAT_DEFAULT,
                                        uint32_t channels = AUDIO_CHANNEL_OUT_STEREO,
                                        audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_INDIRECT);
#ifdef WITH_QCOM_LPA
    static audio_io_handle_t getSession(audio_stream_type_t stream,
                                        uint32_t format = AUDIO_FORMAT_DEFAULT,
                                        audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_DIRECT,
                                        int32_t sessionId = -1);
    static void closeSession(audio_io_handle_t output);
    static status_t pauseSession(audio_io_handle_t output, audio_stream_type_t stream);
    static status_t resumeSession(audio_io_handle_t output, audio_stream_type_t stream);
#endif
    static status_t startOutput(audio_io_handle_t output,
                                audio_stream_type_t stream,
                                int session = 0);
+33 −1
Original line number Diff line number Diff line
@@ -172,6 +172,20 @@ public:
                                    void* user          = 0,
                                    int notificationFrames = 0,
                                    int sessionId = 0);
#ifdef WITH_QCOM_LPA
    /* Creates an audio track and registers it with AudioFlinger. With this constructor,
     * session ID of compressed stream can be registered AudioFlinger and AudioHardware,
     * for routing purpose.
     */

                        AudioTrack( int streamType,
                                    uint32_t sampleRate = 0,
                                    int format          = 0,
                                    int channels        = 0,
                                    uint32_t flags      = 0,
                                    int sessionId       = 0,
                                    int lpaSessionId    =-1);
#endif

    /* Terminates the AudioTrack and unregisters it from AudioFlinger.
     * Also destroys all resources assotiated with the AudioTrack.
@@ -198,7 +212,22 @@ public:
                            const sp<IMemory>& sharedBuffer = 0,
                            bool threadCanCallJava = false,
                            int sessionId = 0);

#ifdef WITH_QCOM_LPA
    /* Initialize an AudioTrack and registers session Id for Tunneled audio decoding.
     * Returned status (from utils/Errors.h) can be:
     *  - NO_ERROR: successful intialization
     *  - INVALID_OPERATION: AudioTrack is already intitialized
     *  - BAD_VALUE: invalid parameter (channels, format, sampleRate...)
     *  - NO_INIT: audio server or audio hardware not initialized
     * */
            status_t    set(int streamType      =-1,
                            uint32_t sampleRate = 0,
                            int format          = 0,
                            int channels        = 0,
                            uint32_t flags      = 0,
                            int sessionId       = 0,
                            int lpaSessionId    =-1);
#endif

    /* Result of constructing the AudioTrack. This must be checked
     * before using any AudioTrack API (except for set()), using
@@ -485,6 +514,9 @@ private:
    uint32_t                mUpdatePeriod;
    bool                    mFlushed; // FIXME will be made obsolete by making flush() synchronous
    uint32_t                mFlags;
#ifdef WITH_QCOM_LPA
    audio_io_handle_t       mAudioSession;
#endif
    int                     mSessionId;
    int                     mAuxEffectId;
    Mutex                   mLock;
+32 −0
Original line number Diff line number Diff line
@@ -57,6 +57,22 @@ public:
                                int *sessionId,
                                status_t *status) = 0;

#ifdef WITH_QCOM_LPA
    virtual     void        createSession(
                                pid_t pid,
                                uint32_t sampleRate,
                                int channelCount,
                                int *sessionId,
                                status_t *status) = 0;

    virtual     void        deleteSession() = 0;

    virtual     void        applyEffectsOn(
                                int16_t *buffer1,
                                int16_t *buffer2,
                                int size) = 0;
#endif

    virtual sp<IAudioRecord> openRecord(
                                pid_t pid,
                                int input,
@@ -86,6 +102,9 @@ public:
    virtual     float       masterVolume() const = 0;
    virtual     bool        masterMute() const = 0;

#ifdef WITH_QCOM_LPA
    virtual     status_t    setSessionVolume(int stream, float value, float right) = 0;
#endif
    /* set/get stream type state. This will probably be used by
     * the preference panel, mostly.
     */
@@ -117,6 +136,16 @@ public:
                                    uint32_t *pChannels,
                                    uint32_t *pLatencyMs,
                                    uint32_t flags) = 0;
#ifdef WITH_QCOM_LPA
    virtual int openSession(uint32_t *pDevices,
                                 uint32_t *pFormat,
                                 uint32_t flags,
                                 int32_t  stream,
                                 int32_t  sessionId){return 0;};
    virtual status_t pauseSession(int output, int32_t  stream) = 0;
    virtual status_t resumeSession(int output, int32_t  stream) = 0;
    virtual status_t closeSession(int output) = 0;
#endif
    virtual int openDuplicateOutput(int output1, int output2) = 0;
    virtual status_t closeOutput(int output) = 0;
    virtual status_t suspendOutput(int output) = 0;
@@ -159,6 +188,9 @@ public:
                                    int *enabled) = 0;

    virtual status_t moveEffects(int session, int srcOutput, int dstOutput) = 0;
#ifdef WITH_QCOM_LPA
    virtual status_t deregisterClient(const sp<IAudioFlingerClient>& client) { return false; };
#endif
};


+9 −0
Original line number Diff line number Diff line
@@ -54,6 +54,15 @@ public:
                                        uint32_t format = AUDIO_FORMAT_DEFAULT,
                                        uint32_t channels = 0,
                                        audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_INDIRECT) = 0;
#ifdef WITH_QCOM_LPA
    virtual audio_io_handle_t getSession(audio_stream_type_t stream,
                                        uint32_t format = AUDIO_FORMAT_DEFAULT,
                                        audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_DIRECT,
                                        int32_t  sessionId=-1) { return 0; }
    virtual status_t pauseSession(audio_io_handle_t output, audio_stream_type_t stream) { return 0; }
    virtual status_t resumeSession(audio_io_handle_t output, audio_stream_type_t stream) { return 0; }
    virtual status_t closeSession(audio_io_handle_t output) = 0;
#endif
    virtual status_t startOutput(audio_io_handle_t output,
                                 audio_stream_type_t stream,
                                 int session = 0) = 0;
+13 −0
Original line number Diff line number Diff line
@@ -90,12 +90,25 @@ public:
                AudioCallback cb = NULL,
                void *cookie = NULL) = 0;

#ifdef WITH_QCOM_LPA
        // API to open a routing session for tunneled audio playback
        virtual status_t        openSession(
                int format, int sessionId, uint32_t sampleRate = 44100, int channels = 2) {return 0;};
#endif

        virtual void        start() = 0;
        virtual ssize_t     write(const void* buffer, size_t size) = 0;
        virtual void        stop() = 0;
        virtual void        flush() = 0;
        virtual void        pause() = 0;
#ifdef WITH_QCOM_LPA
        virtual void        pauseSession() {return;};
        virtual void        resumeSession() {return;};
#endif
        virtual void        close() = 0;
#ifdef WITH_QCOM_LPA
        virtual void        closeSession() {return;};
#endif
    };

                        MediaPlayerBase() : mCookie(0), mNotify(0) {}
Loading