Qt 4.8
Functions
qaudiodeviceinfo_mac_p.cpp File Reference
#include <QtCore/qstringlist.h>
#include <QtCore/qlist.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qdatastream.h>
#include <QtCore/qdebug.h>
#include <private/qcore_mac_p.h>
#include <QtMultimedia/qaudiodeviceinfo.h>
#include "qaudio_mac_p.h"
#include "qaudiodeviceinfo_mac_p.h"

Go to the source code of this file.

Functions

static QByteArray get_device_info (AudioDeviceID audioDevice, QAudio::Mode mode)
 

Function Documentation

◆ get_device_info()

static QByteArray get_device_info ( AudioDeviceID  audioDevice,
QAudio::Mode  mode 
)
static

Definition at line 272 of file qaudiodeviceinfo_mac_p.cpp.

273 {
274  UInt32 size;
275  QByteArray device;
276  QDataStream ds(&device, QIODevice::WriteOnly);
277  AudioStreamBasicDescription sf;
279  Boolean isInput = mode == QAudio::AudioInput;
280 
281  // Id
282  ds << quint32(audioDevice);
283 
284  // Mode
285  size = sizeof(AudioStreamBasicDescription);
286  if (AudioDeviceGetProperty(audioDevice, 0, isInput, kAudioDevicePropertyStreamFormat,
287  &size, &sf) != noErr) {
288  return QByteArray();
289  }
290  ds << quint32(mode);
291 
292  // Name
293  size = sizeof(CFStringRef);
294  if (AudioDeviceGetProperty(audioDevice, 0, isInput, kAudioObjectPropertyName,
295  &size, &name) != noErr) {
296  qWarning() << "QAudioDeviceInfo: Unable to find device name";
297  }
298  ds << QCFString::toQString(name);
299 
300  CFRelease(name);
301 
302  return device;
303 }
const struct __CFString * CFStringRef
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static QString toQString(CFStringRef cfstr)
Definition: qcore_mac.cpp:47
const char * name
Q_CORE_EXPORT void qWarning(const char *,...)
unsigned int quint32
Definition: qglobal.h:938
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71