hdsdump.f4f.AdobeFragmentRunTable.forEachGap(System.Func)

Here are the examples of the csharp api class hdsdump.f4f.AdobeFragmentRunTable.forEachGap(System.Func) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

Project: hdsdump
Source File: AdobeFragmentRunTable.cs
View license
public bool isFragmentInGap(uint fragmentId) {
            bool inGap = false;
            forEachGap(delegate(FragmentDurationPair fdp, FragmentDurationPair prevFdp, FragmentDurationPair nextFdp) {
                uint gapStartFragmentId = fdp.firstFragment;
                uint gapEndFragmenId    = nextFdp.firstFragment;
                if (gapStartFragmentId <= fragmentId && fragmentId<gapEndFragmenId) {
                    inGap = true;
                }
                return !inGap;
            });
            return inGap;
        }

2. Example

Project: hdsdump
Source File: AdobeFragmentRunTable.cs
View license
public uint countGapFragments() {
            uint count = 0;

            forEachGap(delegate (FragmentDurationPair fdp, FragmentDurationPair prevFdp, FragmentDurationPair nextFdp) {
                uint gapStartFragmentId = fdp.firstFragment;
                uint gapEndFragmentId   = (uint)(Math.Max(nextFdp.firstFragment, gapStartFragmentId));
                count += gapEndFragmentId - gapStartFragmentId;
                return true;
            });
            return count;
        }

3. Example

Project: hdsdump
Source File: AdobeFragmentRunTable.cs
View license
public bool isTimeInGap(uint time, uint fragmentInterval) {
            bool inGap = false;

            forEachGap(delegate (FragmentDurationPair fdp, FragmentDurationPair prevFdp, FragmentDurationPair nextFdp) {
                uint prevEndTime       = (uint)prevFdp.durationAccrued + prevFdp.duration* (fdp.firstFragment - prevFdp.firstFragment);
                uint nextStartTime     = (uint)nextFdp.durationAccrued;
                uint idealGapStartTime = (Math.Max(fdp.firstFragment, 1)-1) * fragmentInterval;
                uint idealGapEndTime   = (Math.Max(Math.Max(nextFdp.firstFragment, fdp.firstFragment + 1), 1) - 1) * fragmentInterval;
                uint gapStartTime      = Math.Min(prevEndTime, idealGapStartTime);
                uint gapEndTime        = Math.Max(nextStartTime, idealGapEndTime);
                if(gapStartTime <= time && time < gapEndTime) {
                    inGap = true;
                }
                return !inGap;
            });
            return inGap;
        }