summaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
Diffstat (limited to 'include/media')
-rw-r--r--include/media/AudioSystem.h23
-rw-r--r--include/media/AudioTrack.h1
-rw-r--r--include/media/IAudioFlinger.h10
-rw-r--r--include/media/IAudioFlingerClient.h55
-rw-r--r--include/media/JetPlayer.h16
-rw-r--r--include/media/MediaPlayerInterface.h32
-rw-r--r--include/media/PVPlayer.h14
-rw-r--r--include/media/ToneGenerator.h3
8 files changed, 107 insertions, 47 deletions
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index 77676bf..6bd54ba 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -99,23 +99,31 @@ public:
static status_t getOutputSamplingRate(int* samplingRate);
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
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index fd62daa..5b2bab9 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -51,6 +51,7 @@ public:
MUSIC = 3,
ALARM = 4,
NOTIFICATION = 5,
+ BLUETOOTH_SCO = 6,
NUM_STREAM_TYPES
};
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 69703b2..df601d7 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -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;
};
diff --git a/include/media/IAudioFlingerClient.h b/include/media/IAudioFlingerClient.h
new file mode 100644
index 0000000..10c3e0f
--- /dev/null
+++ b/include/media/IAudioFlingerClient.h
@@ -0,0 +1,55 @@
+/*
+ * 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
diff --git a/include/media/JetPlayer.h b/include/media/JetPlayer.h
index 4268170..16764a9 100644
--- a/include/media/JetPlayer.h
+++ b/include/media/JetPlayer.h
@@ -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();
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h
index 30e4578..7f0e7b3 100644
--- a/include/media/MediaPlayerInterface.h
+++ b/include/media/MediaPlayerInterface.h
@@ -17,9 +17,6 @@
#ifndef ANDROID_MEDIAPLAYERINTERFACE_H
#define ANDROID_MEDIAPLAYERINTERFACE_H
-#include <pthread.h>
-#include <signal.h>
-
#ifdef __cplusplus
#include <ui/ISurface.h>
@@ -74,7 +71,6 @@ public:
virtual ~MediaPlayerBase() {}
virtual status_t initCheck() = 0;
virtual bool hardwareOutput() = 0;
- virtual status_t setSigBusHandlerStructTLSKey(pthread_key_t key) { return 0; }
virtual status_t setDataSource(const char *url) = 0;
virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0;
virtual status_t setVideoSurface(const sp<ISurface>& surface) = 0;
@@ -125,34 +121,6 @@ public:
#endif // __cplusplus
-// A thread can set the thread local variable identified by the pthread_key_t
-// that was passed to the player using the setSigBusHandlerStructTLSKey()
-// method to the address of the following structure.
-// If 'handlesigbus' is non-NULL, the function it points to will be called,
-// and if it returns 0, the signal will be assumed to have been handled,
-// and no other action will be taken. If it returns non-zero, the old SIGBUS
-// handler will be called.
-// If 'handlesigbus is NULL, then sigbusvar must be non NULL. The system's
-// SIGBUS handler will map an accessible page filled with zeroes at the
-// location that caused the original fault, set the variable pointed to by
-// sigbusvar to a non-zero value, and exit (which causes the operation to
-// be retried, which should now succeed).
-// If base and len are non zero, which is strongly recommended, they will
-// be used as additional constraints on the signal handler. That is, when
-// specified, the fault address must be in the range specified by base and
-// len in order for handlesigbus() to be called or sigbusvar to be set.
-// If the fault address is outside of the range, the old SIGBUS handler
-// will be called.
-struct mediasigbushandler {
- int (*handlesigbus)(siginfo_t *, struct mediasigbushandler *);
- int *sigbusvar;
- char *base;
- int len;
- // these next two are free for application use
- struct mediasigbushandler *next;
- void *data;
-};
-
#endif // ANDROID_MEDIAPLAYERINTERFACE_H
diff --git a/include/media/PVPlayer.h b/include/media/PVPlayer.h
index 5f302ed..6d98852 100644
--- a/include/media/PVPlayer.h
+++ b/include/media/PVPlayer.h
@@ -20,6 +20,12 @@
#include <utils/Errors.h>
#include <media/MediaPlayerInterface.h>
+#define MAX_OPENCORE_INSTANCES 25
+
+#ifdef MAX_OPENCORE_INSTANCES
+#include <cutils/atomic.h>
+#endif
+
class PlayerDriver;
namespace android {
@@ -31,7 +37,6 @@ public:
virtual ~PVPlayer();
virtual status_t initCheck();
- virtual status_t setSigBusHandlerStructTLSKey(pthread_key_t key);
virtual status_t setDataSource(const char *url);
virtual status_t setDataSource(int fd, int64_t offset, int64_t length);
virtual status_t setVideoSurface(const sp<ISurface>& surface);
@@ -62,10 +67,13 @@ private:
char * mDataSourcePath;
bool mIsDataSourceSet;
sp<ISurface> mSurface;
- void * mMemBase;
- off_t mMemSize;
+ int mSharedFd;
status_t mInit;
int mDuration;
+
+#ifdef MAX_OPENCORE_INSTANCES
+ static volatile int32_t sNumInstances;
+#endif
};
}; // namespace android
diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h
index 0cfdeec7..ec64e4d 100644
--- a/include/media/ToneGenerator.h
+++ b/include/media/ToneGenerator.h
@@ -85,8 +85,6 @@ private:
TONE_RESTARTING //
};
- static const unsigned int NUM_PCM_BUFFERS = 2; // Number of AudioTrack pcm buffers
-
static const unsigned int TONEGEN_MAX_WAVES = 3;
static const unsigned int TONEGEN_MAX_SEGMENTS = 4; // Maximun number of elenemts in
static const unsigned int TONEGEN_INF = 0xFFFFFFFF; // Represents infinite time duration
@@ -127,7 +125,6 @@ private:
const ToneDescriptor *mpNewToneDesc; // pointer to next active tone descriptor
int mSamplingRate; // AudioFlinger Sampling rate
- int mBufferSize; // PCM buffer size in frames
AudioTrack *mpAudioTrack; // Pointer to audio track used for playback
Mutex mLock; // Mutex to control concurent access to ToneGenerator object from audio callback and application API
Mutex mCbkCondLock; // Mutex associated to mWaitCbkCond