示例#1
0
 public static void OnExit(IntPtr MDInstance, IntPtr MDWnd, int Log_Set)
 {
     LogProvider.Add(DebugLevel.Info, cLogSection, Message.MdapiUnload);
     try
     {
         _IsStopping = true;
         _DvbAdapter.Tune(-1, -1, -1, -1);
         _DvbAdapter.Dispose();
     }
     catch (Exception ex)
     {
         LogProvider.Exception(cLogSection, Message.MdapiUnloadFailed, ex);
     }
     Globals.Dispose();
 }
示例#2
0
        public static int EventMsg(Event ev, IntPtr data)
        {
            LogProvider.Add(DebugLevel.DvbViewerPluginEvent, cLogSection, Message.DvbvEvent, ev);
            try
            {
                switch (ev)
                {
                case Event.InitComplete:
                    break;

                case Event.TuneChannel:

                    if (data != IntPtr.Zero)
                    {
                        TChannel chan = (TChannel)Marshal.PtrToStructure(data, typeof(TChannel));
                        PostMessage(_DvbViewerHwnd, (uint)WMessage.DvbViewer, new UIntPtr((uint)ParamMessages.AddTsCall), _NativeTsCallback);
                        _DvbAdapter.Tune(chan.Sid, chan.PmtPid, chan.TransportStreamId, chan.NetworkId);
                    }
                    else if (_DvbAdapter.IsTuned)     // bei einigen Versionen kommt hier null (nil in pascal)
                    {
                        PostMessage(_DvbViewerHwnd, (uint)WMessage.DvbViewer, new UIntPtr((uint)ParamMessages.DelTsCall), _NativeTsCallback);
                        _DvbAdapter.Tune(-1, -1, -1, -1);
                    }

                    break;

                case Event.RemoveChannel:    // üblicherweise DVBViewer
                case Event.DisableTuner:     // überlicherweise Recording-Service oder DVBViewer Media Server

                    if (_DvbAdapter.IsTuned)
                    {
                        PostMessage(_DvbViewerHwnd, (uint)WMessage.DvbViewer, new UIntPtr((uint)ParamMessages.DelTsCall), _NativeTsCallback);
                        _DvbAdapter.Tune(-1, -1, -1, -1);
                    }
                    break;

                case Event.Unload:
                    Dispose();
                    break;
                }
            }
            catch (Exception ex)
            {
                LogProvider.Exception(cLogSection, Message.DvbvEventFailed, ex);
            }

            return(0);
        }