Esempio n. 1
0
        public string StartVideoSave(string hostIP, uint hostPort, string videoPath, int startSecond, int endSecond, string savefilepath)
        {
            MyLog4Net.Container.Instance.Log.DebugWithDebugView(string.Format("BaseOCX  StartVideoSave hostIP:{0},hostPort:{1},videoPath:{2},startSecond:{3},endSecond:{4},savefilepath:{5}"
                                                                              , hostIP, hostPort, videoPath, startSecond, endSecond, savefilepath));

            try
            {
                int handle = m_videoExport.AddExport(hostIP, hostPort, videoPath, (uint)startSecond, (uint)endSecond, savefilepath);
                if (handle > 0)
                {
                    MyLog4Net.Container.Instance.Log.DebugWithDebugView("BaseOCX  StartVideoSave error handle:" + handle);

                    return(MakeRetMsg(LVErrorType.No_Error, "", handle.ToString()));
                }
                else
                {
                    MyLog4Net.Container.Instance.Log.DebugWithDebugView("BaseOCX  StartVideoSave error handle=0");

                    return(MakeRetMsg(LVErrorType.Err_ExportVideo, "导出失败,handle=0"));
                }
            }
            catch (SDKCallException ex)
            {
                MyLog4Net.Container.Instance.Log.DebugWithDebugView("BaseOCX  StartVideoSave error :" + ex);

                return(MakeRetMsg(LVErrorType.Err_ExportVideo, "导出失败,[" + ex.ErrorCode + "]" + ex.Message));

                //MessageBoxEx.Show("视频【" + fileName + "】导出失败,[" + ex.ErrorCode + "]" + ex.Message, IVX.Live.MainForm.Framework.Environment.PROGRAM_NAME);
            }
        }
Esempio n. 2
0
        void vod_VideoStartSave4OCX(object sender, EventArgs e)
        {
            IVX.Live.MainForm.View.ucPlayHistory vod = sender as MainForm.View.ucPlayHistory;
            string fileName = string.Format("视频导出_{0}_{1}.mp4", vod.OCX_StartSecond, vod.OCX_EndSecond);
            bool   needSave = true;

            fileName = IVX.Live.MainForm.Framework.Environment.VideoSavePath.TrimEnd('\\') + "\\" + fileName;
            System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
            sfd.RestoreDirectory = true;

            sfd.Filter   = "*.mp4|*.mp4|全部文件|*.*";
            sfd.FileName = System.IO.Path.GetFileName(fileName);

            sfd.InitialDirectory = IVX.Live.MainForm.Framework.Environment.VideoSavePath;
            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                fileName = sfd.FileName;
            }
            else
            {
                needSave = false;
            }

            if (needSave)
            {
                try
                {
                    int handle = m_videoExport.AddExport(vod.OCX_MssHostIp, vod.OCX_MssHostPort, vod.OCX_VideoPath, (uint)vod.OCX_StartSecond, (uint)vod.OCX_EndSecond, fileName);
                    if (handle > 0 && IsHandleCreated && OnVideoSaveStarted != null)
                    {
                        OnVideoSaveStarted(handle, fileName);
                    }
                }
                catch (SDKCallException ex)
                {
                    MessageBoxEx.Show("视频【" + fileName + "】导出失败,[" + ex.ErrorCode + "]" + ex.Message, IVX.Live.MainForm.Framework.Environment.PROGRAM_NAME);
                }
            }
        }