diff options
author | Glenn Kasten <gkasten@google.com> | 2014-01-31 09:39:01 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2014-02-03 17:11:01 -0800 |
commit | c4b8b32dec91a11a83d0a7ab49747606d16d39a5 (patch) | |
tree | 0f2dac4e728016b9c9244efef0a58062dad6725d /media/libnbaio | |
parent | 6e0d67d7b496ce17c0970a4ffd3a6f808860949c (diff) | |
download | frameworks_av-c4b8b32dec91a11a83d0a7ab49747606d16d39a5.zip frameworks_av-c4b8b32dec91a11a83d0a7ab49747606d16d39a5.tar.gz frameworks_av-c4b8b32dec91a11a83d0a7ab49747606d16d39a5.tar.bz2 |
Change NBAIO_Format from typedef to struct
This will make it easier to support arbitrary sample rates,
channel counts, and sample formats in NBAIO.
Change-Id: I5eda412648b094358f5eefc38300e9ec8a734cd3
Diffstat (limited to 'media/libnbaio')
-rw-r--r-- | media/libnbaio/NBAIO.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/media/libnbaio/NBAIO.cpp b/media/libnbaio/NBAIO.cpp index 18e0252..f630236 100644 --- a/media/libnbaio/NBAIO.cpp +++ b/media/libnbaio/NBAIO.cpp @@ -58,7 +58,7 @@ unsigned Format_sampleRate(const NBAIO_Format& format) if (!Format_isValid(format)) { return 0; } - switch (format & Format_SR_Mask) { + switch (format.mPacked & Format_SR_Mask) { case Format_SR_8000: return 8000; case Format_SR_11025: @@ -85,7 +85,7 @@ unsigned Format_channelCount(const NBAIO_Format& format) if (!Format_isValid(format)) { return 0; } - switch (format & Format_C_Mask) { + switch (format.mPacked & Format_C_Mask) { case Format_C_1: return 1; case Format_C_2: @@ -97,7 +97,7 @@ unsigned Format_channelCount(const NBAIO_Format& format) NBAIO_Format Format_from_SR_C(unsigned sampleRate, unsigned channelCount) { - NBAIO_Format format; + unsigned format; switch (sampleRate) { case 8000: format = Format_SR_8000; @@ -136,7 +136,9 @@ NBAIO_Format Format_from_SR_C(unsigned sampleRate, unsigned channelCount) default: return Format_Invalid; } - return format; + NBAIO_Format ret; + ret.mPacked = format; + return ret; } // This is a default implementation; it is expected that subclasses will optimize this. @@ -237,12 +239,12 @@ ssize_t NBAIO_Port::negotiate(const NBAIO_Format offers[], size_t numOffers, bool Format_isValid(const NBAIO_Format& format) { - return format != Format_Invalid; + return format.mPacked != Format_Invalid.mPacked; } bool Format_isEqual(const NBAIO_Format& format1, const NBAIO_Format& format2) { - return format1 == format2; + return format1.mPacked == format2.mPacked; } } // namespace android |