private string RtspAuth(RtspAuth rtspAuth) { if (!this.IsCurrentMedia(rtspAuth.MediaInfo)) { return(null); } rtspAuth.MediaSourceWapper = this; return(OnRtspAuth?.Invoke(rtspAuth)); }
private static void mk_rtsp_auth(IntPtr mk_media_info, string realm, string user_name, int must_no_encrypt, IntPtr mk_rtsp_auth_invoker, IntPtr mk_sock_info) { var mediaInfo = new MediaInfo(mk_media_info); var list = new List <Task <string> >(); var rtspAuth = new RtspAuth() { MediaInfo = mediaInfo, Realm = realm, Username = user_name, MustNoEncrypt = must_no_encrypt == 1, SockInfo = new SockInfo(mk_sock_info) }; foreach (Func <RtspAuth, string> item in OnRtspGetRealm.GetInvocationList()) { list.Add(Task <string> .Run(() => item(rtspAuth))); } Task.WaitAll(list.ToArray()); var password = list.FirstOrDefault(w => w.Result != null)?.Result; PInvoke.ZLMediaKitMethod.mk_rtsp_auth_invoker_do(mk_rtsp_auth_invoker, rtspAuth.MustNoEncrypt ? 0 : 1, password); }