예제 #1
0
        public static CMBufferQueue FromCallbacks(int count, CMBufferGetTime getDecodeTimeStamp, CMBufferGetTime getPresentationTimeStamp, CMBufferGetTime getDuration,
                                                  CMBufferGetBool isDataReady, CMBufferCompare compare, NSString dataBecameReadyNotification)
        {
            var bq     = new CMBufferQueue(count);
            var cbacks = new CMBufferCallbacks()
            {
                version                   = 0,
                refcon                    = GCHandle.ToIntPtr(bq.gch),
                XgetDecodeTimeStamp       = getDecodeTimeStamp == null ? (BufferGetTimeCallback)null : GetDecodeTimeStamp,
                XgetPresentationTimeStamp = getPresentationTimeStamp == null ? (BufferGetTimeCallback)null : GetPresentationTimeStamp,
                XgetDuration              = getDuration == null ? (BufferGetTimeCallback)null : GetDuration,
                XisDataReady              = isDataReady == null ? (BufferGetBooleanCallback)null : GetDataReady,
                Xcompare                  = compare == null ? (BufferCompareCallback)null : Compare,
                cfStringPtr_dataBecameReadyNotification = dataBecameReadyNotification == null ? IntPtr.Zero : dataBecameReadyNotification.Handle
            };

            bq.getDecodeTimeStamp       = getDecodeTimeStamp;
            bq.getPresentationTimeStamp = getPresentationTimeStamp;
            bq.getDuration = getDuration;
            bq.isDataReady = isDataReady;
            bq.compare     = compare;

            if (CMBufferQueueCreate(IntPtr.Zero, count, cbacks, out bq.handle) == 0)
            {
                return(bq);
            }

            return(null);
        }
예제 #2
0
        public static CMBufferQueue CreateUnsorted(int count)
        {
            var bq = new CMBufferQueue(count);

            unsafe {
                var copy  = *CMBufferQueueGetCallbacksForUnsortedSampleBuffers();
                var pcopy = ©
                copy.refcon = GCHandle.ToIntPtr(bq.gch);

                if (CMBufferQueueCreate(IntPtr.Zero, count, (IntPtr)pcopy, out bq.handle) == 0)
                {
                    return(bq);
                }
            }
            return(null);
        }
예제 #3
0
		public static CMBufferQueue FromCallbacks (int count, CMBufferGetTime getDecodeTimeStamp, CMBufferGetTime getPresentationTimeStamp, CMBufferGetTime getDuration,
							   CMBufferGetBool isDataReady, CMBufferCompare compare, NSString dataBecameReadyNotification)
		{
			var bq = new CMBufferQueue (count);
			var cbacks = new CMBufferCallbacks () {
				version = 0,
				refcon = GCHandle.ToIntPtr (bq.gch),
				XgetDecodeTimeStamp = getDecodeTimeStamp == null ? (BufferGetTimeCallback) null : GetDecodeTimeStamp,
				XgetPresentationTimeStamp = getPresentationTimeStamp == null ? (BufferGetTimeCallback) null : GetPresentationTimeStamp,
				XgetDuration = getDuration == null ? (BufferGetTimeCallback) null : GetDuration,
				XisDataReady = isDataReady == null ? (BufferGetBooleanCallback) null : GetDataReady,
				Xcompare = compare == null ? (BufferCompareCallback) null : Compare,
				cfStringPtr_dataBecameReadyNotification = dataBecameReadyNotification == null ? IntPtr.Zero : dataBecameReadyNotification.Handle
			};

			bq.getDecodeTimeStamp = getDecodeTimeStamp;
			bq.getPresentationTimeStamp = getPresentationTimeStamp;
			bq.getDuration = getDuration;
			bq.isDataReady = isDataReady;
			bq.compare = compare;

			if (CMBufferQueueCreate (IntPtr.Zero, count, cbacks, out bq.Handle) == 0)
				return bq;

			return null;
		}
예제 #4
0
		public static CMBufferQueue CreateUnsorted (int count)
		{
			var bq = new CMBufferQueue (count);
			unsafe {
				var copy = *CMBufferQueueGetCallbacksForUnsortedSampleBuffers ();
				var pcopy = ©
				copy.refcon = GCHandle.ToIntPtr (bq.gch);
			
				if (CMBufferQueueCreate (IntPtr.Zero, count, (IntPtr) pcopy, out bq.Handle) == 0)
					return bq;
			}
			return null;
		}