static CMTimeRange() { var lib = Dlfcn.dlopen(Constants.CoreMediaLibrary, 0); if (lib != IntPtr.Zero) { try { var retZero = Dlfcn.dlsym(lib, "kCMTimeRangeZero"); Zero = (CMTimeRange)Marshal.PtrToStructure(retZero, typeof(CMTimeRange)); var retInvalid = Dlfcn.dlsym(lib, "kCMTimeRangeInvalid"); #if !XAMCORE_3_0 Invalid = (CMTimeRange)Marshal.PtrToStructure(retInvalid, typeof(CMTimeRange)); #endif InvalidRange = (CMTimeRange)Marshal.PtrToStructure(retInvalid, typeof(CMTimeRange)); var retMappingInvalid = Dlfcn.dlsym(lib, "kCMTimeMappingInvalid"); if (retMappingInvalid != IntPtr.Zero) { InvalidMapping = (CMTimeRange)Marshal.PtrToStructure(retMappingInvalid, typeof(CMTimeRange)); } TimeMappingSourceKey = Dlfcn.GetStringConstant(lib, "kCMTimeMappingSourceKey"); TimeMappingTargetKey = Dlfcn.GetStringConstant(lib, "kCMTimeMappingTargetKey"); } finally { Dlfcn.dlclose(lib); } } }
// Convenience method taking a strong dictionary public static VTMultiPassStorage Create( VTMultiPassStorageCreationOptions options, NSUrl fileUrl = null, CMTimeRange? timeRange = null) { return Create (fileUrl, timeRange, options != null ? options.Dictionary : null); }
public static VTFrameSilo Create (NSUrl fileUrl = null, CMTimeRange? timeRange = null) { IntPtr ret; var status = VTFrameSiloCreate ( IntPtr.Zero, fileUrl == null ? IntPtr.Zero : fileUrl.Handle, timeRange ?? CMTimeRange.Invalid, IntPtr.Zero, out ret); if (status != VTStatus.Ok) return null; return new VTFrameSilo (ret, true); }
public static VTMultiPassStorage Create( NSUrl fileUrl = null, CMTimeRange? timeRange = null, NSDictionary options = null) { IntPtr ret; var status = VTMultiPassStorageCreate ( IntPtr.Zero, fileUrl == null ? IntPtr.Zero : fileUrl.Handle, timeRange ?? CMTimeRange.Invalid, options == null ? IntPtr.Zero : options.Handle, out ret); if (status != VTStatus.Ok) return null; return new VTMultiPassStorage (ret, true); }
extern static /* OSStatus */ MTAudioProcessingTapError MTAudioProcessingTapGetSourceAudio ( /* MTAudioProcessingTapRef */ IntPtr tap, int numberFrames, /* AudioBufferList* */ IntPtr bufferListInOut, out MTAudioProcessingTapFlags flagsOut, out CMTimeRange timeRangeOut, out int numberFramesOut);
public MTAudioProcessingTapError GetSourceAudio (long frames, ref AudioBufferList bufferList, out MTAudioProcessingTapFlags flags, out CMTimeRange timeRange, long framesProvided) { int outFp; return MTAudioProcessingTapGetSourceAudio (handle, (int) frames, ref bufferList, out flags, out timeRange, out outFp); }
static CMTimeRange() { var lib = Dlfcn.dlopen (Constants.CoreMediaLibrary, 0); if (lib != IntPtr.Zero) { try { var retZero = Dlfcn.dlsym (lib, "kCMTimeRangeZero"); Zero = (CMTimeRange)Marshal.PtrToStructure (retZero, typeof(CMTimeRange)); var retInvalid = Dlfcn.dlsym (lib, "kCMTimeRangeInvalid"); #if !XAMCORE_3_0 Invalid = (CMTimeRange)Marshal.PtrToStructure (retInvalid, typeof(CMTimeRange)); #endif InvalidRange = (CMTimeRange)Marshal.PtrToStructure (retInvalid, typeof(CMTimeRange)); var retMappingInvalid = Dlfcn.dlsym (lib, "kCMTimeMappingInvalid"); if (retMappingInvalid != IntPtr.Zero) InvalidMapping = (CMTimeRange)Marshal.PtrToStructure (retMappingInvalid, typeof(CMTimeRange)); TimeMappingSourceKey = Dlfcn.GetStringConstant (lib, "kCMTimeMappingSourceKey"); TimeMappingTargetKey = Dlfcn.GetStringConstant (lib, "kCMTimeMappingTargetKey"); } finally { Dlfcn.dlclose (lib); } } }
extern static /* OSStatus */ VTStatus VTFrameSiloCallFunctionForEachSampleBuffer ( /* VTFrameSiloRef */ IntPtr silo, /* CMTimeRange */ CMTimeRange timeRange, // CMTimeRange.Invalid retrieves all sample buffers /* void* */ IntPtr callbackInfo, /* */ EachSampleBufferCallback callback);
static extern CMTimeMapping CMTimeMappingMake(CMTimeRange source, CMTimeRange target);
public static CMTimeMapping Create(CMTimeRange source, CMTimeRange target) { return(CMTimeMappingMake(source, target)); }
public VTStatus GetTimeRangesForNextPass (out CMTimeRange [] timeRanges) { if (Handle == IntPtr.Zero) throw new ObjectDisposedException ("CompressionSession"); IntPtr target; int count; var v = VTCompressionSessionGetTimeRangesForNextPass (Handle, out count, out target); if (v != VTStatus.Ok) { timeRanges = null; return v; } timeRanges = new CMTimeRange [count]; unsafe { CMTimeRange *ptr = (CMTimeRange *)target; for (int i = 0; i < count; i++) timeRanges [i] = ptr [i]; } return VTStatus.Ok; }
static extern VTStatus VTMultiPassStorageCreate( /* CFAllocatorRef */IntPtr allocator, /* can be null */ /* CFURLRef */ IntPtr fileUrl, /* can be null */ /* CMTimeRange */ CMTimeRange timeRange, /* can be kCMTimeRangeInvalid */ /* CFDictionaryRef */ IntPtr options, /* can be null */ /* VTMultiPassStorageRef */ out IntPtr multiPassStorageOut);
extern static /* OSStatus */ VTStatus VTFrameSiloCreate ( /* CFAllocatorRef */ IntPtr allocator, /* can be null */ /* CFURLRef */ IntPtr fileUrl, /* can be null */ /* CMTimeRange */ CMTimeRange timeRange, /* can be kCMTimeRangeInvalid */ /* CFDictionaryRef */ IntPtr options, /* Reserved, always null */ /* VTFrameSiloRef */ out IntPtr siloOut);
public VTStatus ForEach (Func<CMSampleBuffer, VTStatus> callback, CMTimeRange? range = null) { callbackHandle = GCHandle.Alloc (callback); var foreachResult = VTFrameSiloCallFunctionForEachSampleBuffer (handle, range ?? CMTimeRange.Invalid, GCHandle.ToIntPtr (callbackHandle), static_EachSampleBufferCallback); callbackHandle.Free (); return foreachResult; }
public MTAudioProcessingTapError GetSourceAudio (long frames, AudioBuffers bufferList, out MTAudioProcessingTapFlags flags, out CMTimeRange timeRange, long framesProvided) { if (bufferList == null) throw new ArgumentNullException ("bufferList"); int result; var r = MTAudioProcessingTapGetSourceAudio (handle, (int) frames, (IntPtr) bufferList, out flags, out timeRange, out result); return r; }
public MTAudioProcessingTapError GetSourceAudio (int frames, AudioBuffers bufferList, out MTAudioProcessingTapFlags flags, out CMTimeRange timeRange, out int framesProvided) { if (bufferList == null) throw new ArgumentNullException ("bufferList"); return MTAudioProcessingTapGetSourceAudio (handle, frames, (IntPtr) bufferList, out flags, out timeRange, out framesProvided); }
static extern CMTimeMapping CMTimeMappingMake(CMTimeRange source, CMTimeRange target);
static extern CMTimeMapping CMTimeMappingMakeEmpty(CMTimeRange target);
public static CMTimeMapping Create(CMTimeRange source, CMTimeRange target) { return CMTimeMappingMake (source, target); }
public static CMTimeMapping CreateEmpty(CMTimeRange target) { return(CMTimeMappingMakeEmpty(target)); }
public static CMTimeMapping CreateEmpty(CMTimeRange target) { return CMTimeMappingMakeEmpty (target); }
static extern CMTimeMapping CMTimeMappingMakeEmpty(CMTimeRange target);
public unsafe VTStatus SetTimeRangesForNextPass (CMTimeRange[] ranges) { if (ranges == null) throw new ArgumentNullException ("ranges"); if (ranges.Length > 0) fixed (CMTimeRange *first = &ranges [0]) { return VTFrameSiloSetTimeRangesForNextPass (handle, ranges.Length, (IntPtr)first); } else return VTFrameSiloSetTimeRangesForNextPass (handle, ranges.Length, IntPtr.Zero); }