Exemplo n.º 1
0
        void TestSourceWidth()
        {
            int hr;
            int sw;

            hr = m_ibv.IsUsingDefaultSource();
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(hr == 0, "IsUsingDefaultSource");

            hr = m_ibv.put_SourceWidth(200);
            DsError.ThrowExceptionForHR(hr);

            hr = m_ibv.get_SourceWidth(out sw);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(sw == 200, "SourceWidth");

            hr = m_ibv.IsUsingDefaultSource();
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(hr == 1, "IsUsingDefaultSource2");

            hr = m_ibv.SetDefaultSourcePosition();
            DsError.ThrowExceptionForHR(hr);

            hr = m_ibv.get_SourceWidth(out sw);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(sw == 320, "SourceWidth2");
        }
Exemplo n.º 2
0
        /// <summary> handling the very first start of dvd playback. </summary>
        private bool FirstPlayDvd(string file)
        {
            int hr;

            try
            {
                _pendingCmd = true;
                CloseDVDInterfaces();
                string path = null;
                _currentFile = file;

                if (MediaPortal.Util.VirtualDirectory.IsImageFile(System.IO.Path.GetExtension(file)))
                {
                    file = MediaPortal.Util.DaemonTools.GetVirtualDrive() + @"\VIDEO_TS\VIDEO_TS.IFO";
                }

                // Cyberlink navigator needs E:\\VIDEO_TS formatted path with double \
                path = file.Replace(@"\\", @"\").Replace(Path.GetFileName(file), "").Replace(@"\", @"\\");

                if (!GetDVDInterfaces(path))
                {
                    logger.Error("DVDPlayer:Unable getinterfaces()");
                    CloseDVDInterfaces();
                    return(false);
                }



                if (_basicVideo != null)
                {
                    _basicVideo.SetDefaultSourcePosition();
                    _basicVideo.SetDefaultDestinationPosition();
                }

/*                hr = _mediaCtrl.Run();
 *              if (hr < 0 || hr > 1)
 *              {
 *                  MediaPortal.Util.HResult hrdebug = new MediaPortal.Util.HResult(hr);
 *                  logger.Info(hrdebug.ToDXString());
 *                  Log.Error("DVDPlayer:Unable to start playing() 0x:{0:X}", hr);
 *                  CloseDVDInterfaces();
 *                  return false;
 *              }
 */
                DvdDiscSide side;
                int         titles, numOfVolumes, volume;
                hr = _dvdInfo.GetDVDVolumeInfo(out numOfVolumes, out volume, out side, out titles);
                if (hr < 0)
                {
                    logger.Error("DVDPlayer:Unable to get dvdvolumeinfo 0x{0:X}", hr);
                    CloseDVDInterfaces();
                    return(false);    // can't read disc
                }
                else
                {
                    if (titles <= 0)
                    {
                        logger.Error("DVDPlayer:DVD does not contain any titles? {0}", titles, 1);
                        //return false;
                    }
                }
                hr = _dvdCtrl.SelectVideoModePreference(_videoPref);
                DvdVideoAttributes videoAttr;
                hr           = _dvdInfo.GetCurrentVideoAttributes(out videoAttr);
                _videoWidth  = videoAttr.sourceResolutionX;
                _videoHeight = videoAttr.sourceResolutionY;

                _state = PlayState.Playing;

                _pendingCmd = false;
                logger.Info("DVDPlayer:Started playing()");
                if (_currentFile == string.Empty)
                {
                    for (int i = 0; i <= 26; ++i)
                    {
                        string dvd = String.Format("{0}:", (char)('A' + i));
                        if (MediaPortal.Util.Utils.IsDVD(dvd))
                        {
                            _currentFile = String.Format(@"{0}:\VIDEO_TS\VIDEO_TS.IFO", (char)('A' + i));
                            if (File.Exists(_currentFile))
                            {
                                break;
                            }
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                logger.ErrorException("DVDPlayer:Could not start DVD:{0} {1} {2}", ex);
                CloseDVDInterfaces();
                return(false);
            }
        }