Ejemplo n.º 1
0
        DateTime getCurrentPlayTime(int millisecondCounter)
        {
            int seconds = 0;
            int minutes = 0;
            int hours   = 0;

            while (millisecondCounter > 999)
            {
                seconds            = millisecondCounter / 1000;
                millisecondCounter = (millisecondCounter % 1000);
                while (seconds > 59)
                {
                    minutes = seconds / 60;
                    seconds = seconds % 60;

                    while (minutes > 59)
                    {
                        hours   = minutes / 60;
                        minutes = minutes % 60;
                    }
                }
            }
            DateTime firstFrameTime = PATHS.GetTimeFromFile(jpegsToPlay[0]);

            TimeSpan interval = new TimeSpan(0, hours, minutes, seconds, millisecondCounter);

            return(firstFrameTime.Add(interval));
        }
Ejemplo n.º 2
0
        TimeSpan  GetNextFrameInterval()
        {
            int index = m_JpegPlayIndex;

            index++;

            if (index >= jpegsToPlay.Length)
            {
                return(new TimeSpan(0, 0, 0, 0, 30));                             // return an arbitrarily short time, since we are at the end
            }
            DateTime frameTimeAtLastFrame = PATHS.GetTimeFromFile(jpegsToPlay[m_JpegPlayIndex]);
            DateTime frameTimeAtNextFrame = PATHS.GetTimeFromFile(jpegsToPlay[index]);

            TimeSpan interval = frameTimeAtNextFrame.Subtract(frameTimeAtLastFrame);

            return(interval);
        }
Ejemplo n.º 3
0
        void PlayLoop()
        {
            m_PlayControl = new PlayControl();
            m_PlayControl.Reset();

            while (!m_Stop)
            {
                while (m_Play)
                {
                    if (m_PlayControl.intervalCounter >= (int)m_PlayControl.interval.TotalMilliseconds)
                    {
                        lock (jpegArrayLock)
                        {
                            m_PlayControl.previousFrameTime = PATHS.GetTimeFromFile(jpegsToPlay[m_JpegPlayIndex]);
                        }

                        this.BeginInvoke((MethodInvoker) delegate { this.PushNextJpeg(); });

                        if (m_JpegPlayIndex == jpegsToPlay.Length - 1)
                        {
                            m_Play = false;
                            this.BeginInvoke((MethodInvoker) delegate { this.StopPlay(); });
                            continue;
                        }
                        DateTime nexttimestamp = PATHS.GetTimeFromFile(jpegsToPlay[m_JpegPlayIndex + 1]);
                        m_PlayControl.interval = nexttimestamp.Subtract(m_PlayControl.previousFrameTime);

                        m_JpegPlayIndex++;
                        m_PlayControl.intervalCounter = 0;
                    }
                    if (m_Stop)
                    {
                        break;
                    }
                    TimeSpan playtime = m_PlayControl.interval.Add(new TimeSpan(0, 0, 0, 0, m_PlayControl.intervalCounter));
                    this.BeginInvoke((MethodInvoker) delegate { this.PushPlayStats(m_PlayControl.previousFrameTime.Add(playtime).ToString(m_AppData.TimeFormatStringForFileNames), m_PlayControl.previousFrameTime.ToString(m_AppData.TimeFormatStringForFileNames)); });
                    m_PlayControl.intervalCounter++;
                    Thread.Sleep(1);
                }

                Thread.Sleep(1);
            }
        }
