/// <summary>
 /// 比例显示(仅限于软解码).
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void FullWindos_MenuItem_Click(object sender, EventArgs e)
 {
     if (channelID > 0)
     {
         var checkState = (sender as ToolStripMenuItem).CheckState;
         if (checkState == CheckState.Unchecked)
         {
             int ret = PlayerSdk.EasyPlayer_SetShownToScale(channelID, 1);
             (sender as ToolStripMenuItem).CheckState = CheckState.Checked;
         }
         if (checkState == CheckState.Checked)
         {
             int ret = PlayerSdk.EasyPlayer_SetShownToScale(channelID, 0);
             (sender as ToolStripMenuItem).CheckState = CheckState.Unchecked;
         }
     }
 }
示例#2
0
        /// <summary>
        /// 关键帧播放
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void KeyFreamDecode_MenuItem_Click(object sender, EventArgs e)
        {
            if (channelID <= 0)
            {
                return;
            }

            var checkState = (sender as ToolStripMenuItem).CheckState;

            if (checkState == CheckState.Unchecked)
            {
                int ret = PlayerSdk.EasyPlayer_SetDecodeType(channelID, 1);
                (sender as ToolStripMenuItem).CheckState = CheckState.Checked;
            }
            if (checkState == CheckState.Checked)
            {
                int ret = PlayerSdk.EasyPlayer_SetShownToScale(channelID, 0);
                (sender as ToolStripMenuItem).CheckState = CheckState.Unchecked;
            }
        }
        /// <summary>
        /// 开始播放rtsp
        /// </summary>
        public void startPlay()
        {
            try
            {
                //todo 要去掉
                //Thread.Sleep(100);
                logger.Info("将要播放编号[" + messageModel.memberNo + "]的图像,rtsp地址是:" + messageModel.videoData.rtspUrl);

                if (!"start".Equals(messageModel.videoMessageType))
                {
                    return;
                }

                string rtspPath = messageModel.videoData.rtspUrl;
                if (null == rtspPath || "".Equals(rtspPath))
                {
                    logger.Info("将要播放编号[" + messageModel.memberNo + "]的图像,但是没有rtsp地址");
                    return;
                }

                channelId = PlayerSdk.EasyPlayer_OpenStream(rtspPath, rtspPanel.Handle, PlayerSdk.RENDER_FORMAT.DISPLAY_FORMAT_RGB24_GDI, 1, "", "", mainForm.callBack, IntPtr.Zero, mainForm.isHardEncode);
                logger.Info("播放的图像的channelID:" + channelId);
                if (channelId > 0)
                {
                    videoPlayStatus = true;

                    PlayerSdk.EasyPlayer_SetFrameCache(channelId, 3);
                    int  ret;
                    bool covered = null == messageModel.videoData.covered ? true : (bool)messageModel.videoData.covered;
                    if (covered)
                    {
                        ret = PlayerSdk.EasyPlayer_SetShownToScale(channelId, 0);
                    }
                    else
                    {
                        ret = PlayerSdk.EasyPlayer_SetShownToScale(channelId, 1);
                    }
                    logger.Info("关闭其它窗口音频");
                    mainForm.resetAllVolumeStatus();
                    logger.Info("打开当前窗口音频图标");
                    changeVolumeStatus(true);
                    //int retStartAudio = PlayerSdk.EasyPlayer_PlaySound(channelId);//播放音频
                    //logger.Info("播放音频状态:" + retStartAudio);
                    //if (retStartAudio == 0)
                    //{
                    //    //关闭其它窗口音频
                    //    logger.Info("关闭其它窗口音频");
                    //    mainForm.resetAllVolumeStatus();
                    //    logger.Info("打开当前窗口音频图标");
                    //    changeVolumeStatus(true);
                    //}
                }
                else //拉流失败
                {
                    logger.Info("拉流失败");
                    channelId = 0;
                    mainForm.tcpServerService.notifyErrMsg(messageModel.memberNo, "播放错误!");
                }
            }
            catch (Exception e)
            {
                logger.Error("", e);
            }
        }