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);
                }
            }
        }
Exemple #2
0
 // 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);
 }
Exemple #3
0
		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);
		}
Exemple #4
0
        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);
        }
Exemple #5
0
		extern static /* OSStatus */ MTAudioProcessingTapError MTAudioProcessingTapGetSourceAudio (
			/* MTAudioProcessingTapRef */ IntPtr tap, int numberFrames, 
			/* AudioBufferList* */ IntPtr bufferListInOut,
			out MTAudioProcessingTapFlags flagsOut, out CMTimeRange timeRangeOut, out int numberFramesOut);
Exemple #6
0
		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);
		}
Exemple #7
0
        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);
                }
            }
        }
Exemple #8
0
		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));
 }
Exemple #11
0
		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;
		}
Exemple #12
0
 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);
Exemple #13
0
		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);
Exemple #14
0
		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;
		}
Exemple #15
0
		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;
		}
Exemple #16
0
		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);
		}
Exemple #17
0
 static extern CMTimeMapping CMTimeMappingMake(CMTimeRange source, CMTimeRange target);
Exemple #18
0
 static extern CMTimeMapping CMTimeMappingMakeEmpty(CMTimeRange target);
Exemple #19
0
 public static CMTimeMapping Create(CMTimeRange source, CMTimeRange target)
 {
     return CMTimeMappingMake (source, target);
 }
 public static CMTimeMapping CreateEmpty(CMTimeRange target)
 {
     return(CMTimeMappingMakeEmpty(target));
 }
Exemple #21
0
 public static CMTimeMapping CreateEmpty(CMTimeRange target)
 {
     return CMTimeMappingMakeEmpty (target);
 }
 static extern CMTimeMapping CMTimeMappingMakeEmpty(CMTimeRange target);
Exemple #23
0
		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);
		}