/// <summary> /// 设置回调委托 /// </summary> /// <param name="callBack"> 回调委托 </param> /// <returns></returns> public KeyValuePair <bool, string> SetCallback(RTSPSourceCallBack callBack) { if (!this.IsInit) { return(new KeyValuePair <bool, string>(false, "RTSP 未创建!")); } try { int ret = IsWindows ? EasyRTSP_SetCallback_Win32(this.RtspHandle, callBack) : EasyRTSP_SetCallback_Linux(this.RtspHandle, callBack); if (ret == 0) { this.RTSPCallBack = callBack; return(new KeyValuePair <bool, string>(true, "RTSP 设置回调成功!")); } else { return(new KeyValuePair <bool, string>(false, string.Format("RTSP 设置回调失败,错误代码:{0}", ret))); } } catch (System.Exception e) { return(new KeyValuePair <bool, string>(false, e.Message)); } }
private extern static int EasyRTSP_SetCallback_Linux(IntPtr handle, RTSPSourceCallBack callBack);