diff options
-rw-r--r-- | sys/osxaudio/gstosxaudiosink.c | 28 | ||||
-rw-r--r-- | sys/osxaudio/gstosxringbuffer.c | 21 |
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; |