// Put us in a mode that allows for playing video
        void AllowPlay()
        {
            int       hr;
            int       buttonavail, curbutton;
            DvdDomain dvdd;
            IDvdState dss;

            // Keep clicking buttons until we start playing a title
            while ((hr = m_idi2.GetCurrentDomain(out dvdd)) == 0 &&
                   ((dvdd == DvdDomain.VideoManagerMenu) || (dvdd == DvdDomain.VideoTitleSetMenu)))
            {
                hr = m_idi2.GetCurrentButton(out buttonavail, out curbutton);
                DsError.ThrowExceptionForHR(hr);

                if (curbutton > 0)
                {
                    hr = m_idc2.SelectAndActivateButton(1);
                    DsError.ThrowExceptionForHR(hr);
                }

                Thread.Sleep(500);
            }

            DsError.ThrowExceptionForHR(hr);

            hr = m_idi2.GetState(out dss);
            DsError.ThrowExceptionForHR(hr);

            m_ips = dss as IPersistStream;
        }
Esempio n. 2
0
        // Get past all the menus to a point where titles can be played.
        void AllowPlay()
        {
            int       hr;
            int       buttonavail, curbutton;
            IDvdCmd   ppCmd = null;
            DvdDomain dvdd;

            hr = m_idi2.GetCurrentDomain(out dvdd);
            DsError.ThrowExceptionForHR(hr);

            if (dvdd == DvdDomain.Stop)
            {
                hr = m_idc2.Resume(DvdCmdFlags.Flush, out ppCmd);
                if (hr < 0)
                {
                    hr = m_idc2.ShowMenu(DvdMenuId.Title, DvdCmdFlags.Flush, out ppCmd);
                    DsError.ThrowExceptionForHR(hr);
                }
            }

            while ((hr = m_idi2.GetCurrentDomain(out dvdd)) == 0 &&
                   ((dvdd == DvdDomain.VideoManagerMenu) || (dvdd == DvdDomain.VideoTitleSetMenu)))
            {
                hr = m_idi2.GetCurrentButton(out buttonavail, out curbutton);
                DsError.ThrowExceptionForHR(hr);

                if (curbutton > 0)
                {
                    hr = m_idc2.SelectAndActivateButton(1);
                    DsError.ThrowExceptionForHR(hr);
                }

                Thread.Sleep(500);
            }

            DsError.ThrowExceptionForHR(hr);

            hr = m_idc2.Stop();
            DsError.ThrowExceptionForHR(hr);
        }