void MovieFileController_OnStatusUpdateFromPlayerEvent(string file, MovieFiles.VIRTUAL_CHANNEL.PLAY_STATUS_UPDATE status, MovieFiles.VIRTUAL_CHANNEL.PlayNextFileDelegate playnext)
        {
            if (m_DataGridRowIndex.Contains(file))
            {
                int rowIndex = (int)m_DataGridRowIndex[file];
                dataGridViewFilesInProcess.Rows[rowIndex].Cells[1].Value = status.ToString();
            }

            if (playnext != null)
            {
                // the playnext delegate will be called from a UI thread, so that the Directshow movie player will run on the UI thread to eable painting on the UI owned panel
                this.BeginInvoke((MethodInvoker)delegate { playnext(); });
            }
        }
示例#2
0
 void MovieFiles_OnStatusUpdate(string file, MovieFiles.VIRTUAL_CHANNEL.PLAY_STATUS_UPDATE status, MovieFiles.VIRTUAL_CHANNEL.PlayNextFileDelegate playnext)
 {
     if (OnStatusUpdateFromPlayerEvent != null) OnStatusUpdateFromPlayerEvent(file, status, playnext);
 }
示例#3
0
        // inputs
        //
        //   jpegs from hardware devices
        //   bitmaps from hardware devices
        //   GPS from stored data or hardware devices
        //   Camera name source info from stored configuration
        //   video files on disk
        //   still images on disk


        // outputs
        //
        //    bitmaps to LPR, with source, time and GPS
        //    jpegs to DVR, with source, time and GPS
        //
        //
        //
        //

        public FrameGenerator(APPLICATION_DATA appData, bool AsService)
        {
            try
            {
                m_AppData = appData;
                m_AppData.AddOnClosing(OnClose, APPLICATION_DATA.CLOSE_ORDER.MIDDLE);
                m_Log = (ErrorLog)m_AppData.Logger;

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].Peak.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].PerSecond.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].RunningAverage.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].Snapshot.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].Peak.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].PerSecond.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].RunningAverage.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].Snapshot.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].Peak.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].PerSecond.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].RunningAverage.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].Snapshot.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_GPSLocation].StatString.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_DroppedFrames].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_FrameCnt].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_FramesDetected].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_ProcessQCnt].Snapshot.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_ProcessQCnt].Peak.RegisterForUse(true);

                m_EabledChannelArray = new bool[m_AppData.MAX_PHYSICAL_CHANNELS];// used tell the 2255 device which of its channels are enabled

                m_LastJPEGReceived = new LAST_JPEG_RECEIVED[m_AppData.MAX_PHYSICAL_CHANNELS];
                m_Channels         = new CHANNEL[m_AppData.MAX_PHYSICAL_CHANNELS];
                for (int c = 0; c < m_AppData.MAX_PHYSICAL_CHANNELS; c++)
                {
                    m_LastJPEGReceived[c] = new LAST_JPEG_RECEIVED();
                    m_Channels[c]         = new CHANNEL(c);
                }

                LoadChannelNames();



                m_ConsumerIDs = new CONSUMER_ID();

                m_CurrentGPSPosition = m_NoPositionAvailable;


                m_MotionDetectionQ = new ThreadSafeQueue <FRAME>(m_MotionDetectionQueLevel, "QueueOverruns_FG_MotionDetectionQ", m_AppData);
                m_AppData.MotionDetectionGettingBehind = false;


                //////////////////////////////////////
                //
                // start the thread that pushes new frames to the registered consumers

                m_AllFramesConsumerPushQ = new ThreadSafeQueue <CONSUMER_PUSH>(240, "QueueOverruns_FG_AllFramesConsumerPushQ", m_AppData);

                m_MotionDetectedConsumerPushQ = new ThreadSafeQueue <CONSUMER_PUSH>(240, "QueueOverruns_FG_MotionDetectedConsumerPushQ", m_AppData); //120

                PushThread          = new Thread(PushLoop);
                PushThread.Priority = ThreadPriority.AboveNormal;
                PushThread.Start();

                m_MotionDetectionThread = new Thread(MotionDetectionLoop);
                m_MotionDetectionThread.Start();



                //////////////////////////////////////
                //
                // start the S2255 controller

                // the 2255 controller has a polling loop that looks for 2255 devices to be added/deleted by the user plugging/unplugging the cables
                //  as new devices are detected, the stored config data is read and the channels are assigned and start running as appropriate
                //   the image data flows into this class via callbacks. this class then pushes the data up a layer after adding GPS and time stamps.

                if (AsService)
                {
                    try
                    {
                        S2255Controller.S2255Controller.PAL_NTSC_MODE videoStandard = S2255Controller.S2255Controller.PAL_NTSC_MODE.NTSC;

                        string NTSC_PAL = UserSettings.Get(UserSettingTags.VideoSetup_PAL_NTSC);
                        if (NTSC_PAL != null)
                        {
                            if (NTSC_PAL.Equals(UserSettingTags.VideoSetup_PAL))
                            {
                                videoStandard = S2255Controller.S2255Controller.PAL_NTSC_MODE.PAL;
                            }
                        }

                        unsafe
                        {
                            m_S2255Controller             = new S2255Controller.S2255Controller(videoStandard, m_AppData, m_EabledChannelArray);
                            m_S2255Controller.OnNewFrame += new S2255Controller.S2255Controller.OnNewFrameFromDeviceEvent(OnReceiveNewImageFromS2255Device);
                            m_S2255Controller.StartThreads();
                        }
                    }
                    catch (Exception ex)
                    {
                        m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL);
                    }


                    //////////////////////////////////////
                    //
                    // start the GPS Controller


                    string GPSPort = FindDevicePort.GetGPSCommPort();
                    m_GPSController = new GPSController(PutNewGPSData, m_AppData);

                    if (m_S2255Controller.GetReadyStatus)
                    {
                        m_FrameGenReadyStatus = true;
                    }
                    else
                    {
                        m_FrameGenReadyStatus = false;
                    }
                }

                if (!AsService)
                {
                    MovieFileController             = new MovieFiles(m_AppData);
                    MovieFileController.OnNewImage += new MovieFiles.OnNewImageEvent(MovieFiles_OnNewImage);
                    MovieFileController.Start();
                }
            }
            catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); }
        }
