Exemple #1
0
        public static HIDInput getInstance()
        {
            if (_instance == null)
            {
                _instance        = new HIDInput();
                _instance.Bounds = new System.Drawing.Rectangle(-1, -1, 1, 1);
                _instance.Show();
                _instance.Visible = false;

                Application.AddMessageFilter(_instance);
            }

            return(_instance);
        }
Exemple #2
0
        public static HIDInput getInstance()
        {
            if (_instance == null)
            {
                _instance = new HIDInput();
                _instance.Bounds = new System.Drawing.Rectangle(-1, -1, 1, 1);
                _instance.Show();
                _instance.Visible = false;

                Application.AddMessageFilter(_instance);
            }

            return _instance;
        }
Exemple #3
0
        public Auto3DSetup(List <IAuto3D> list)
        {
            InitializeComponent();

            String labeInfoText = "";

            foreach (IAuto3D item in list)
            {
                comboBoxModel.Items.Add(item);
                panelSettings.Controls.Add(item.GetSetupControl());

                item.GetSetupControl().Dock = DockStyle.Fill;

                String[] versionInfo = item.GetType().Assembly.FullName.Split(',');
                String[] version     = versionInfo[1].Split('=');
                labeInfoText += versionInfo[0] + "\n" + version[0] + " = " + version[1] + "\n\n";
            }

            String [] versionInfoUPnP = System.Reflection.Assembly.GetAssembly(typeof(MediaPortal.ProcessPlugins.Auto3D.UPnP.Auto3DUPnP)).FullName.Split(',');
            String[]  versionUPnP     = versionInfoUPnP[1].Split('=');

            labeInfoText += versionInfoUPnP[0] + " (UPnP)\n" + versionUPnP[0] + " = " + versionUPnP[1] + "\n\n";

            labelInfo.Text = labeInfoText;

            textBoxMenuHotkey.GotFocus  += textBoxMenuHotkey_GotFocus;
            textBoxMenuHotkey.LostFocus += textBoxMenuHotkey_LostFocus;
            textBoxMenuHotkey.KeyDown   += textBoxMenuHotkey_KeyDown;

            LoadSettings();

            // as we are not in context of MediaPortal, we need our on raw input filter
            HIDInput.HandleOwnDevices = true;
            HIDInput.getInstance().HidEvent += Auto3DSetup_HidEvent;

            CenterToParent();

            tabControl3D.Selected += tabControl3D_Selected;
        }
Exemple #4
0
        public void Stop()
        {
            // sometimes stop is called before SystemEvents_SessionEnding
            // in this case we shut down devices here, if necessary (before connection is closed)

            bool bShutDownPending = GetSystemMetrics(0x2000) != 0;

            Log.Debug("Auto3D: Stop - ShutDownPending = " + bShutDownPending);
            Log.Debug("Auto3D: Stop - MePoPowerOff = " + GUIGraphicsContext.StoppingToPowerOff);

            if (bShutDownPending || GUIGraphicsContext.StoppingToPowerOff)
            {
                SystemShutDown();
            }

            // stop UPnP
            Auto3DUPnP.StopSSDP();

            _run = false;
            _activeDevice.Stop();

            if (bMenuMCERemote)
            {
                HIDInput.getInstance().HidEvent -= Auto3DSetup_HidEvent;
            }

            if (!bSuppressSwitchBackTo2D)
            {
                GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.None;
            }

            g_Player.PlayBackEnded   -= OnVideoEnded;
            g_Player.PlayBackStopped -= OnVideoStopped;
            g_Player.PlayBackStarted -= OnVideoStarted;

            SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged;
        }
