/// <summary> /// </summary> /// <param name="consumer"></param> /// <param name="frameIndex"></param> internal void RequestFrame(FilterInputSlot consumer, long frameIndex) { this.sync.WaitOne(); try { } finally { // Thread synchronization has to work to maintain reliability. this.sync.ReleaseMutex(); } }
internal void BindConsumer(FilterInputSlot consumer) { Contract.Requires(consumer != null); this.Mutex.WaitOne(); try { if (this.consumers.Contains(consumer)) { return; } this.consumers.Add(consumer); } finally { this.Mutex.ReleaseMutex(); } }
/// <summary> /// For a given input slot on the current filter, determines which frame indices are required from that slot /// for the current filter to render the specified frame index. /// </summary> /// <remarks> /// The default behavior is to go by the FramesBefore and FramesAfter values that have been assigned to the slot. /// </remarks> /// <param name="slot"></param> /// <param name="index"></param> /// <returns></returns> public virtual IEnumerable <int> GetInputFramesRequired(FilterInputSlot slot, long index) { Contract.Requires(slot != null); Contract.Requires(slot.Owner == this); Contract.Requires(index >= 0); if (!slot.IsBound) { yield break; } // default behavior should be acceptable for almost all filter implementations. int start = Math.Max(0 - slot.FramesBefore, 0); int end = slot.FramesAfter; // TODO: Fix end so we don't overflow the clip. for (int i = start; i <= end; ++i) { yield return(i); } }
internal void UnbindConsumer(FilterInputSlot consumer) { Contract.Requires(consumer != null); this.consumers.Remove(consumer); }