summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJosep Torra <n770galaxy@gmail.com>2012-06-01 16:37:00 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-06-01 16:38:22 +0200
commit85102c49d57c984f60474a6171fd0070f2e62351 (patch)
treed51cfe135cc986f43708891de00d04334253383f /sys
parent79d20f7ee9ea6f34fb43756d092205f0c58c501f (diff)
osxaudiosink: Add support for int audio
Diffstat (limited to 'sys')
-rw-r--r--sys/osxaudio/gstosxaudiosink.c28
-rw-r--r--sys/osxaudio/gstosxringbuffer.c21
2 files changed, 45 insertions, 4 deletions
diff --git a/sys/osxaudio/gstosxaudiosink.c b/sys/osxaudio/gstosxaudiosink.c
index c11d0ddfe..639f49915 100644
--- a/sys/osxaudio/gstosxaudiosink.c
+++ b/sys/osxaudio/gstosxaudiosink.c
@@ -98,6 +98,34 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
"signed = (boolean) { TRUE }, "
"width = (int) 32, "
"depth = (int) 32, "
+ "rate = (int) [1, MAX], "
+ "channels = (int) [1, MAX];"
+ "audio/x-raw-int, "
+ "endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
+ "signed = (boolean) { TRUE }, "
+ "width = (int) 32, "
+ "depth = (int) 32, "
+ "rate = (int) [1, MAX], "
+ "channels = (int) [1, MAX];"
+ "audio/x-raw-int, "
+ "endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
+ "signed = (boolean) { TRUE }, "
+ "width = (int) 24, "
+ "depth = (int) 24, "
+ "rate = (int) [1, MAX], "
+ "channels = (int) [1, MAX];"
+ "audio/x-raw-int, "
+ "endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
+ "signed = (boolean) { TRUE }, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [1, MAX], "
+ "channels = (int) [1, MAX];"
+ "audio/x-raw-int, "
+ "endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
+ "signed = (boolean) { TRUE }, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
"rate = (int) [1, MAX], " "channels = (int) [1, MAX]")
);
diff --git a/sys/osxaudio/gstosxringbuffer.c b/sys/osxaudio/gstosxringbuffer.c
index 095efc149..e59889f52 100644
--- a/sys/osxaudio/gstosxringbuffer.c
+++ b/sys/osxaudio/gstosxringbuffer.c
@@ -329,6 +329,7 @@ gst_osx_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
int layoutSize;
int element;
int i;
+ int width, depth;
AudioUnitScope scope;
gboolean ret = FALSE;
GstStructure *structure;
@@ -341,10 +342,22 @@ gst_osx_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
format.mFormatID = kAudioFormatLinearPCM;
format.mSampleRate = (double) spec->rate;
format.mChannelsPerFrame = spec->channels;
- format.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
- format.mBytesPerFrame = spec->channels * sizeof (float);
- format.mBitsPerChannel = sizeof (float) * 8;
- format.mBytesPerPacket = spec->channels * sizeof (float);
+ if (spec->type == GST_BUFTYPE_FLOAT) {
+ format.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+ width = depth = spec->width;
+ } else {
+ format.mFormatFlags = kAudioFormatFlagIsSignedInteger;
+ width = spec->width;
+ depth = spec->depth;
+ if (width == depth) {
+ format.mFormatFlags |= kAudioFormatFlagIsPacked;
+ } else {
+ format.mFormatFlags |= kAudioFormatFlagIsAlignedHigh;
+ }
+ }
+ format.mBytesPerFrame = spec->channels * (width >> 3);
+ format.mBitsPerChannel = depth;
+ format.mBytesPerPacket = spec->channels * (width >> 3);
format.mFramesPerPacket = 1;
format.mReserved = 0;