Exemple #5
0
        public void Start()
        {
            _run = true;

            g_Player.PlayBackEnded    += OnVideoEnded;
            g_Player.PlayBackStopped  += OnVideoStopped;
            g_Player.PlayBackStarted  += OnVideoStarted;
            g_Player.TVChannelChanged += OnTVChannelChanged;

            using (Settings reader = new MPSettings())
            {
                b3DMenuAlways = reader.GetValueAsBool("Auto3DPlugin", "3DMenuAlways", false);
                b3DMenuOnKey  = reader.GetValueAsBool("Auto3DPlugin", "3DMenuOnKey", false);
                String menuHotKey = reader.GetValueAsString("Auto3DPlugin", "3DMenuKey", "CTRL + D");

                if (menuHotKey.StartsWith("MCE")) // reject old configs
                {
                    menuHotKey = "";
                }

                if (menuHotKey.StartsWith("HID"))
                {
                    bMenuMCERemote = true;
                    mceRemoteKey   = menuHotKey;

                    HIDInput.getInstance().HidEvent += Auto3DSetup_HidEvent;
                }
                else
                {
                    bMenuHotKeyShift = menuHotKey.Contains("SHIFT");
                    bMenuHotKeyCtrl  = menuHotKey.Contains("CTRL");
                    bMenuHotKeyAlt   = menuHotKey.Contains("ALT");

                    if (menuHotKey.Contains("+"))
                    {
                        int pos = menuHotKey.LastIndexOf('+');
                        menuHotKey = menuHotKey.Substring(pos + 1).Trim();
                    }

                    _menuHotKey = (Keys)Enum.Parse(typeof(Keys), menuHotKey, true);
                }

                bCheckNameSimple = reader.GetValueAsBool("Auto3DPlugin", "CheckNameSimple", true);
                bCheckNameFull   = reader.GetValueAsBool("Auto3DPlugin", "CheckNameFull", true);

                bCheckSideBySide      = reader.GetValueAsBool("Auto3DPlugin", "SideBySide", true);
                bCheckTopAndBottom    = reader.GetValueAsBool("Auto3DPlugin", "TopAndBottom", false);
                bAnalyzeNetworkStream = reader.GetValueAsBool("Auto3DPlugin", "AnalyzeNetworkStream", true);

                String activeDeviceName = reader.GetValueAsString("Auto3DPlugin", "ActiveDevice", "");

                bTV    = reader.GetValueAsBool("Auto3DPlugin", "TV", false);
                bVideo = reader.GetValueAsBool("Auto3DPlugin", "Video", true);

                if (reader.GetValueAsBool("Auto3DPlugin", "CheckNameFormatSBS", true))
                {
                    _nameFormat = VideoFormat.Fmt3DSBS;
                }
                else
                {
                    _nameFormat = VideoFormat.Fmt3DTAB;
                }

                foreach (IAuto3D device in _listDevices)
                {
                    if (device.ToString() == activeDeviceName)
                    {
                        _activeDevice = device;
                    }
                }

                if (_activeDevice == null)
                {
                    _activeDevice = _listDevices[0];
                }

                Log.Info("Auto3D: Connecting to Device " + _activeDevice.ToString());

                _activeDevice.Start();

                if (_activeDevice is Auto3DUPnPBaseDevice)
                {
                    Auto3DUPnP.StartSSDP();
                }

                if (b3DMenuOnKey)
                {
                    Auto3DHelpers.GetMainForm().PreviewKeyDown += form_PreviewKeyDown;
                }

                GUIGraphicsContext.Render3DSubtitle         = reader.GetValueAsBool("Auto3DPlugin", "3DSubtitles", true);
                GUIGraphicsContext.Render3DSubtitleDistance = -reader.GetValueAsInt("Auto3DPlugin", "SubtitleDepth", 0);

                bConvert2Dto3DEnabled = reader.GetValueAsBool("Auto3DPlugin", "ConvertTo3D", false);
                GUIGraphicsContext.Convert2Dto3DSkewFactor = reader.GetValueAsInt("Auto3DPlugin", "SkewFactor", 10);

                bStretchSubtitles = reader.GetValueAsBool("Auto3DPlugin", "StretchSubtitles", false);

                bSuppressSwitchBackTo2D = reader.GetValueAsBool("Auto3DPlugin", "SupressSwitchBackTo2D", false);
                bConvert3DTo2D          = reader.GetValueAsBool("Auto3DPlugin", "Convert3DTo2D", false);

                SplitKeywords(ref _keywordsSBS, reader.GetValueAsString("Auto3DPlugin", "SwitchSBSLabels", "\"3DSBS\", \"3D SBS\""));
                SplitKeywords(ref _keywordsSBSR, reader.GetValueAsString("Auto3DPlugin", "SwitchSBSRLabels", "\"3DSBSR\", \"3D SBS R\""));
                SplitKeywords(ref _keywordsTAB, reader.GetValueAsString("Auto3DPlugin", "SwitchTABLabels", "\"3DTAB\", \"3D TAB\""));
                SplitKeywords(ref _keywordsTABR, reader.GetValueAsString("Auto3DPlugin", "SwitchTABRLabels", "\"3DTABR\", \"3D TAB R\""));

                bTurnDeviceOff     = reader.GetValueAsBool("Auto3DPlugin", "TurnDeviceOff", false);
                nTurnDeviceOffVia  = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOffVia", 0);
                nTurnDeviceOffWhen = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOffWhen", 0);

                bTurnDeviceOn     = reader.GetValueAsBool("Auto3DPlugin", "TurnDeviceOn", false);
                nTurnDeviceOnVia  = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOnVia", 0);
                nTurnDeviceOnWhen = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOnWhen", 0);
            }

            SystemEvents.PowerModeChanged  += SystemEvents_PowerModeChanged;
            SystemEvents.SessionEnding     += SystemEvents_SessionEnding;
            GUIGraphicsContext.OnNewAction += GUIGraphicsContext_OnNewAction;

            if (bTurnDeviceOff && (nTurnDeviceOnWhen == 0 || nTurnDeviceOnWhen == 2) && _activeDevice.GetTurnOffInterfaces() != DeviceInterface.None)
            {
                _activeDevice.TurnOn((DeviceInterface)nTurnDeviceOnVia);
            }
        }
Exemple #6
0
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     base.OnFormClosing(e);
     HIDInput.getInstance().HidEvent -= Auto3DSetup_HidEvent;
 }