private Fragment GetNextVideoFrag() { if (nextVideoFragPosition < 0) return (null); // there are no more!! boxReader.BaseStream.Position = nextVideoFragPosition; // we know where at least the next frag is as we prepared this prior to the call of this function... Fragment answer = new Fragment(GetTimeScale(videoTrackID), GetPayloadType(videoTrackID)); answer.Read(boxReader); nextVideoFragPosition = -1; while (this.boxReader.PeekNextBoxType() == BoxTypes.MovieFragment) { long fragPos = boxReader.BaseStream.Position; Fragment tmp = new Fragment(); int trakID = (int)tmp.GetTrackID(boxReader); if (GetFragmentHandlerType(trakID) == "vide") { nextVideoFragPosition = fragPos; break; } } return (answer); }
private Fragment GetNextVideoFrag() { if (nextVideoFragPosition < 0) return (null); // there are no more!! boxReader.BaseStream.Position = nextVideoFragPosition; // we know where at least the next frag is as we prepared this prior to the call of this function... Fragment answer = new Fragment(GetTimeScale(videoTrackID), GetPayloadType(videoTrackID), runningTimeIn100NanoSecs, runningSliceIndex); answer.Read(boxReader); runningTimeIn100NanoSecs += (ulong)TimeArithmetic.ConvertToStandardUnit(answer.TimeScale, (decimal)answer.Duration); runningSliceIndex += answer.Length; nextVideoFragPosition = -1; while (this.boxReader.PeekNextBoxType() == BoxTypes.MovieFragment) { long fragPos = boxReader.BaseStream.Position; Fragment tmp = new Fragment(); int trakID = (int)tmp.GetMP4TrackID(boxReader); if (GetFragmentHandlerType(trakID) == "vide") { nextVideoFragPosition = fragPos; break; } } return (answer); }