Exemple #1
0
        private Int32 CutFramesNew(VideoFrameSection vfs, Int32 startFrame, Int32 endFrame, Int32 cutFrames)
        {
            //Create a temporary list
            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 cutFrames 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 (cutFrames > endFrame - startFrame + 1)
            {
                foreach (VideoFrame vf in list.FrameList)
                {
                    vfs.AddToDelete(vf);
                }
                return(list.Count);
            }
            else
            {
                //Add the first cutFrames to the video section
                for (int i = 0; i < cutFrames; i++)
                {
                    vfs.AddToDelete(list.FrameList[i]);
                }
                return(cutFrames);
            }
        }
Exemple #2
0
        private void CutFrames(VideoFrameSection vfs, Int32 startFrame, Int32 endFrame, Int32 cutFrames)
        {
            //Create a temporary list
            VideoFrameList list = _VideoFrameList.CopyList(startFrame, endFrame);

            if (list.IsCFR)
            {
                //Sort the first cutFrames 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);
            }

            //Add the first cutFrames to the video section
            for (int i = 0; i < cutFrames; i++)
            {
                vfs.AddToDelete(list.FrameList[i]);
            }
        }