Inheritance: IGuideDataEvent
示例#1
0
        public override void BuildGraph()
        {
            try
            {
                useWPF = Settings.UseWPF;

                int hr;

                this.graphBuilder = (IFilterGraph2)new FilterGraph();
                rot = new DsROTEntry(this.graphBuilder);

                this.epg = new EPG(this.hostingControl);

                this.cookies = this.hostingControl.SubscribeEvents(this as VideoControl.IVideoEventHandler, this.graphBuilder as IMediaEventEx);

                // Method names should be self explanatory
                AddNetworkProviderFilter(this.objTuningSpace);
                AddMPEG2DemuxFilter();

                CreateMPEG2DemuxPins();

                //AddAndConnectTransportStreamFiltersToGraph();

                AddAudioDecoderFilters(this.graphBuilder);
                AddBDAVideoDecoderFilters(this.graphBuilder);

                AddAndConnectBDABoardFilters();
                if (this.tuner == null) // && this.capture == null)
                    throw new ApplicationException("No BDA devices found!");

                if (this.H264DecoderDevice != null || !isH264ElecardSpecialMode)
                {
                    //+++ This order is to avoid a bug from the DirectShow
                    AddAndConnectSectionsAndTablesFilterToGraph();

                    IMpeg2Data mpeg2Data = this.bdaSecTab as IMpeg2Data;
                    ISectionList ppSectionList;
                    int hr2 = mpeg2Data.GetTable(0, 0, null, 0, out ppSectionList);

                    AddAndConnectTIFToGraph();
                    //---
                }

                AddRenderers();
                if (!useWPF)
                    ConfigureVMR9InWindowlessMode();
                //RenderMpeg2DemuxFilters();
                ConnectAudioAndVideoFilters();

                this.epg.RegisterEvent(TransportInformationFilter as IConnectionPointContainer);

                Vmr9SetDeinterlaceMode(1);

                IMediaFilter mf = this.graphBuilder as IMediaFilter;
                switch (this.referenceClock)
                {
                    case ChannelDVB.Clock.Default:
                        hr = this.graphBuilder.SetDefaultSyncSource();
                        break;
                    case ChannelDVB.Clock.MPEGDemultiplexer:
                        hr = mf.SetSyncSource(this.mpeg2Demux as IReferenceClock);
                        break;
                    case ChannelDVB.Clock.AudioRenderer:
                        hr = mf.SetSyncSource(this.audioRenderer as IReferenceClock);
                        break;
                }

                this.hostingControl.CurrentGraphBuilder = this;

                OnGraphStarted();
            }
            catch (Exception ex)
            {
                Decompose();
                throw ex;
            }
        }
示例#2
0
文件: MainForm.cs 项目: dgis/CodeTV
        private void epg_GuideDataEvent(object sender, EPG.GuideDataEventArgs fe)
        {
            Trace.WriteLineIf(EPG.trace.TraceInfo, "MainForm.epg_GuideDataEvent(" + fe.Type + ", " + fe.Identifier + ")");
            if (this.currentGraphBuilder is IBDA)
            {
                IGuideData guideData = (this.currentGraphBuilder as IBDA).TransportInformationFilter as IGuideData;
                switch (fe.Type)
                {
                    case EPG.GuideDataEventType.GuideDataAcquired:
                        (this.currentGraphBuilder as IEPG).EPG.UpdateAll(guideData);
                        UpdateEPG();
                        break;
                    case EPG.GuideDataEventType.ServiceChanged:
                        {
                            DateTime now = DateTime.Now;
                            if (fe.Identifier != null || (fe.Identifier == null && (DateTime.Now - this.lastAllServiceEPGUpdate > epgUpdateTimeOut)))
                            {
                                this.lastAllServiceEPGUpdate = now;
                                (this.currentGraphBuilder as IEPG).EPG.UpdateService(fe.Identifier, (this.currentGraphBuilder as IBDA).TuningSpace, guideData);
                                UpdateEPG();
                            }
                        }
                        break;
                    case EPG.GuideDataEventType.ProgramChanged:
                        {
                            DateTime now = DateTime.Now;
                            if (fe.Identifier != null || (fe.Identifier == null && (DateTime.Now - this.lastAllProgramEPGUpdate > epgUpdateTimeOut)))
                            {
                                this.lastAllProgramEPGUpdate = now;
                                (this.currentGraphBuilder as IEPG).EPG.UpdateProgram(fe.Identifier, guideData);
                                UpdateEPG();
                            }
                        }
                        break;
                    case EPG.GuideDataEventType.ScheduleEntryChanged:
                        {
                            DateTime now = DateTime.Now;

                            if (fe.Identifier != null || (fe.Identifier == null && (now - this.lastAllScheduleEPGUpdate > epgUpdateTimeOut)))
                            {
                                this.lastAllScheduleEPGUpdate = now;
                                (this.currentGraphBuilder as IEPG).EPG.UpdateSchedule(fe.Identifier, guideData);
                                UpdateEPG();
                            }
                        }
                        break;
                }
            }
        }