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

Commit 5e07b577 authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

auto import from //branches/cupcake/...@130745

parent e5198b62
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -100,22 +100,30 @@ public:
    static status_t getOutputFrameCount(int* frameCount);
    static status_t getOutputLatency(uint32_t* latency);
    
    static status_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount, 
        size_t* buffSize);

    // ----------------------------------------------------------------------------

private:

    class DeathNotifier: public IBinder::DeathRecipient
    class AudioFlingerClient: public IBinder::DeathRecipient, public BnAudioFlingerClient
    {
    public:
        DeathNotifier() {      
        AudioFlingerClient() {      
        }
        
        // DeathRecipient
        virtual void binderDied(const wp<IBinder>& who);
        
        // IAudioFlingerClient
        virtual void audioOutputChanged(uint32_t frameCount, uint32_t samplingRate, uint32_t latency);
        
    };

    static sp<DeathNotifier> gDeathNotifier;
    static sp<AudioFlingerClient> gAudioFlingerClient;

    friend class DeathNotifier;
    friend class AudioFlingerClient;

    static Mutex gLock;
    static sp<IAudioFlinger> gAudioFlinger;
@@ -123,6 +131,13 @@ private:
    static int gOutSamplingRate;
    static int gOutFrameCount;
    static uint32_t gOutLatency;
    
    static size_t gInBuffSize;
    // previous parameters for recording buffer size queries
    static uint32_t gPrevInSamplingRate;
    static int gPrevInFormat;
    static int gPrevInChannelCount;

};

};  // namespace android
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ public:
        MUSIC           = 3,
        ALARM           = 4,
        NOTIFICATION    = 5,
        BLUETOOTH_SCO   = 6,
        NUM_STREAM_TYPES
    };

+10 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <utils/IInterface.h>
#include <media/IAudioTrack.h>
#include <media/IAudioRecord.h>
#include <media/IAudioFlingerClient.h>


namespace android {
@@ -107,6 +108,15 @@ public:
    // Temporary interface, do not use
    // TODO: Replace with a more generic key:value get/set mechanism
    virtual     status_t  setParameter(const char* key, const char* value) = 0;
    
    // register a current process for audio output change notifications
    virtual void registerClient(const sp<IAudioFlingerClient>& client) = 0;
    
    // retrieve the audio recording buffer size
    virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount) = 0;
    
    // force AudioFlinger thread out of standby
    virtual     void        wakeUp() = 0;
};


+55 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ANDROID_IAUDIOFLINGERCLIENT_H
#define ANDROID_IAUDIOFLINGERCLIENT_H


#include <utils/RefBase.h>
#include <utils/IInterface.h>


namespace android {

// ----------------------------------------------------------------------------

class IAudioFlingerClient : public IInterface
{
public:
    DECLARE_META_INTERFACE(AudioFlingerClient);

    // Notifies a change of audio output from/to hardware to/from A2DP.
    virtual void audioOutputChanged(uint32_t frameCount, uint32_t samplingRate, uint32_t latency) = 0;

};


// ----------------------------------------------------------------------------

class BnAudioFlingerClient : public BnInterface<IAudioFlingerClient>
{
public:
    virtual status_t    onTransact( uint32_t code,
                                    const Parcel& data,
                                    Parcel* reply,
                                    uint32_t flags = 0);
};

// ----------------------------------------------------------------------------

}; // namespace android

#endif // ANDROID_IAUDIOFLINGERCLIENT_H
+11 −5
Original line number Diff line number Diff line
@@ -33,9 +33,12 @@ class JetPlayer {

public:

    static const int JET_USERID_UPDATE           = 1;
    static const int JET_NUMQUEUEDSEGMENT_UPDATE = 2;
    static const int JET_PAUSE_UPDATE            = 3;
    // to keep in sync with the JetPlayer class constants
    // defined in frameworks/base/media/java/android/media/JetPlayer.java
    static const int JET_EVENT                   = 1;
    static const int JET_USERID_UPDATE           = 2;
    static const int JET_NUMQUEUEDSEGMENT_UPDATE = 3;
    static const int JET_PAUSE_UPDATE            = 4;

    JetPlayer(jobject javaJetPlayer, 
            int maxTracks = 32, 
@@ -44,7 +47,8 @@ public:
    int init();
    int release();
    
    int openFile(const char* url);
    int loadFromFile(const char* url);
    int loadFromFD(const int fd, const long long offset, const long long length);
    int closeFile();
    int play();
    int pause();
@@ -53,6 +57,7 @@ public:
    int setMuteFlags(EAS_U32 muteFlags, bool sync);
    int setMuteFlag(int trackNum, bool muteFlag, bool sync);
    int triggerClip(int clipId);
    int clearQueue();

    void setEventCallback(jetevent_callback callback);
    
@@ -62,7 +67,8 @@ public:
private:
    static  int         renderThread(void*);
    int                 render();
    void                fireEventOnStatusChange();
    void                fireUpdateOnStatusChange();
    void                fireEventsFromJetQueue();

    JetPlayer() {} // no default constructor
    void dump();
Loading