Example #1
0
        /// <summary>
        /// Creates a new VideoFrameList which contains
        /// the merged frames from other two
        /// </summary>
        /// <param name="vfl1"></param>
        /// <param name="vfl2"></param>
        /// <returns>the merged VideoFrameList</returns>
        public static VideoFrameList Merge(VideoFrameList vfl1, VideoFrameList vfl2)
        {
            VideoFrameList vfl = new VideoFrameList();

            vfl.Add(vfl1);
            vfl.Add(vfl2);
            return(vfl);
        }
Example #2
0
        public void AddToDuplicate(VideoFrame vf)
        {
            VideoFrame nvf = vf.Clone();

            vf.ProcessType     = FrameProcessType.ToDuplicate;
            nvf.ProcessType    = FrameProcessType.ToDuplicate;
            nvf.DuplicateTimes = 1;
            _FramesToDuplicate.Add(nvf);
        }
Example #3
0
        public void AddToDelete(VideoFrame vf)
        {
            VideoFrame nvf = vf.Clone();

            vf.ProcessType  = FrameProcessType.ToDelete;
            nvf.ProcessType = FrameProcessType.ToDelete;
            _FramesToDelete.Add(nvf);
        }
Example #4
0
        /// <summary>
        /// Creates a new videoframelist and copies ONLY the frames
        /// All the other info are not copied
        /// </summary>
        /// <param name="start">the start frame index</param>
        /// <param name="end">the end frame index</param>
        /// <returns>the new videoframelist</returns>
        public VideoFrameList CopyList(Int32 start, Int32 end)
        {
            VideoFrameList vfl = new VideoFrameList();

            for (int i = start; i <= end; i++)
            {
                vfl.Add(this._FrameList[i].Clone());
            }
            return(vfl);
        }
Example #5
0
        /// <summary>
        /// Returns a VideoFrameList with the remapped duplicates of this section
        /// taking in mind the frames to delete
        /// </summary>
        /// <returns></returns>
        public VideoFrameList RemappedDuplicates()
        {
            //Merge the frame lists
            VideoFrameList mergeList = VideoFrameList.Merge(_FramesToDelete, _FramesToDuplicate);

            //Sort the merge list by frame number
            mergeList.Sort(VideoFrameList.SortType.ByFrameNumber, VideoFrameList.SortOrder.Ascending);

            //Create new remapped list of duplicate frames
            VideoFrameList remappedFramesToDuplicate = new VideoFrameList();

            //Remap the frames to duplicate
            Int32 framesDeletedSoFar = 0;

            foreach (VideoFrame vf in mergeList.FrameList)
            {
                if (vf.ProcessType == FrameProcessType.ToDelete)
                {
                    //Increase the counter
                    framesDeletedSoFar++;
                    continue;
                }
                else if (vf.ProcessType == FrameProcessType.ToDuplicate)
                {
                    //Remap the frame number
                    vf.FrameNumber -= framesDeletedSoFar;
                    //Add it many times according to duplicate times
                    for (int i = 0; i < vf.DuplicateTimes; i++)
                    {
                        //Add it to the remapped list
                        remappedFramesToDuplicate.Add(vf);
                    }
                }
            }
            return(remappedFramesToDuplicate);
        }