示例#1
0
        protected override void OnGraphRunning()
        {
            base.OnGraphRunning();
            VideoSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>();

            int hr = _dvdCtrl.SelectVideoModePreference(_videoPref);

            if (hr != 0)
            {
                ServiceRegistration.Get <ILogger>().Error("DVDPlayer: Unable to set DVD video mode preference 0x{0:X}", hr);
            }

            hr = _dvdInfo.GetCurrentVideoAttributes(out _videoAttr);
            if (hr != 0)
            {
                ServiceRegistration.Get <ILogger>().Error("DVDPlayer: Unable to get DVD video attributes 0x{0:X}", hr);
            }

            DvdDiscSide side;
            int         titles, numOfVolumes, volume;

            hr = _dvdInfo.GetDVDVolumeInfo(out numOfVolumes, out volume, out side, out titles);
            if (hr < 0)
            {
                ServiceRegistration.Get <ILogger>().Error("DVDPlayer: Unable to get DVD volume info 0x{0:X}", hr);
            }

            if (titles <= 0)
            {
                ServiceRegistration.Get <ILogger>().Error("DVDPlayer: DVD does not contain any titles? (# titles = {0})", titles);
            }

            _pendingCmd = false;

            _dvdCtrl.SetSubpictureState(settings.EnableSubtitles, DvdCmdFlags.None, out _cmdOption);

            _line21Decoder = FilterGraphTools.FindFilterByInterface <IAMLine21Decoder>(_graphBuilder);
            if (_line21Decoder != null)
            {
                AMLine21CCState state = settings.EnableClosedCaption ? AMLine21CCState.On : AMLine21CCState.Off;
                if (_line21Decoder.SetServiceState(state) == 0)
                {
                    ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: {0} Closed Captions", settings.EnableClosedCaption ? "Enabled" : "Disabled");
                }
                else
                {
                    ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: Failed to set Closed Captions state.");
                }
            }
        }
示例#2
0
        void TestVideoModePref()
        {
            int     hr;
            IDvdCmd ppCmd;

            AllowPlay();
            hr = m_idc2.PlayChapterInTitle(1, 2, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(500);

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

            hr = m_idc2.SelectVideoModePreference(DvdPreferredDisplayMode.DisplayContentDefault);
            DsError.ThrowExceptionForHR(hr);
        }
示例#3
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);
            }
        }