summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/media/AudioRecord.h6
-rw-r--r--include/media/AudioSystem.h15
-rw-r--r--include/media/IAudioRecord.h3
-rw-r--r--include/media/ToneGenerator.h3
4 files changed, 24 insertions, 3 deletions
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 5bfb65b..80d2d72 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -30,6 +30,7 @@
#include <utils/threads.h>
#include <system/audio.h>
+#include <media/AudioSystem.h>
namespace android {
@@ -215,8 +216,11 @@ public:
/* After it's created the track is not active. Call start() to
* make it active. If set, the callback will start being called.
+ * if event is not AudioSystem::SYNC_EVENT_NONE, the capture start will be delayed until
+ * the specified event occurs on the specified trigger session.
*/
- status_t start();
+ status_t start(AudioSystem::sync_event_t event = AudioSystem::SYNC_EVENT_NONE,
+ int triggerSession = 0);
/* Stop a track. If set, the callback will cease being called and
* obtainBuffer returns STOPPED. Note that obtainBuffer() still works
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index cc0a594..e64bc3f 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -145,6 +145,21 @@ public:
uint32_t latency;
};
+ // Events used to synchronize actions between audio sessions.
+ // For instance SYNC_EVENT_PRESENTATION_COMPLETE can be used to delay recording start until playback
+ // is complete on another audio session.
+ // See definitions in MediaSyncEvent.java
+ enum sync_event_t {
+ SYNC_EVENT_SAME = -1, // used internally to indicate restart with same event
+ SYNC_EVENT_NONE = 0,
+ SYNC_EVENT_PRESENTATION_COMPLETE,
+
+ //
+ // Define new events here: SYNC_EVENT_START, SYNC_EVENT_STOP, SYNC_EVENT_TIME ...
+ //
+ SYNC_EVENT_CNT,
+ };
+
//
// IAudioPolicyService interface (see AudioPolicyInterface for method descriptions)
//
diff --git a/include/media/IAudioRecord.h b/include/media/IAudioRecord.h
index 089be3b..c486c6b 100644
--- a/include/media/IAudioRecord.h
+++ b/include/media/IAudioRecord.h
@@ -25,7 +25,6 @@
#include <binder/IInterface.h>
#include <binder/IMemory.h>
-
namespace android {
// ----------------------------------------------------------------------------
@@ -39,7 +38,7 @@ public:
* make it active. If set, the callback will start being called.
* tid identifies the client callback thread, or 0 if not needed.
*/
- virtual status_t start(pid_t tid) = 0;
+ virtual status_t start(pid_t tid, int event, int triggerSession) = 0;
/* Stop a track. If set, the callback will cease being called and
* obtainBuffer will return an error. Buffers that are already released
diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h
index df0c97e..29c8fd9 100644
--- a/include/media/ToneGenerator.h
+++ b/include/media/ToneGenerator.h
@@ -159,6 +159,9 @@ public:
bool isInited() { return (mState == TONE_IDLE)?false:true;}
+ // returns the audio session this ToneGenerator belongs to or 0 if an error occured.
+ int getSessionId() { return (mpAudioTrack == NULL) ? 0 : mpAudioTrack->getSessionId(); }
+
private:
enum tone_state {