示例#4
0
        // inputs
        //
        //   jpegs from hardware devices
        //   bitmaps from hardware devices
        //   GPS from stored data or hardware devices
        //   Camera name source info from stored configuration
        //   video files on disk
        //   still images on disk
        // outputs
        //
        //    bitmaps to LPR, with source, time and GPS
        //    jpegs to DVR, with source, time and GPS
        //    
        //
        //
        //
        public FrameGenerator( APPLICATION_DATA appData,bool AsService)
        {
            try
            {

                m_AppData = appData;
                m_AppData.AddOnClosing(OnClose, APPLICATION_DATA.CLOSE_ORDER.MIDDLE);
                m_Log = (ErrorLog)m_AppData.Logger;

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].Peak.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].PerSecond.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].RunningAverage.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].Snapshot.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].Peak.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].PerSecond.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].RunningAverage.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].Snapshot.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].Peak.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].PerSecond.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].RunningAverage.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].Snapshot.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_GPSLocation].StatString.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_DroppedFrames].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_FrameCnt].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_FramesDetected].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_ProcessQCnt].Snapshot.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_ProcessQCnt].Peak.RegisterForUse(true);

                m_EabledChannelArray = new bool[m_AppData.MAX_PHYSICAL_CHANNELS];// used tell the 2255 device which of its channels are enabled

                m_LastJPEGReceived = new LAST_JPEG_RECEIVED[m_AppData.MAX_PHYSICAL_CHANNELS];
                m_Channels = new CHANNEL[m_AppData.MAX_PHYSICAL_CHANNELS];
                for (int c = 0; c < m_AppData.MAX_PHYSICAL_CHANNELS; c++)
                {
                    m_LastJPEGReceived[c] = new LAST_JPEG_RECEIVED();
                    m_Channels[c] = new CHANNEL(c);
                }

                LoadChannelNames();

                m_ConsumerIDs = new CONSUMER_ID();

                m_CurrentGPSPosition = m_NoPositionAvailable;

                m_MotionDetectionQ = new ThreadSafeQueue<FRAME>(m_MotionDetectionQueLevel, "QueueOverruns_FG_MotionDetectionQ", m_AppData);
                m_AppData.MotionDetectionGettingBehind = false;

                //////////////////////////////////////
                //
                // start the thread that pushes new frames to the registered consumers

                m_AllFramesConsumerPushQ = new ThreadSafeQueue<CONSUMER_PUSH>(240, "QueueOverruns_FG_AllFramesConsumerPushQ", m_AppData);

                m_MotionDetectedConsumerPushQ = new ThreadSafeQueue<CONSUMER_PUSH>(240, "QueueOverruns_FG_MotionDetectedConsumerPushQ", m_AppData); //120

                PushThread = new Thread(PushLoop);
                PushThread.Priority = ThreadPriority.AboveNormal;
                PushThread.Start();

                m_MotionDetectionThread = new Thread(MotionDetectionLoop);
                m_MotionDetectionThread.Start();

                //////////////////////////////////////
                //
                // start the S2255 controller

                // the 2255 controller has a polling loop that looks for 2255 devices to be added/deleted by the user plugging/unplugging the cables
                //  as new devices are detected, the stored config data is read and the channels are assigned and start running as appropriate
                //   the image data flows into this class via callbacks. this class then pushes the data up a layer after adding GPS and time stamps.

                if (AsService)
                {
                    try
                    {

                        S2255Controller.S2255Controller.PAL_NTSC_MODE videoStandard = S2255Controller.S2255Controller.PAL_NTSC_MODE.NTSC;

                        string NTSC_PAL = UserSettings.Get(UserSettingTags.VideoSetup_PAL_NTSC);
                        if (NTSC_PAL != null)
                        {
                            if (NTSC_PAL.Equals(UserSettingTags.VideoSetup_PAL))
                                videoStandard = S2255Controller.S2255Controller.PAL_NTSC_MODE.PAL;
                        }

                        unsafe
                        {
                            m_S2255Controller = new S2255Controller.S2255Controller(videoStandard, m_AppData, m_EabledChannelArray);
                            m_S2255Controller.OnNewFrame += new S2255Controller.S2255Controller.OnNewFrameFromDeviceEvent(OnReceiveNewImageFromS2255Device);
                            m_S2255Controller.StartThreads();
                        }
                    }
                    catch (Exception ex)
                    {
                        m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL);
                    }

                    //////////////////////////////////////
                    //
                    // start the GPS Controller

                    string GPSPort = FindDevicePort.GetGPSCommPort();
                    m_GPSController = new GPSController(PutNewGPSData, m_AppData);

                    if (m_S2255Controller.GetReadyStatus)
                        m_FrameGenReadyStatus = true;
                    else
                        m_FrameGenReadyStatus = false;
                }

                if (!AsService)
                {
                    MovieFileController = new MovieFiles(m_AppData);
                    MovieFileController.OnNewImage += new MovieFiles.OnNewImageEvent(MovieFiles_OnNewImage);
                    MovieFileController.Start();
                }

            }
            catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL);}
        }