aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavilla <davilla@4pi.com>2012-05-15 22:03:13 -0400
committerdavilla <davilla@4pi.com>2012-05-15 22:03:52 -0400
commit2e8ed5552f91c5c25c7dbe68b079e1bbe4bc8f66 (patch)
treeb1849611744b06626b00f9c8ada9537e9654f0ea
parentdd64e65c89f17c84e0eba73659e08d5d7f7d15b3 (diff)
[osx/ios] refactor UInt32ToFourCC into a simple string init
-rw-r--r--xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHAL.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHAL.cpp b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHAL.cpp
index babc5a8baa..fdc9f415cf 100644
--- a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHAL.cpp
+++ b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHAL.cpp
@@ -25,19 +25,6 @@
#include <sstream>
-static char* UInt32ToFourCC(UInt32* pVal)
-{
- // NOT NULL TERMINATED! Modifies input value.
- UInt32 inVal = *pVal;
- char* pIn = (char*)&inVal;
- char* fourCC = (char*)pVal;
- fourCC[3] = pIn[0];
- fourCC[2] = pIn[1];
- fourCC[1] = pIn[2];
- fourCC[0] = pIn[3];
- return fourCC;
-}
-
// Helper Functions
std::string GetError(OSStatus error)
{
@@ -61,12 +48,15 @@ std::string GetError(OSStatus error)
const char* StreamDescriptionToString(AudioStreamBasicDescription desc, std::string &str)
{
- UInt32 formatId = desc.mFormatID;
- char fourCC[5];
- fourCC[0]='\0';
- strncat(fourCC, UInt32ToFourCC(&formatId), 4);
- std::stringstream sstr;
-
+ char fourCC[5] = {
+ (desc.mFormatID >> 24) & 0xFF,
+ (desc.mFormatID >> 16) & 0xFF,
+ (desc.mFormatID >> 8) & 0xFF,
+ desc.mFormatID & 0xFF,
+ 0
+ };
+
+ std::stringstream sstr;
switch (desc.mFormatID)
{
case kAudioFormatLinearPCM: