hdsdump.f4f.AdobeBootstrapBox.GetLastSegment()

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

2 Examples 7

1. Example

Project: hdsdump
Source File: AdobeBootstrapBox.cs
public uint GetFragmentsCount() {
            AdobeFragmentRunTable      lastFragmentTable = fragmentRunTables[fragmentRunTables.Count - 1];
            List<FragmentDurationPair> fdps              = lastFragmentTable.fragmentDurationPairs;

            if (fdps.Count < 1) {
                SegmentFragmentPair lastSegment = GetLastSegment();
                return lastSegment.fragmentsAccrued + lastSegment.fragmentsPerSegment - 1;
            }

            FragmentDurationPair lastValidFdp = fdps[fdps.Count - 1];
            if (lastValidFdp.duration == 0) {
                lastValidFdp = fdps[fdps.Count - 2];
            }

            int  deltaTime = (int)(currentMediaTime - lastValidFdp.durationAccrued);
            uint fragCount = (uint)((deltaTime <= lastValidFdp.duration) ? 1 : (deltaTime / lastValidFdp.duration));
            return lastValidFdp.firstFragment + fragCount - 1;
        }

2. Example

Project: hdsdump
Source File: AdobeBootstrapBox.cs
public uint GetSegmentFromFragment(uint fragN) {
            if (segmentRunTables.Count == 0) return 1;

            if (!live) {
                SegmentFragmentPair firstSegment = GetFirstSegment();

                if (firstSegment == null) return 1;

                uint segNum = firstSegment.firstSegment;
                foreach (var tab in segmentRunTables) {
                    foreach (var s in tab.segmentFragmentPairs) {
                        if ((segNum >= s.firstSegment) && (fragN < (s.fragmentsAccrued + s.fragmentsPerSegment))) {
                            return segNum;
                        }
                    }
                }

            }
            return GetLastSegment().firstSegment;
        }