summaryrefslogtreecommitdiffstats
path: root/include/media/AudioTrack.h
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2014-06-11 16:55:06 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2014-06-17 16:59:52 -0700
commitfaabb51ceef13bf1e3f692219ac410c1cd75d0de (patch)
treead761b6b94a1fa782774b8a3227ed7b5354112fc /include/media/AudioTrack.h
parent9c68ac03f16cc32625f6965e869432eae4fded2d (diff)
downloadframeworks_av-faabb51ceef13bf1e3f692219ac410c1cd75d0de.zip
frameworks_av-faabb51ceef13bf1e3f692219ac410c1cd75d0de.tar.gz
frameworks_av-faabb51ceef13bf1e3f692219ac410c1cd75d0de.tar.bz2
AudioTrack construction with audio attributes
Store audio attributes in AudioTrack class. When an AudioTrack is "set" with non null audio attributes, derive a stream type that reflects the attributes. When an AudioTrack is "set" without attributes, and only has a stream type, derive default audio attributes. Change-Id: I322b91fa9a7e193118960c5e78cdddd85d66f9ad
Diffstat (limited to 'include/media/AudioTrack.h')
-rw-r--r--include/media/AudioTrack.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 79db323..5dc77a3 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -253,7 +253,8 @@ public:
transfer_type transferType = TRANSFER_DEFAULT,
const audio_offload_info_t *offloadInfo = NULL,
int uid = -1,
- pid_t pid = -1);
+ pid_t pid = -1,
+ audio_attributes_t* pAttributes = NULL);
/* Result of constructing the AudioTrack. This must be checked for successful initialization
* before using any AudioTrack API (except for set()), because using
@@ -586,6 +587,11 @@ protected:
AudioTrack(const AudioTrack& other);
AudioTrack& operator = (const AudioTrack& other);
+ void setAttributesFromStreamType(audio_stream_type_t streamType);
+ void setStreamTypeFromAttributes(audio_attributes_t& aa);
+ /* paa is guaranteed non-NULL */
+ bool isValidAttributes(const audio_attributes_t *paa);
+
/* a small internal class to handle the callback */
class AudioTrackThread : public Thread
{
@@ -667,6 +673,7 @@ protected:
transfer_type mTransfer;
audio_offload_info_t mOffloadInfoCopy;
const audio_offload_info_t* mOffloadInfo;
+ audio_attributes_t mAttributes;
// mFrameSize is equal to mFrameSizeAF for non-PCM or 16-bit PCM data. For 8-bit PCM data, it's
// twice as large as mFrameSize because data is expanded to 16-bit before it's stored in buffer.