Пример #1
0
const char* StreamDescriptionToString(AudioStreamBasicDescription desc, CStdString& str)
{
  UInt32 formatId = desc.mFormatID;
  char* fourCC = UInt32ToFourCC(&formatId);
  
  switch (desc.mFormatID)
  {
    case kAudioFormatLinearPCM:
      str.Format("[%4.4s] %s%u Channel %u-bit %s (%uHz)", 
                 fourCC,
                 (desc.mFormatFlags & kAudioFormatFlagIsNonMixable) ? "" : "Mixable ",
                 desc.mChannelsPerFrame,
                 desc.mBitsPerChannel,
                 (desc.mFormatFlags & kAudioFormatFlagIsFloat) ? "Floating Point" : "Signed Integer",
                 (UInt32)desc.mSampleRate);
      break;
    case kAudioFormatAC3:
      str.Format("[%4.4s] AC-3/DTS (%uHz)", fourCC, (UInt32)desc.mSampleRate);
      break;
    case kAudioFormat60958AC3:
      str.Format("[%4.4s] AC-3/DTS for S/PDIF (%uHz)", fourCC, (UInt32)desc.mSampleRate);
      break;
    default:
      str.Format("[%4.4s]", fourCC);
      break;
  }
  return str.c_str();
}
Пример #2
0
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;
 
  switch (desc.mFormatID)
  {
    case kAudioFormatLinearPCM:
      sstr  << "["
            << fourCC
            << "] "
            << ((desc.mFormatFlags & kAudioFormatFlagIsNonMixable) ? "" : "Mixable " )
            << ((desc.mFormatFlags & kAudioFormatFlagIsNonInterleaved) ? "Non-" : "" )
            << "Interleaved "
            << desc.mChannelsPerFrame
            << " Channel "
            << desc.mBitsPerChannel
            << "-bit "
            << ((desc.mFormatFlags & kAudioFormatFlagIsFloat) ? "Floating Point " : "Signed Integer ")
            << ((desc.mFormatFlags & kAudioFormatFlagIsBigEndian) ? "BE" : "LE")
            << " ("
            << (UInt32)desc.mSampleRate
            << "Hz)";
      str = sstr.str();
      break;
    case kAudioFormatAC3:
      sstr  << "["
            << fourCC
            << "] "
            << ((desc.mFormatFlags & kAudioFormatFlagIsBigEndian) ? "BE" : "LE")
            << " AC-3/DTS ("
            << (UInt32)desc.mSampleRate
            << "Hz)";
      str = sstr.str();                
      break;
    case kAudioFormat60958AC3:
      sstr  << "["
            << fourCC
            << "] AC-3/DTS for S/PDIF ("
            << (UInt32)desc.mSampleRate
            << "Hz)";
      str = sstr.str();
      break;
    default:
      sstr  << "["
            << fourCC
            << "]";
      break;
  }
  return str.c_str();
}