public AnimationClip(GameObject gameObject, float frameRate, string clipName, float startFrame, float duration, int nTimes, bool reverse, CallbackEvents callbacks) { this.gameObject = gameObject; this.frameRate = frameRate; this.clipName = clipName; this.startFrame = startFrame; this.duration = duration; this.nTimes = nTimes; this.reverse = reverse; if (callbacks != null) { float startDuration = (startFrame - 1.0f) / frameRate; this.callbacks = new List <DelayCallbackEvent>(); foreach (CallbackEvent callbackEvent in callbacks) { DurationCallbackEvent durationCallbackEvent = callbackEvent as DurationCallbackEvent; if (durationCallbackEvent != null) { float delay = durationCallbackEvent.duration - startDuration; if (delay <= duration) { this.callbacks.Add(new DelayCallbackEvent(delay, durationCallbackEvent.callback)); } } else { FrameCallbackEvent frameCallbackEvent = callbackEvent as FrameCallbackEvent; if (frameCallbackEvent != null) { float delay = (frameCallbackEvent.frame < 0) ? duration : (frameCallbackEvent.frame - 1) / frameRate; if (delay <= duration) { this.callbacks.Add(new DelayCallbackEvent(delay, frameCallbackEvent.callback)); } } } } } this.currentDuration = 0.0f; }
public void StartStreaming() { Connect(); // Connecting the Video for Windows Driver to our Window SendMessage( m_HandleCaptureWindow, WM_CAP_SET_PREVIEWRATE, ( ushort ) m_FrameDelay, 0 ); SendMessage( m_HandleCaptureWindow, WM_CAP_SET_PREVIEW, 1, 0 ); // Setting up Video Format AVICapture.SendMessage( m_HandleCaptureWindow, AVICapture.WM_CAP_SET_VIDEOFORMAT, Marshal.SizeOf( m_VideoFormat ), ref m_VideoFormat ); // Setting up Event Handlers m_FrameCallback = new FrameCallbackEvent( this.FrameCallbackHandler ); SendMessage( m_HandleCaptureWindow, WM_CAP_SET_CALLBACK_FRAME, 0, m_FrameCallback ); }
public static extern int SendMessage( IntPtr handleWindow, uint message, ushort wParam, FrameCallbackEvent callback );