private void AddFrames(VideoFrameSection vfs, Int32 startFrame, Int32 endFrame, Int32 addFrames) { //Create a temporary list VideoFrameList list = _VideoFrameList.CopyList(startFrame, endFrame); if (list.IsCFR) { //Sort the first addFrames by frame number list.Sort(VideoFrameList.SortType.ByFrameNumber, VideoFrameList.SortOrder.Ascending); } else { //Sort all frames by difference list.Sort(VideoFrameList.SortType.ByFrameDifference, VideoFrameList.SortOrder.Ascending); } //Sort all the frames by duration list.Sort(VideoFrameList.SortType.ByDuration, VideoFrameList.SortOrder.Descending); //Add the first addframes to the video section for (int i = 0; i < addFrames; i++) { vfs.AddToDuplicate(list.FrameList[i]); } }
private Int32 AddFramesNew(VideoFrameSection vfs, Int32 startFrame, Int32 endFrame, Int32 addFrames) { VideoFrameList list = _VideoFrameList.CopyList(startFrame, endFrame); // if the list is CFR then sort by frame numer, else by frame difference if (!list.IsCFR) { //Sort the first addFrames by frame number list.Sort(VideoFrameList.SortType.ByFrameNumber, VideoFrameList.SortOrder.Ascending); } else { //Sort all frames by difference list.Sort(VideoFrameList.SortType.ByFrameDifference, VideoFrameList.SortOrder.Ascending); } //Sort all the frames by duration list.Sort(VideoFrameList.SortType.ByDuration, VideoFrameList.SortOrder.Descending); if (addFrames > endFrame - startFrame + 1) { Int32 framesDuppedCounter = 0; while (framesDuppedCounter < addFrames) { foreach (VideoFrame vf in list.FrameList) { vfs.AddToDuplicate(vf); framesDuppedCounter++; } } return(addFrames); //return list.Count; } else { //Add the first addframes to the video section for (int i = 0; i < addFrames; i++) { vfs.AddToDuplicate(list.FrameList[i]); } return(addFrames); } }