Пример #1
0
        //Deal with EncodeResult
        public static void ScanEncodeResult(object o_filepath, int record_id)
        {
            string           filepath     = (string)o_filepath;
            string           EncodeResult = filepath + "\\EncodeResult";
            List <FileNames> Filelist     = new List <FileNames>();

            GetSystemAllPath.GetallDirectory(Filelist, EncodeResult);
            //Console.WriteLine("---Decoding " + EncodeResult + ".....\n");
            if (Filelist.Count() < 1)
            {
                mw.DebugWriteLine("未发现视频文件");
                return;
            }
            mw.DebugWriteLine("解析视频目录" + EncodeResult + "...");
            for (int i = 0; i < Filelist.Count(); i++)
            {
                string mjpegpath  = EncodeResult + "\\" + Filelist[i].text + "\\" + Filelist[i].children[0].text;
                string outputpath = filepath + "\\DecodeResult\\" + Filelist[i].text;
                //Console.WriteLine("------Decoding " + Filelist[i].text + ".....\n");
                mw.DebugWriteLine("解析视频文件" + Filelist[i].text + "...");
                //Decode the mjpeg
                MjpegHandler.DecodeParam param;
                param.inputvideo = mjpegpath;
                param.outputpath = outputpath;
                Thread DecodeThread = new Thread(MjpegHandler.CallPythonToDecode);
                DecodeThread.Start(param);
                //MjpegHandler.CallPythonToDecode(param);
            }
            mw.DebugWriteLine("导入视频序列" + EncodeResult + "...");
            for (int i = 0; i < Filelist.Count(); i++)
            {
                mw.DebugWriteLine("导入视频序列" + Filelist[i].text + "...");
                string image_root_url = filepath + "\\DecodeResult\\" + Filelist[i].text;
                string mjpeg_csv_path = EncodeResult + "\\" + Filelist[i].text + "\\" + Filelist[i].children[1].text;
                // Get CameraNum from filename
                int cam_num = ConfigHandler.GetCameraNum(Filelist[i].children[1].text.Split("_")[1].Split(".")[0].ToCharArray());
                if (cam_num < 1 || cam_num == 999)
                {
                    continue;
                }
                CSVHandler.HandleTimestampParam htime_param;
                htime_param.record_id       = record_id;
                htime_param.cam_num         = cam_num;
                htime_param.csv_file_path   = mjpeg_csv_path;
                htime_param.mjpeg_root_path = image_root_url;
                htime_param.mw = mw;
                // Handle Timestamp csv
                //CSVHandler.HandleTimestamp(htime_param);
                // Handle Timestamp csv mtd
                Thread htime_thread = new Thread(CSVHandler.HandleTimestamp);
                htime_thread.Start(htime_param);

                // mw.DebugWriteLine("导入视频序列" + Filelist[i].text + "完成");
            }
            mw.DebugWriteLine("导入视频序列" + EncodeResult + "完成");

            while (threadControlCounter < (Filelist.Count() * 2))
            {
                int task_now = (int)(GetSystemAllPath.GetDirectorySize(filepath + "\\DecodeResult") / 1000000);
                mw.SubProcessReport(task_now + mw.line_counter);
                Thread.Sleep(100);
            }
            threadControlCounter = 0;
            //Console.WriteLine("---Decoding Finished " + EncodeResult + ".....\n");
            mw.DebugWriteLine("解析视频目录" + EncodeResult + "完成");
        }