/** * @throws OSStatusException * @since Available in iOS 4.0 and later. */ @WeaklyLinked public AudioStreamPacketDescription[] getAudioStreamPacketDescriptions(@MachineSizedUInt long packetDescriptionsSize) throws OSStatusException { AudioStreamPacketDescription description = new AudioStreamPacketDescription(); OSStatus status = getAudioStreamPacketDescriptions0(packetDescriptionsSize, description, null); OSStatusException.throwIfNecessary(status); return description.toArray((int)packetDescriptionsSize); } /**
public AudioStreamPacketDescription(long startOffset, int variableFramesInPacket, int dataByteSize) { this.setStartOffset(startOffset); this.setVariableFramesInPacket(variableFramesInPacket); this.setDataByteSize(dataByteSize); } /*</constructors>*/
/** * @throws OSStatusException * @since Available in iOS 8.0 and later. */ @WeaklyLinked public static CMSampleBuffer createAudioSampleBuffer(CMBlockBuffer dataBuffer, CMFormatDescription formatDescription, @MachineSizedSInt long numSamples, @ByVal CMTime sbufPTS, AudioStreamPacketDescription[] packetDescriptions) throws OSStatusException { long refconId = CMSampleBuffer.refconId.getAndIncrement(); AudioStreamPacketDescription packetDescriptionPtr = Struct.allocate(AudioStreamPacketDescription.class, (int)numSamples); packetDescriptionPtr.update(packetDescriptions); CMSampleBufferPtr ptr = new CMSampleBufferPtr(); OSStatus status = createAudioSampleBuffer0(null, dataBuffer, formatDescription, numSamples, sbufPTS, packetDescriptionPtr, ptr); if (OSStatusException.throwIfNecessary(status)) { CMSampleBuffer buffer = ptr.get(); buffer.localRefconId = refconId; return buffer; } return null; }
@Callback private static void cbInput(@Pointer long userData, AudioQueue queue, @Pointer long buffer, AudioTimeStamp startTime, int numberPacketDescs, AudioStreamPacketDescription packetDescs) { synchronized (inputCallbacks) { inputCallbacks.get(userData).onInput(queue, buffer, startTime, packetDescs.toArray(numberPacketDescs)); } } @Callback
@Callback private static void cbParsePackets(@Pointer long clientData, int numberBytes, int numberPackets, @Pointer long inputData, AudioStreamPacketDescription packetDescriptions) { synchronized (parseListeners) { parseListeners.get(clientData).onPacketsParsed(numberBytes, inputData, packetDescriptions.toArray(numberPackets)); } }
public AudioStreamPacketDescription(long startOffset, int variableFramesInPacket, int dataByteSize) { this.setStartOffset(startOffset); this.setVariableFramesInPacket(variableFramesInPacket); this.setDataByteSize(dataByteSize); } /*</constructors>*/
/** * @throws OSStatusException * @since Available in iOS 4.0 and later. */ @WeaklyLinked public AudioStreamPacketDescription[] getAudioStreamPacketDescriptions(@MachineSizedUInt long packetDescriptionsSize) throws OSStatusException { AudioStreamPacketDescription description = new AudioStreamPacketDescription(); OSStatus status = getAudioStreamPacketDescriptions0(packetDescriptionsSize, description, null); OSStatusException.throwIfNecessary(status); return description.toArray((int)packetDescriptionsSize); } /**
@Callback private static void cbInput(@Pointer long userData, AudioQueue queue, @Pointer long buffer, AudioTimeStamp startTime, int numberPacketDescs, AudioStreamPacketDescription packetDescs) { synchronized (inputCallbacks) { inputCallbacks.get(userData).onInput(queue, buffer, startTime, packetDescs.toArray(numberPacketDescs)); } } @Callback
/** * @throws OSStatusException * @since Available in iOS 4.0 and later. */ @WeaklyLinked public static CMSampleBuffer createAudioSampleBuffer(CMBlockBuffer dataBuffer, boolean dataReady, MakeDataReadyCallback callback, CMFormatDescription formatDescription, @MachineSizedSInt long numSamples, @ByVal CMTime sbufPTS, AudioStreamPacketDescription[] packetDescriptions) throws OSStatusException { long refconId = CMSampleBuffer.refconId.getAndIncrement(); AudioStreamPacketDescription packetDescriptionPtr = Struct.allocate(AudioStreamPacketDescription.class, (int)numSamples); packetDescriptionPtr.update(packetDescriptions); CMSampleBufferPtr ptr = new CMSampleBufferPtr(); OSStatus status = createAudioSampleBuffer0(null, dataBuffer, dataReady, new FunctionPtr(cbMakeDataReady), refconId, formatDescription, numSamples, sbufPTS, packetDescriptionPtr, ptr); if (OSStatusException.throwIfNecessary(status)) { CMSampleBuffer buffer = ptr.get(); buffer.localRefconId = refconId; synchronized (makeDataReadyCallbacks) { makeDataReadyCallbacks.put(refconId, callback); } return buffer; } return null; } /**
public AudioStreamPacketDescription(long startOffset, int variableFramesInPacket, int dataByteSize) { this.setStartOffset(startOffset); this.setVariableFramesInPacket(variableFramesInPacket); this.setDataByteSize(dataByteSize); } /*</constructors>*/
/** * @throws OSStatusException * @since Available in iOS 4.0 and later. */ @WeaklyLinked public AudioStreamPacketDescription[] getAudioStreamPacketDescriptions(@MachineSizedUInt long packetDescriptionsSize) throws OSStatusException { AudioStreamPacketDescription description = new AudioStreamPacketDescription(); OSStatus status = getAudioStreamPacketDescriptions0(packetDescriptionsSize, description, null); OSStatusException.throwIfNecessary(status); return description.toArray((int)packetDescriptionsSize); } /**
@Callback private static void cbInput(@Pointer long userData, AudioQueue queue, @Pointer long buffer, AudioTimeStamp startTime, int numberPacketDescs, AudioStreamPacketDescription packetDescs) { synchronized (inputCallbacks) { inputCallbacks.get(userData).onInput(queue, buffer, startTime, packetDescs.toArray(numberPacketDescs)); } } @Callback
/** * @throws OSStatusException * @since Available in iOS 8.0 and later. */ @WeaklyLinked public static CMSampleBuffer createAudioSampleBuffer(CMBlockBuffer dataBuffer, CMFormatDescription formatDescription, @MachineSizedSInt long numSamples, @ByVal CMTime sbufPTS, AudioStreamPacketDescription[] packetDescriptions) throws OSStatusException { long refconId = CMSampleBuffer.refconId.getAndIncrement(); AudioStreamPacketDescription packetDescriptionPtr = Struct.allocate(AudioStreamPacketDescription.class, (int)numSamples); packetDescriptionPtr.update(packetDescriptions); CMSampleBufferPtr ptr = new CMSampleBufferPtr(); OSStatus status = createAudioSampleBuffer0(null, dataBuffer, formatDescription, numSamples, sbufPTS, packetDescriptionPtr, ptr); if (OSStatusException.throwIfNecessary(status)) { CMSampleBuffer buffer = ptr.get(); buffer.localRefconId = refconId; return buffer; } return null; }
@Callback private static void cbParsePackets(@Pointer long clientData, int numberBytes, int numberPackets, @Pointer long inputData, AudioStreamPacketDescription packetDescriptions) { synchronized (parseListeners) { parseListeners.get(clientData).onPacketsParsed(numberBytes, inputData, packetDescriptions.toArray(numberPackets)); } }
/** * @throws OSStatusException * @since Available in iOS 8.0 and later. */ @WeaklyLinked public static CMSampleBuffer createAudioSampleBuffer(CMBlockBuffer dataBuffer, CMFormatDescription formatDescription, @MachineSizedSInt long numSamples, @ByVal CMTime sbufPTS, AudioStreamPacketDescription[] packetDescriptions) throws OSStatusException { long refconId = CMSampleBuffer.refconId.getAndIncrement(); AudioStreamPacketDescription packetDescriptionPtr = Struct.allocate(AudioStreamPacketDescription.class, (int)numSamples); packetDescriptionPtr.update(packetDescriptions); CMSampleBufferPtr ptr = new CMSampleBufferPtr(); OSStatus status = createAudioSampleBuffer0(null, dataBuffer, formatDescription, numSamples, sbufPTS, packetDescriptionPtr, ptr); if (OSStatusException.throwIfNecessary(status)) { CMSampleBuffer buffer = ptr.get(); buffer.localRefconId = refconId; return buffer; } return null; }
@Callback private static void cbParsePackets(@Pointer long clientData, int numberBytes, int numberPackets, @Pointer long inputData, AudioStreamPacketDescription packetDescriptions) { synchronized (parseListeners) { parseListeners.get(clientData).onPacketsParsed(numberBytes, inputData, packetDescriptions.toArray(numberPackets)); } }
/** * @throws OSStatusException * @since Available in iOS 4.0 and later. */ @WeaklyLinked public static CMSampleBuffer createAudioSampleBuffer(CMBlockBuffer dataBuffer, boolean dataReady, MakeDataReadyCallback callback, CMFormatDescription formatDescription, @MachineSizedSInt long numSamples, @ByVal CMTime sbufPTS, AudioStreamPacketDescription[] packetDescriptions) throws OSStatusException { long refconId = CMSampleBuffer.refconId.getAndIncrement(); AudioStreamPacketDescription packetDescriptionPtr = Struct.allocate(AudioStreamPacketDescription.class, (int)numSamples); packetDescriptionPtr.update(packetDescriptions); CMSampleBufferPtr ptr = new CMSampleBufferPtr(); OSStatus status = createAudioSampleBuffer0(null, dataBuffer, dataReady, new FunctionPtr(cbMakeDataReady), refconId, formatDescription, numSamples, sbufPTS, packetDescriptionPtr, ptr); if (OSStatusException.throwIfNecessary(status)) { CMSampleBuffer buffer = ptr.get(); buffer.localRefconId = refconId; synchronized (makeDataReadyCallbacks) { makeDataReadyCallbacks.put(refconId, callback); } return buffer; } return null; } /**
/** * @throws OSStatusException * @since Available in iOS 4.0 and later. */ @WeaklyLinked public static CMSampleBuffer createAudioSampleBuffer(CMBlockBuffer dataBuffer, boolean dataReady, MakeDataReadyCallback callback, CMFormatDescription formatDescription, @MachineSizedSInt long numSamples, @ByVal CMTime sbufPTS, AudioStreamPacketDescription[] packetDescriptions) throws OSStatusException { long refconId = CMSampleBuffer.refconId.getAndIncrement(); AudioStreamPacketDescription packetDescriptionPtr = Struct.allocate(AudioStreamPacketDescription.class, (int)numSamples); packetDescriptionPtr.update(packetDescriptions); CMSampleBufferPtr ptr = new CMSampleBufferPtr(); OSStatus status = createAudioSampleBuffer0(null, dataBuffer, dataReady, new FunctionPtr(cbMakeDataReady), refconId, formatDescription, numSamples, sbufPTS, packetDescriptionPtr, ptr); if (OSStatusException.throwIfNecessary(status)) { CMSampleBuffer buffer = ptr.get(); buffer.localRefconId = refconId; synchronized (makeDataReadyCallbacks) { makeDataReadyCallbacks.put(refconId, callback); } return buffer; } return null; } /**