private void btnPlay_Click(object sender, EventArgs e)
        {
            if (m_iLogonID < 0)
            {
                return;
            }
            string sFileName = "";

            for (int i = 0; i < lvFileData.Items.Count; i++)
            {
                if (lvFileData.Items[i].Checked)
                {
                    sFileName = lvFileData.Items[i].SubItems[1].Text.ToString();
                    break;
                }
            }
            sFileName = sFileName.Trim();
            int irt = -1;

            irt = PLAYSDK.TC_CreateSystem(IntPtr.Zero);
            if (irt < 0)
            {
                MessageBox.Show("TC_CreateSystem failed!");
            }
            PlayForm frmPlay = new PlayForm(m_ClientInfo, sFileName, this);

            frmPlay.ShowDialog();
        }
Exemple #2
0
        private void btnPlaySpeedChange_Click(object sender, EventArgs e)
        {
            if (m_ClientInfo.m_iServerID == -1 || m_ulConnID == -1)
            {
                return;
            }

            int iSpeed = 0;

            try
            {
                iSpeed = Convert.ToInt32(tbPlaySpeed.Text.ToString());
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("Please input the Number: -4~4!" + ex.Message);
            }
            if (m_iPlayerID != -1)
            {
                if (iSpeed != 0 & iSpeed > -4 & iSpeed < 4)
                {
                    PLAYSDK.TC_FastForward(m_iPlayerID, iSpeed);
                }
                else
                {
                    PLAYSDK.TC_Play(m_iPlayerID);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Download location
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDLLocation_Click(object sender, EventArgs e)
        {
            if (m_ClientInfo.m_iServerID == -1 || m_ulConnID == -1)
            {
                return;
            }


            int iPos = 0;

            try
            {
                iPos = Convert.ToInt32(tbDLLocation.Text.ToString());
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("Please input the Number: 0~100!" + ex.Message);
            }


            if (iPos >= 0 && iPos < 100)
            {
                NVSSDK.NetClient_NetFileDownloadFile(ref m_ulConnID, m_ClientInfo.m_iServerID, "", "", 1, iPos, -1);
                if (m_iPlayerID >= 0)
                {
                    PLAYSDK.TC_CleanStreamBuffer(m_iPlayerID);
                }
            }
        }
Exemple #4
0
 private void UI_UpdateProgressByFile()
 {
     if (m_ulConnID != -1)
     {
         int iProgress = 0, iSize = 0;
         int iRet = NVSSDK.NetClient_NetFileGetDownloadPos(m_ulConnID, ref iProgress, ref iSize);
         if (iRet >= 0)
         {
             string sProgress = "***" + iProgress.ToString() + "%/" + iSize.ToString() + "dB***";
             lbDownloadProgress.Text = sProgress;
             if (iProgress > 0 & iProgress < 100)
             {
                 pgbDownload.Value = iProgress;
             }
         }
     }
     if (m_iPlayerID != -1)
     {
         if (PLAYSDK.TC_GetFrameCount(m_iPlayerID) == 0)
         {
             return;
         }
         int    i         = PLAYSDK.TC_GetPlayingFrameNum(m_iPlayerID);
         int    j         = PLAYSDK.TC_GetFrameCount(m_iPlayerID);
         int    iProgress = i * 100 / j;
         string sProgress = "***" + iProgress.ToString() + "%***";
         lbPlayProgress.Text = sProgress;
         if (iProgress <= 100 & iProgress >= 0)
         {
             pgbPlay.Value = iProgress;
         }
     }
 }
Exemple #5
0
 private void PlayForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     PLAYSDK.TC_Stop(m_iPlayerID);         //停止播放
     PLAYSDK.TC_StopAudio(m_iPlayerID);
     PLAYSDK.TC_DeletePlayer(m_iPlayerID); //删除播放器实例
     PLAYSDK.TC_DeleteSystem();
     NVSSDK.NetClient_NetFileStopDownloadFile(m_ulConnID);
 }
        private void btnPlayTime_Click(object sender, EventArgs e)
        {
            if (dtStartTimeTime.Value >= dtEndTimeTime.Value)
            {
                MessageBox.Show("Start Time > End Time!");
                return;
            }
            if (m_iLogonID < 0)
            {
                return;
            }
            m_StartTime.m_iYear   = Convert.ToUInt16(dtStartTimeTime.Value.Year);
            m_StartTime.m_iMonth  = Convert.ToUInt16(dtStartTimeTime.Value.Month);
            m_StartTime.m_iDay    = Convert.ToUInt16(dtStartTimeTime.Value.Day);
            m_StartTime.m_iHour   = Convert.ToUInt16(dtStartTimeTime.Value.Hour);
            m_StartTime.m_iMinute = Convert.ToUInt16(dtStartTimeTime.Value.Minute);
            m_StartTime.m_iSecond = Convert.ToUInt16(dtStartTimeTime.Value.Second);


            m_EndTime.m_iYear   = Convert.ToUInt16(dtEndTimeTime.Value.Year);
            m_EndTime.m_iMonth  = Convert.ToUInt16(dtEndTimeTime.Value.Month);
            m_EndTime.m_iDay    = Convert.ToUInt16(dtEndTimeTime.Value.Day);
            m_EndTime.m_iHour   = Convert.ToUInt16(dtEndTimeTime.Value.Hour);
            m_EndTime.m_iMinute = Convert.ToUInt16(dtEndTimeTime.Value.Minute);
            m_EndTime.m_iSecond = Convert.ToUInt16(dtEndTimeTime.Value.Second);

            int iChannelNo  = cbPassNOTime.SelectedIndex;
            int iStreamNo   = cbBitStreamType.SelectedIndex;
            int iChannelNum = 0;

            NVSSDK.NetClient_GetChannelNum(m_ClientInfo.m_iServerID, ref iChannelNum);
            int iRealChannel = iStreamNo * iChannelNum + iChannelNo;
            //m_PlayPage.SetDownloadParam(m_iLogonID, iRealChannel/*iChannelNo*/, &begintime, &endtime);
            //m_PlayPage.DoModal();

            int irt = -1;

            irt = PLAYSDK.TC_CreateSystem(IntPtr.Zero);
            if (irt < 0)
            {
                MessageBox.Show("TC_CreateSystem failed!");
            }
            PlayForm frmPlay = new PlayForm(m_ClientInfo, iRealChannel, m_StartTime, m_EndTime, this);

            frmPlay.ShowDialog();
        }
Exemple #7
0
 private void DoCallBackFunction(UInt32 _ulID, IntPtr _ucData, Int32 _iLen,
                                 Int32 _iFlag,
                                 Int32 _lpUserData)
 {
     if (_ulID == m_ulConnID)
     {
         if (_iFlag == 1)    //处理文件头
         {
             if (m_iPlayerID == -1)
             {
                 Control.CheckForIllegalCrossThreadCalls = false;
                 m_iPlayerID = PLAYSDK.TC_CreatePlayerFromVoD(pnlVideoPlay.Handle, _ucData, _iLen);//创建VOD播放器
                 if (m_iPlayerID >= 0)
                 {
                     int i = PLAYSDK.TC_Play(m_iPlayerID);//播放
                     if (i < 0)
                     {
                         MessageBox.Show(m_iPlayerID.ToString() + "TC_Play faild");
                     }
                     i = PLAYSDK.TC_PlayAudio(m_iPlayerID);
                     if (i < 0)
                     {
                         MessageBox.Show(m_iPlayerID.ToString() + "TC_PlayAudio faild");
                     }
                 }
                 else
                 {
                     MessageBox.Show("CreatePlayerFromVoD failed!\n");
                 }
             }
         }
         else    //处理数据
         {
             int i = PLAYSDK.TC_PutStreamToPlayer(m_iPlayerID, _ucData, _iLen);
             //if (i < 0)
             //{
             //    MessageBox.Show(m_iPlayerID.ToString() + "TC_PutStreamToPlayer faild");
             //}
             //CheckStatus();
         }
     }
 }
Exemple #8
0
        public void ContinueDownload()
        {
            if (m_ClientInfo.m_iServerID == -1 || m_ulConnID == -1)
            {
                return;
            }

            if (m_iDownloadPause == 1)
            {
                int iState = 0;
                int iRet   = PLAYSDK.TC_GetStreamPlayBufferState(m_iPlayerID, ref iState);
                if (iRet == 0)
                {
                    if (iState == -19)             //RET_BUFFER_WILL_BE_EMPTY )
                    {
                        //iRet = NVSSDK.NetClient_NetFileDownloadFile(ref m_ulConnID, m_ClientInfo.m_iServerID, m_szFileName, "", 1, -1, 1);
                        iRet             = NVSSDK.NetClient_NetFileDownloadFile(ref m_ulConnID, m_ClientInfo.m_iServerID, "", "", 1, -1, 1);
                        m_iDownloadPause = 0;
                    }
                }
            }
        }
Exemple #9
0
        private void UI_UpdateProgressByTime()
        {
            if (m_ulConnID != -1)
            {
                int iCurrentDonwnTime = 0, iSize = 0;
                int iRet = NVSSDK.NetClient_NetFileGetDownloadPos(m_ulConnID, ref iCurrentDonwnTime, ref iSize);
                if (iRet >= 0)
                {
                    DateTime dtTime = CommonFunction.ConvertIntToDateTime(iCurrentDonwnTime);
                    lbDownloadProgress.Text = dtTime.Year.ToString() + "-" +
                                              dtTime.Month.ToString() + "-" +
                                              dtTime.Day.ToString() + " " +
                                              dtTime.Hour.ToString() + ":" +
                                              dtTime.Minute.ToString() + ":" +
                                              dtTime.Second.ToString() + " Size:" +
                                              iSize.ToString() + "db";


                    long uiBeginTime   = CommonFunction.NvsFileTimeToAbsSeconds(m_begintime);
                    long uiEndTime     = CommonFunction.NvsFileTimeToAbsSeconds(m_endtime);
                    long iTimeInterval = uiEndTime - uiBeginTime;
                    if (iTimeInterval > 0)
                    {
                        long iCurrentInterval = iCurrentDonwnTime - uiBeginTime;
                        if (iCurrentInterval > 0 && iCurrentInterval < iTimeInterval)
                        {
                            long iProcess = iCurrentInterval * 100 / iTimeInterval;
                            if (iProcess > 100)
                            {
                                return;
                            }
                            pgbDownload.Value = Convert.ToInt32(iProcess);
                        }
                    }
                }
            }
            if (m_iPlayerID != -1)
            {
                Int32 uiCurrentPlayTime = 0;
                PLAYSDK.TC_GetUserDataInfo(m_iPlayerID, -1, 0, ref uiCurrentPlayTime, Marshal.SizeOf(uiCurrentPlayTime));

                if (uiCurrentPlayTime > 0)
                {
                    DateTime dtTime = CommonFunction.ConvertIntToDateTime(uiCurrentPlayTime);
                    lbDownloadProgress.Text = dtTime.Year.ToString() + "-" +
                                              dtTime.Month.ToString() + "-" +
                                              dtTime.Day.ToString() + " " +
                                              dtTime.Hour.ToString() + ":" +
                                              dtTime.Minute.ToString() + ":" +
                                              dtTime.Second.ToString();


                    long uiBeginTime   = CommonFunction.NvsFileTimeToAbsSeconds(m_begintime);
                    long uiEndTime     = CommonFunction.NvsFileTimeToAbsSeconds(m_endtime);
                    long iTimeInterval = uiEndTime - uiBeginTime;
                    if (iTimeInterval > 0)
                    {
                        long iCurrentInterval = uiCurrentPlayTime - uiBeginTime;
                        if (iCurrentInterval > 0 && iCurrentInterval < iTimeInterval)
                        {
                            long iProcess = iCurrentInterval * 100 / iTimeInterval;
                            if (iProcess > 100)
                            {
                                return;
                            }
                            pgbDownload.Value = Convert.ToInt32(iProcess);
                        }
                    }
                }
            }
        }