Ejemplo n.º 4
0
        public SmartSearchLibUC(APPLICATION_DATA appData, ABORT_CLOSE giveup)
        {
            InitializeComponent();

            m_AppData = appData;
            m_AppData.AddOnClosing(OnClose, APPLICATION_DATA.CLOSE_ORDER.FIRST);
            m_Log  = (ErrorLog)m_AppData.Logger;
            GiveUp = giveup;

            m_PathManager = (PATHS)m_AppData.PathManager;


            textBoxMinMatch.Text = "0";

            m_SearchTool = new SearchLib(m_AppData);

            this.Text = "Smart Search";

            m_ZoomTrackLock             = new object();
            trackBarZoomControl.Minimum = 0;
            trackBarZoomControl.Maximum = 1000;

            buttonUndoDelete.Enabled = false;
            dataGridView1.KeyDown   += new KeyEventHandler(dataGridView1_KeyDown);

            dataGridView1.CellClick        += new DataGridViewCellEventHandler(dataGridView1_CellContentClick); // mouse click on cell
            dataGridView1.SelectionChanged += new EventHandler(dataGridView1_SelectionChanged);                 // support cell selection changes by keyboard (i.e. not by mouse click)


            dataGridView1.Columns["time"].DefaultCellStyle.Format = m_AppData.TimeFormatStringForDisplay;// "dd MMM yyyy,  HH: mm: ss: ffff";


            m_SearchStatusDisplay          = new SearchStatusDisplayUC(m_AppData, UserCanceledSearch);
            m_SearchStatusDisplay.Location = new Point(594, 55);
            this.Controls.Add(m_SearchStatusDisplay);
        }
Ejemplo n.º 5
0
 private static string GetEnumPath(PATHS ePath)
 {
     return(paths[(int)ePath]);
 }
Ejemplo n.º 6
0
 DateTime getCurrentFrameTime()
 {
     return(PATHS.GetTimeFromFile(jpegsToPlay[m_JpegPlayIndex]));
 }
Ejemplo n.º 7
0
        void PlayOneFrame(bool playForward)
        {
            if (jpegsToPlay == null)
            {
                return;
            }

            if (playForward)
            {
                m_JpegPlayIndex++;
            }
            else
            {
                m_JpegPlayIndex--;
            }

            if (jpegsToPlay.Length == 0)
            {
                return;
            }
            if (m_JpegPlayIndex >= jpegsToPlay.Length)
            {
                m_JpegPlayIndex = 0;
            }
            if (m_JpegPlayIndex < 0)
            {
                m_JpegPlayIndex = jpegsToPlay.Length - 1;
            }

            lock (jpegArrayLock)
            {
                m_PlayControl.previousFrameTime = PATHS.GetTimeFromFile(jpegsToPlay[m_JpegPlayIndex]);
            }

            this.BeginInvoke((MethodInvoker) delegate { this.PushNextJpeg(jpegsToPlay[m_JpegPlayIndex]); });

            int nextIndex;

            if (playForward)
            {
                nextIndex = m_JpegPlayIndex + 1;
            }
            else
            {
                nextIndex = m_JpegPlayIndex - 1;
            }

            if (nextIndex >= jpegsToPlay.Length)
            {
                nextIndex = 0;
            }

            if (nextIndex < 0)
            {
                nextIndex = jpegsToPlay.Length - 1;
            }

            int nextNextIndex = nextIndex + 1;

            if (nextNextIndex >= jpegsToPlay.Length)
            {
                nextNextIndex = nextIndex;
            }

            DateTime nexttimestamp = PATHS.GetTimeFromFile(jpegsToPlay[nextNextIndex]);

            m_PlayControl.interval = nexttimestamp.Subtract(m_PlayControl.previousFrameTime);

            m_PlayControl.intervalCounter = 0;

            TimeSpan playtime = m_PlayControl.interval.Add(new TimeSpan(0, 0, 0, 0, m_PlayControl.intervalCounter));

            this.BeginInvoke((MethodInvoker) delegate { this.PushPlayStats(m_PlayControl.previousFrameTime.Add(playtime).ToString(m_AppData.TimeFormatStringForFileNames), m_PlayControl.previousFrameTime.ToString(m_AppData.TimeFormatStringForFileNames), m_JpegPlayIndex); });
            m_PlayControl.intervalCounter++;
        }
Ejemplo n.º 8
0
 public void AddPath(TGeoPath p)
 {
     PATHS.Add(p);
 }
