Beispiel #1
0
        public void UpdateWorkingZone(VideoSection _newZone)
        {
            if (m_Frames.Count > 0)
            {
                Clear();
            }

            m_WorkingZone = _newZone;
        }
Beispiel #2
0
 private void UpdateWorkingZone()
 {
     if (m_Frames.Count > 0)
     {
         m_WorkingZone = new VideoSection(m_Frames[0].Timestamp, m_Frames[m_Frames.Count - 1].Timestamp);
     }
     else
     {
         m_WorkingZone = VideoSection.Empty;
     }
 }
Beispiel #3
0
        public void Clear()
        {
            m_Current      = null;
            m_CurrentIndex = -1;

            foreach (VideoFrame frame in m_Frames)
            {
                DisposeFrame(frame);
            }

            m_Frames.Clear();
            m_WorkingZone = VideoSection.Empty;
        }
Beispiel #4
0
 private void UpdateSegment()
 {
     // Get real data from the stored frames.
     // Always inside a lock.
     if (m_Frames.Count < 1)
     {
         m_Segment = VideoSection.Empty;
     }
     else
     {
         m_Segment = new VideoSection(m_Frames[0].Timestamp, m_Frames[m_Frames.Count - 1].Timestamp);
     }
 }
Beispiel #5
0
        public void Clear()
        {
            lock (m_Locker)
            {
                m_Current = null;

                foreach (VideoFrame vf in m_Frames)
                {
                    DisposeFrame(vf);
                }

                m_Frames.Clear();
                m_CurrentIndex      = -1;
                m_Drops             = 0;
                m_Segment           = VideoSection.Empty;
                m_TotalCapacity     = m_DefaultTotalCapacity;
                m_OldFramesCapacity = m_DefaultOldFramesCapacity;

                Monitor.Pulse(m_Locker);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Remove all items that are outside the working zone.
        /// </summary>
        public void ReduceWorkingZone(VideoSection _newZone)
        {
            m_WorkingZone = _newZone;

            int removedAtLeft = 0;

            for (int i = 0; i < m_Frames.Count; i++)
            {
                if (m_WorkingZone.Contains(m_Frames[i].Timestamp))
                {
                    continue;
                }

                if (m_Frames[i].Timestamp < m_WorkingZone.Start)
                {
                    removedAtLeft++;
                }

                DisposeFrame(m_Frames[i]);
                m_Frames[i] = null;

                if (i == m_CurrentIndex)
                {
                    m_CurrentIndex = -1;
                }
            }

            if (m_CurrentIndex >= removedAtLeft)
            {
                m_CurrentIndex -= removedAtLeft;
            }

            m_Frames.RemoveAll(frame => object.ReferenceEquals(null, frame));

            m_CurrentIndex = Math.Max(0, m_CurrentIndex);
            m_Current      = m_Frames[m_CurrentIndex];

            UpdateWorkingZone();
        }
 /// <summary>
 /// Updates the internal working zone. Import whole zone to cache if possible.
 /// </summary>
 /// <param name="_workerFn">A function that will start a background thread for the actual import</param>
 public abstract void UpdateWorkingZone(VideoSection _newZone, bool _forceReload, int _maxSeconds, int _maxMemory, Action <DoWorkEventHandler> _workerFn);
 public override void UpdateWorkingZone(VideoSection _newZone, bool _forceReload, int _maxMemory, Action <DoWorkEventHandler> _workerFn)
 {
 }