Loading include/media/nbaio/NBAIO.h +4 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,10 @@ enum { // the combinations that are actually needed within AudioFlinger. If the list of combinations grows // too large, then this decision should be re-visited. // Sample rate and channel count are explicit, PCM interleaved 16-bit is assumed. typedef unsigned NBAIO_Format; struct NBAIO_Format { //private: unsigned mPacked; }; extern const NBAIO_Format Format_Invalid; Loading media/libnbaio/NBAIO.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -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: Loading @@ -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: Loading @@ -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; Loading Loading @@ -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. Loading Loading @@ -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 Loading
include/media/nbaio/NBAIO.h +4 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,10 @@ enum { // the combinations that are actually needed within AudioFlinger. If the list of combinations grows // too large, then this decision should be re-visited. // Sample rate and channel count are explicit, PCM interleaved 16-bit is assumed. typedef unsigned NBAIO_Format; struct NBAIO_Format { //private: unsigned mPacked; }; extern const NBAIO_Format Format_Invalid; Loading
media/libnbaio/NBAIO.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -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: Loading @@ -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: Loading @@ -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; Loading Loading @@ -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. Loading Loading @@ -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