RemoveFromGraph() public static method

public static RemoveFromGraph ( IGraphBuilder graphBuilder ) : void
graphBuilder IGraphBuilder
return void
Example #1
0
        public bool LoadSubtitles(IGraphBuilder graphBuilder, string filename)
        {
            LoadSettings();
            MpcSubtitles.SetDefaultStyle(ref this.defStyle, this.overrideASSStyle);
            if (selectionOff)
            {
                MpcSubtitles.SetShowForcedOnly(false);
            }
            else
            {
                MpcSubtitles.SetShowForcedOnly(!this.autoShow);
            }
            //remove DirectVobSub
            DirectVobSubUtil.RemoveFromGraph(graphBuilder);
            {
                //remove InternalScriptRenderer as it takes subtitle pin
                IBaseFilter isr = null;
                DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.InternalScriptRenderer, out isr);
                if (isr != null)
                {
                    graphBuilder.RemoveFilter(isr);
                    DirectShowUtil.ReleaseComObject(isr);
                }
            }

            FFDShowEngine.DisableFFDShowSubtitles(graphBuilder);

            Size size = new Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height);

            return(MpcSubtitles.LoadSubtitles(
                       DirectShowUtil.GetUnmanagedDevice(GUIGraphicsContext.DX9Device),
                       size, filename, graphBuilder, subPaths));
        }
Example #2
0
        public bool LoadSubtitles(IGraphBuilder graphBuilder, string filename)
        {
            LoadSettings();

            //remove DirectVobSub
            DirectVobSubUtil.RemoveFromGraph(graphBuilder);
            {
                //remove InternalScriptRenderer as it takes subtitle pin
                IBaseFilter isr = null;
                DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.InternalScriptRenderer, out isr);
                if (isr != null)
                {
                    graphBuilder.RemoveFilter(isr);
                    DirectShowUtil.ReleaseComObject(isr);
                }
            }
            // Window size
            //Size size = new Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height);

            /*List<FFDShowAPI.FFDShowInstance> ffdshowInstance = FFDShowAPI.getFFDShowInstances();
             * FFDShowAPI.FFDShowAPI api = new FFDShowAPI();*/


            IBaseFilter baseFilter = null;

            DirectShowUtil.FindFilterByClassID(graphBuilder, FFDShowAPI.FFDShowVideoGuid, out baseFilter);
            if (baseFilter == null)
            {
                DirectShowUtil.FindFilterByClassID(graphBuilder, FFDShowAPI.FFDShowVideoDXVAGuid, out baseFilter);
            }
            if (baseFilter == null)
            {
                DirectShowUtil.FindFilterByClassID(graphBuilder, FFDShowAPI.FFDShowVideoRawGuid, out baseFilter);
            }
            if (baseFilter == null)
            {
                return(false);
            }

            ffdshowAPI = new FFDShowAPI((object)baseFilter);

            IffdshowDec ffdshowDec = baseFilter as IffdshowDec;

            if (ffdshowDec == null)
            {
                Log.Error("FFdshow interfaces not found. Try to update FFDShow");
            }
            else
            {
                Log.Info("FFdshow interfaces found");
            }
            if (selectionOff)
            {
                Enable = false;
            }
            else
            {
                Enable = autoShow;
            }
            return(true);
        }
        public bool LoadSubtitles(IGraphBuilder graphBuilder, string filename)
        {
            LoadSettings();
            MpcSubtitles.SetDefaultStyle(ref this.defStyle, this.overrideASSStyle);
            if (selectionOff)
            {
                MpcSubtitles.SetShowForcedOnly(false);
            }
            else
            {
                MpcSubtitles.SetShowForcedOnly(!this.autoShow);
            }
            //remove DirectVobSub
            DirectVobSubUtil.RemoveFromGraph(graphBuilder);
            {
                //remove InternalScriptRenderer as it takes subtitle pin
                IBaseFilter isr = null;
                DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.InternalScriptRenderer, out isr);
                if (isr != null)
                {
                    graphBuilder.RemoveFilter(isr);
                    DirectShowUtil.ReleaseComObject(isr);
                }
            }

            FFDShowEngine.DisableFFDShowSubtitles(graphBuilder);

            Size size = new Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height);

            // Get Default Language from MP Setting and parse it to MPC-HC Engine (needed for forced track)
            string defaultLanguageCulture = "EN";
            string localizedCINameSub     = "EN";
            int    lcidCI = 0;

            using (Settings xmlreader = new MPSettings())
            {
                try
                {
                    if (g_Player.IsVideo && (g_Player.CurrentFile.ToUpperInvariant().Contains(@"\BDMV\INDEX.BDMV")))
                    {
                        localizedCINameSub = (xmlreader.GetValueAsString("bdplayer", "subtitlelanguage", "English"));
                        foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
                        {
                            if (ci.EnglishName == localizedCINameSub)
                            {
                                lcidCI = ci.TextInfo.LCID;;
                            }
                        }
                        Log.Info("MpcEngine: Subtitle Blu-ray Player CultureInfo {0}", localizedCINameSub);
                    }
                    else
                    {
                        CultureInfo ci = new CultureInfo(xmlreader.GetValueAsString("subtitles", "language", defaultLanguageCulture));
                        lcidCI = ci.TextInfo.LCID;
                        Log.Info("MpcEngine: Subtitle VideoPlayer CultureInfo {0}", ci);
                    }
                }
                catch (Exception ex)
                {
                    CultureInfo ci = new CultureInfo(defaultLanguageCulture);
                    lcidCI = ci.TextInfo.LCID;
                    Log.Error(
                        "MpcEngine: SelectSubtitleLanguage - unable to build CultureInfo, make sure MediaPortal.xml is not corrupted! - {0}",
                        ex);
                }
            }

            return(MpcSubtitles.LoadSubtitles(
                       DirectShowUtil.GetUnmanagedDevice(GUIGraphicsContext.DX9Device),
                       size, filename, graphBuilder, subPaths, lcidCI));
        }
 public bool LoadSubtitles(IGraphBuilder graphBuilder, string filename)
 {
     DirectVobSubUtil.RemoveFromGraph(graphBuilder);
     return(false);
 }