Ejemplo n.º 9
0
Archivo: DVR.cs Proyecto: mutita/anpr
        // constructor
        public DVR(APPLICATION_DATA appData)
        {
            try
            {
                m_AppData = appData;
                m_AppData.AddOnClosing(Stop, APPLICATION_DATA.CLOSE_ORDER.MIDDLE);
                m_Log = (ErrorLog)m_AppData.Logger;

                PauseFlag = new PAUSE_FLAG();

                PauseFlag.Pause = true;

                FileAccessControl = new FILE_SYSTEM_ACCESS(PauseFlag, m_AppData);

                try
                {
                    Paths = new PATHS(m_AppData.ThisComputerName, true, m_AppData);

                    m_AppData.PathManager = (object)Paths;
                }
                catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); }

                m_EventLogFile = new EventLogFiles.EventLogFiles(m_AppData);

                //   PRE MOTION BUFFER LENGHT

                m_NumberOfFramesToPrePostBuffer = 30;      // this many frames before and after moton event, if too small, files may be erased before motion is detected because of processing lag

                ////////



                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_DriveName].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_DriveReady].boolean.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_FreeSpace].SnapshotDouble.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_UsedSpace].SnapshotDouble.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_DriveHotSwap].StatString.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_Drive].StatString.SetValue = "No drive ";

                m_FrameGenerator = (FrameGenerator)m_AppData.FrameGenerator;


                m_DriveManager = new DriveManager(m_AppData, OnExternalDriveChange, Paths.StorageDir);

                // alway use external storage

                if (m_AppData.RunninAsService)
                {
                    int count = 0;
                    Paths.Drive           = m_DriveManager.GetDrive(ref count);
                    PauseFlag.DriveExists = true;
                    if (count > 1)
                    {
                        PauseFlag.Pause = true;
                        m_Log.Log("Too many external drives on start", ErrorLog.LOG_TYPE.FATAL);
                        //m_MessageBoxMessage = "Too many external drives on start. Please connect only one external drive and re-start the LPR Service.";
                        //RunMessageBoxDialog();
                    }
                    else if (Paths.Drive == null)
                    {
                        PauseFlag.Pause = true;

                        m_Log.Log("External Drive not found", ErrorLog.LOG_TYPE.FATAL);
                        //  m_MessageBoxMessage = "External drive not found. Please connect one external drive";
                        PauseFlag.DriveExists = false;
                        // RunMessageBoxDialog();
                    }
                }



                m_ConsumerID = m_FrameGenerator.GetNewConsumerID();

                m_NewFrameQ         = new ThreadSafeQueue <FRAME>(240, "QueueOverruns_DVR_NewFrameQ", m_AppData);
                m_MotionDetectedQ   = new ThreadSafeQueue <FRAME>(240, "QueueOverruns_DVR_MotionDetectedQ", m_AppData);
                m_DirectyToStorageQ = new ThreadSafeQueue <FRAME>(240, "QueueOverruns_DVR_DirectyToStorageQ", m_AppData);
                m_NewLPRRecordQ     = new ThreadSafeQueue <FRAME>(m_LPRRecordQueLen, "QueueOverruns_DVR_NewLPRRecordQ", m_AppData);
                m_TempFileList      = new ThreadSafeList <TEMPFILES>(120);


                m_NumSourceChannels = (m_AppData.RunninAsService) ? m_AppData.MAX_PHYSICAL_CHANNELS : m_AppData.MAX_VIRTUAL_CHANNELS;

                m_PreMotionRecords = new PRE_MOTION_RECORDS[m_NumSourceChannels];

                m_DVRLoopThread = new Thread(DVRLoop);

                m_ReportDVRStats = new Thread(ReportDVRStatusLoop);

                m_TempFileCleanUpThread = new Thread(TempFilesCleanUpLoop);

                m_MaintainFileSystemSizeLimit = new Thread(MaintainFileSystemSizeLimitLoop);
            }
            catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); }
        }