internal void AddChannelToFavorite(Channel[] channels) { ChannelFolder parentChannelFolder; TreeNodeCollection parentTreeNodeCollection; if (GetFavoriteContainer(out parentChannelFolder, out parentTreeNodeCollection)) { foreach (Channel channel in channels) { parentChannelFolder.Add(channel); parentTreeNodeCollection.Add(MakeTreeNodeFromChannel(channel)); } } }
internal TreeNode MakeTreeNodeFromChannel(Channel channel) { TreeNode treeNode = new TreeNode(channel.Name); treeNode.Tag = channel; channel.Tag = treeNode; if (channel is ChannelFolder) { ChannelFolder channelFolder = channel as ChannelFolder; if (channelFolder.Expanded) treeNode.Expand(); else treeNode.Collapse(); } AdjustTVLogo(channel); return treeNode; }
//private Image ResizeImage(Image image, int newWidth, int newHeight, bool highQuality) //{ // System.Drawing.Image result = new Bitmap(newWidth, newHeight); // System.Drawing.Graphics graphic = Graphics.FromImage(result); // // Set the quality options // if (highQuality) // { // graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; // graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; // graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; // graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; // } // // Constraint the sizes // double originalRatio = (double)image.Width / image.Height; // double standardRatio = (double)newWidth / newHeight; // int offsetX = 0, offsetY = 0; // if (originalRatio > standardRatio) // { // newHeight = (int)(image.Height * newWidth / image.Width); // offsetY = (newWidth - newHeight) >> 1; // } // else // { // newWidth = (int)(image.Width * newHeight / image.Height); // offsetX = (newHeight - newWidth) >> 1; // } // // Draw the image with the resized dimensions // graphic.DrawImage(image, offsetX, offsetY, newWidth, newHeight); // return result; //} internal void AdjustTVLogo(Channel channel) { if (channel.Tag != null) { TreeNode treeNode = channel.Tag as TreeNode; if (channel is ChannelFolder) { treeNode.ImageKey = treeNode.SelectedImageKey = "FolderClosed"; return; } else if (channel is ChannelTV) { string logo = (channel as ChannelTV).Logo; if (logo != null && logo.Length > 0) { if (MainForm.imageListLogoTV.Images.ContainsKey(logo)) { treeNode.ImageKey = treeNode.SelectedImageKey = logo; return; } else { try { string path = FileUtils.GetAbsolutePath(logo); if (File.Exists(path)) { Bitmap bitmap = new Bitmap(path); //if (!Bitmap.IsAlphaPixelFormat(bitmap.PixelFormat)) // bitmap.MakeTransparent(Color.White); //Image thumbnail = ResizeImage(bitmap, 16, 16, false); Image thumbnail = Utils.ResizeImage(bitmap, 16, 16, false); MainForm.imageListLogoTV.Images.Add(logo, thumbnail); treeNode.ImageKey = treeNode.SelectedImageKey = logo; thumbnail.Dispose(); bitmap.Dispose(); return; } } catch (ArgumentException) { } } } } treeNode.ImageKey = treeNode.SelectedImageKey = "LogoTVDefault"; } }
public void Add(Channel channel) { channel.Parent = this; this.channelList.Add(channel); }
public void OnChannelChanged(Channel channel, bool graphNeedRebuild) { foreach (IPlugin plugin in this.plugins) { try { plugin.OnChannelChanged(channel, graphNeedRebuild); } catch (Exception ex) { MessageBox.Show(string.Format(Properties.Resources.PluginException, plugin.Name, ex.ToString())); } } }
public override void SubmitTuneRequest(Channel channel) { if (channel is ChannelDVB) { ChannelDVB channelDVB = channel as ChannelDVB; int hr = 0; IMpeg2Demultiplexer mpeg2Demultiplexer = this.mpeg2Demux as IMpeg2Demultiplexer; IPin pinDemuxerTIF; hr = this.mpeg2Demux.FindPin("TIF", out pinDemuxerTIF); if (pinDemuxerTIF != null) { IMPEG2PIDMap mpeg2PIDMap = pinDemuxerTIF as IMPEG2PIDMap; if (mpeg2PIDMap != null) hr = mpeg2PIDMap.MapPID(6, new int[] { 0x00, 0x10, 0x11, 0x12, 0x13, 0x14 }, MediaSampleContent.Mpeg2PSI); Marshal.ReleaseComObject(pinDemuxerTIF); } if (channelDVB.VideoPid != -1) { if (channelDVB.VideoDecoderType == ChannelDVB.VideoType.H264) { IPin pinDemuxerVideoMPEG4; hr = this.mpeg2Demux.FindPin("H264", out pinDemuxerVideoMPEG4); if (pinDemuxerVideoMPEG4 != null) { IMPEG2PIDMap mpeg2PIDMap = pinDemuxerVideoMPEG4 as IMPEG2PIDMap; if (mpeg2PIDMap != null) { if (this.currentH264VideoPid >= 0) hr = mpeg2PIDMap.UnmapPID(1, new int[] { this.currentH264VideoPid }); hr = mpeg2PIDMap.MapPID(1, new int[] { channelDVB.VideoPid }, MediaSampleContent.ElementaryStream); this.currentH264VideoPid = channelDVB.VideoPid; } Marshal.ReleaseComObject(pinDemuxerVideoMPEG4); } //IVMRMixerControl9 vmrMixerControl9 = this.videoRenderer as IVMRMixerControl9; //vmrMixerControl9.SetZOrder(0, 1); } else { IPin pinDemuxerVideoMPEG2; hr = this.mpeg2Demux.FindPin("MPG2", out pinDemuxerVideoMPEG2); if (pinDemuxerVideoMPEG2 != null) { IMPEG2PIDMap mpeg2PIDMap = pinDemuxerVideoMPEG2 as IMPEG2PIDMap; if (mpeg2PIDMap != null) { //IEnumPIDMap enumPIDMap; //hr = mpeg2PIDMap.EnumPIDMap(out enumPIDMap); //PIDMap[] pidMap = new PIDMap[1]; //int numReceive = 0; //ArrayList al = new ArrayList(); //while (enumPIDMap.Next(1, pidMap, out numReceive) >= 0) //{ // al.Add(pidMap[0].ulPID); //} if (this.currentMpeg2VideoPid >= 0) hr = mpeg2PIDMap.UnmapPID(1, new int[] { this.currentMpeg2VideoPid }); hr = mpeg2PIDMap.MapPID(1, new int[] { channelDVB.VideoPid }, MediaSampleContent.ElementaryStream); this.currentMpeg2VideoPid = channelDVB.VideoPid; } Marshal.ReleaseComObject(pinDemuxerVideoMPEG2); } } } if (channelDVB.AudioPid != -1) { IPin pinDemuxerAudio; hr = this.mpeg2Demux.FindPin("Audio", out pinDemuxerAudio); if (pinDemuxerAudio != null) { IMPEG2PIDMap mpeg2PIDMap = pinDemuxerAudio as IMPEG2PIDMap; if (mpeg2PIDMap != null) { if (this.currentAudioPid >= 0) hr = mpeg2PIDMap.UnmapPID(1, new int[] { this.currentAudioPid }); hr = mpeg2PIDMap.MapPID(1, new int[] { channelDVB.AudioPid }, MediaSampleContent.ElementaryStream); this.currentAudioPid = channelDVB.AudioPid; } Marshal.ReleaseComObject(pinDemuxerAudio); } } IPin pinDemuxerSectionsAndTables; hr = this.mpeg2Demux.FindPin("PSI", out pinDemuxerSectionsAndTables); if (pinDemuxerSectionsAndTables != null) { IMPEG2PIDMap mpeg2PIDMap = pinDemuxerSectionsAndTables as IMPEG2PIDMap; if (mpeg2PIDMap != null) hr = mpeg2PIDMap.MapPID(2, new int[] { (int)PIDS.PAT, (int)PIDS.SDT }, MediaSampleContent.Mpeg2PSI); Marshal.ReleaseComObject(pinDemuxerSectionsAndTables); } ITuner tuner = NetworkProvider as ITuner; hr = tuner.get_TuningSpace(out this.objTuningSpace); this.objTuningSpace.CreateTuneRequest(out this.objTuneRequest); IDVBTuneRequest dvbTuneRequest = (IDVBTuneRequest)this.objTuneRequest; dvbTuneRequest.put_ONID(channelDVB.ONID); dvbTuneRequest.put_TSID(channelDVB.TSID); dvbTuneRequest.put_SID(channelDVB.SID); ILocator locator = null; if (channel is ChannelDVBT) { ChannelDVBT channelDVBT = channel as ChannelDVBT; IDVBTLocator dvbLocator = (IDVBTLocator)new DVBTLocator(); dvbLocator.put_Bandwidth(channelDVBT.Bandwidth); dvbLocator.put_Guard(channelDVBT.Guard); dvbLocator.put_HAlpha(channelDVBT.HAlpha); dvbLocator.put_LPInnerFEC(channelDVBT.LPInnerFEC); dvbLocator.put_LPInnerFECRate(channelDVBT.LPInnerFECRate); dvbLocator.put_Mode(channelDVBT.Mode); dvbLocator.put_OtherFrequencyInUse(channelDVBT.OtherFrequencyInUse); locator = dvbLocator as ILocator; } else if (channel is ChannelDVBC) { ChannelDVBC channelDVBC = channel as ChannelDVBC; IDVBCLocator dvbLocator = (IDVBCLocator)new DVBCLocator(); locator = dvbLocator as ILocator; } else if (channel is ChannelDVBS) { ChannelDVBS channelDVBS = channel as ChannelDVBS; IDVBSLocator dvbLocator = (IDVBSLocator)new DVBSLocator(); dvbLocator.put_CarrierFrequency((int)channelDVBS.Frequency); dvbLocator.put_Azimuth(channelDVBS.Azimuth); dvbLocator.put_Elevation(channelDVBS.Elevation); dvbLocator.put_OrbitalPosition(channelDVBS.OrbitalPosition); dvbLocator.put_SignalPolarisation(channelDVBS.SignalPolarisation); dvbLocator.put_WestPosition(channelDVBS.WestPosition); locator = dvbLocator as ILocator; } locator.put_CarrierFrequency((int)channelDVB.Frequency); locator.put_InnerFEC(channelDVB.InnerFEC); locator.put_InnerFECRate(channelDVB.InnerFECRate); locator.put_Modulation(channelDVB.Modulation); locator.put_OuterFEC(channelDVB.OuterFEC); locator.put_OuterFECRate(channelDVB.OuterFECRate); locator.put_SymbolRate(channelDVB.SymbolRate); dvbTuneRequest.put_Locator(locator); hr = (this.networkProvider as ITuner).put_TuneRequest(this.objTuneRequest); DsError.ThrowExceptionForHR(hr); } if(useWPF) WpfUpdateVideoSize(); //WPF }
public string GetTablesInfos(Channel channel, bool allTransponderInfo) { string result = ""; if (channel != null && channel is ChannelDVB) { ChannelDVB channelDVB = channel as ChannelDVB; IMpeg2Data mpeg2Data = this.bdaSecTab as IMpeg2Data; // Hervé Stalin : Utile ? //Hashtable serviceNameByServiceId = new Hashtable(); PSISection[] psiSdts = PSISection.GetPSITable((int)PIDS.SDT, (int)TABLE_IDS.SDT_ACTUAL, mpeg2Data); for (int i = 0; i < psiSdts.Length; i++) { PSISection psiSdt = psiSdts[i]; if (psiSdt != null && psiSdt is PSISDT) { PSISDT sdt = (PSISDT)psiSdt; if (allTransponderInfo) { result += "PSI Table " + i + "/" + psiSdts.Length + "\r\n"; result += sdt.ToString(); } // Hervé Stalin : Utile ? //foreach (PSISDT.Data service in sdt.Services) //{ // serviceNameByServiceId[service.ServiceId] = service.GetServiceName(); //} } } //Hervé Stalin : Code pode pour créér un hashtable de lcn //Hashtable logicalChannelNumberByServiceId = new Hashtable(); PSISection[] psiNits = PSISection.GetPSITable((int)PIDS.NIT, (int)TABLE_IDS.NIT_ACTUAL, mpeg2Data); for (int i = 0; i < psiNits.Length; i++) { PSISection psinit = psiNits[i]; if (psinit != null && psinit is PSINIT) { PSINIT nit = (PSINIT)psinit; result += "PSI Table " + i + "/" + psiNits.Length + "\r\n"; result += nit.ToString(); //foreach (PSINIT.Data data in nit.Streams) //{ // foreach (PSIDescriptor psiDescriptorData in data.Descriptors) // { // if (psiDescriptorData.DescriptorTag == DESCRIPTOR_TAGS.DESCR_LOGICAL_CHANNEL) // { // PSIDescriptorLogicalChannel psiDescriptorLogicalChannel = (PSIDescriptorLogicalChannel)psiDescriptorData; // foreach (PSIDescriptorLogicalChannel.ChannelNumber f in psiDescriptorLogicalChannel.LogicalChannelNumbers) // { // logicalChannelNumberByServiceId[f.ServiceID] = f.LogicalChannelNumber; // } // } // } //} } } PSISection[] psiPats = PSISection.GetPSITable((int)PIDS.PAT, (int)TABLE_IDS.PAT, mpeg2Data); for (int i = 0; i < psiPats.Length; i++) { PSISection psiPat = psiPats[i]; if (psiPat != null && psiPat is PSIPAT) { PSIPAT pat = (PSIPAT)psiPat; if (allTransponderInfo) { result += "PSI Table " + i + "/" + psiPats.Length + "\r\n"; result += pat.ToString(); } foreach (PSIPAT.Data program in pat.ProgramIds) { if (allTransponderInfo || program.ProgramNumber == channelDVB.SID) { if (!program.IsNetworkPID) { PSISection[] psiPmts = PSISection.GetPSITable(program.Pid, (int)TABLE_IDS.PMT, mpeg2Data); for (int i2 = 0; i2 < psiPmts.Length; i2++) { PSISection psiPmt = psiPmts[i2]; if (psiPmt != null && psiPmt is PSIPMT) { PSIPMT pmt = (PSIPMT)psiPmt; result += "PSI Table " + i2 + "/" + psiPmts.Length + "\r\n"; result += pmt.ToString(); } if (!allTransponderInfo) return result; } } } } } } } return result; }
internal bool TuneChannel(Channel channel, bool needRebuild) { this.Cursor = Cursors.WaitCursor; try { if ((this.currentGraphBuilder = TuneChannel(channel, needRebuild, this.currentGraphBuilder, this.videoControl)) != null) { if (needRebuild) OnGraphInit(); OnChannelChange(); return true; } } finally { this.Cursor = Cursors.Default; } return false; }
public virtual void SubmitTuneRequest(Channel channel) { }
public override void SubmitTuneRequest(Channel channel) { //StopGraph(); //ConnectStreamBufferSinkToSource(); //IStreamBufferMediaSeeking mediaSeeking = this.streamBufferSource as IStreamBufferMediaSeeking; //if (mediaSeeking != null) //{ // long currentposition = (long)(position.TotalMilliseconds * 10000.0); // mediaSeeking.SetPositions(new DsLong(currentposition), AMSeekingSeekingFlags.AbsolutePositioning, // null, AMSeekingSeekingFlags.NoPositioning); //} TimeSpan start, stop; (this as ITimeShifting).GetPositions(out start, out stop); (this as ITimeShifting).SetPosition(stop); base.SubmitTuneRequest(channel); IsPossibleTimeShiftingResume = ((this as ITimeShifting).Status == TimeShiftingStatus.Paused); IsPossibleTimeShiftingPause = !IsPossibleTimeShiftingResume; IsPossibleRecorderStart = ((this as IRecorder).Status == RecorderStatus.Stopped); IsPossibleRecorderStop = !IsPossibleRecorderStart; }
public GraphBuilderTV TuneChannel(Channel channel, bool needRebuild, GraphBuilderBase currentGraph, VideoControl hostingControl) { if (needRebuild && currentGraph != null) { ClearGraph(); //OnGraphStop(); //currentGraph.Dispose(); //currentGraph = null; } GraphBuilderTV currentGraphTV = currentGraph as GraphBuilderTV; if (channel is ChannelDVB) { ChannelDVB channelDVB = channel as ChannelDVB; if (needRebuild) { GraphBuilderBDA newGraph = null; switch(this.graphBuilderType) { case GraphBuilderType.BDA: newGraph = new GraphBuilderBDA(hostingControl); break; case GraphBuilderType.BDATimeShifting: newGraph = new GraphBuilderBDATimeShifting(hostingControl); break; case GraphBuilderType.BDAMosaic: newGraph = new GraphBuilderBDAMosaic(hostingControl); break; } newGraph.GraphStarted += new EventHandler(newGraph_GraphStarted); newGraph.GraphEnded += new EventHandler(newGraph_GraphEnded); newGraph.PossibleChanged += new EventHandler<GraphBuilderBase.PossibleEventArgs>(newGraph_PossibleChanged); newGraph.Settings = Settings; currentGraphTV = newGraph; newGraph.ReferenceClock = channelDVB.ReferenceClock; newGraph.AudioDecoderType = channelDVB.AudioDecoderType; DsDevice device; if (!string.IsNullOrEmpty(channelDVB.AudioDecoderDevice)) { if (GraphBuilderBDA.AudioDecoderDevices.TryGetValue(channelDVB.AudioDecoderDevice, out device)) newGraph.AudioDecoderDevice = device; else throw new Exception(string.Format(Properties.Resources.AudioDeviceNotFound, channelDVB.AudioDecoderDevice)); } if (channelDVB.VideoDecoderType == ChannelDVB.VideoType.MPEG2) { if (!string.IsNullOrEmpty(channelDVB.MPEG2DecoderDevice)) { if (GraphBuilderBDA.MPEG2DecoderDevices.TryGetValue(channelDVB.MPEG2DecoderDevice, out device)) newGraph.Mpeg2DecoderDevice = device; else throw new Exception(string.Format(Properties.Resources.MPEG2DecoderDeviceNotFound, channelDVB.MPEG2DecoderDevice)); } } else { if (!string.IsNullOrEmpty(channelDVB.H264DecoderDevice)) { if (GraphBuilderBDA.H264DecoderDevices.TryGetValue(channelDVB.H264DecoderDevice, out device)) newGraph.H264DecoderDevice = device; else throw new Exception(string.Format(Properties.Resources.H264DecoderDeviceNotFound, channelDVB.H264DecoderDevice)); } } if (!string.IsNullOrEmpty(channelDVB.AudioRendererDevice)) { if (GraphBuilderBDA.AudioRendererDevices.TryGetValue(channelDVB.AudioRendererDevice, out device)) newGraph.AudioRendererDevice = device; else throw new Exception(string.Format(Properties.Resources.AudioRendererDeviceNotFound, channelDVB.AudioRendererDevice)); } if (!string.IsNullOrEmpty(channelDVB.TunerDevice)) { if (GraphBuilderBDA.TunerDevices.TryGetValue(channelDVB.TunerDevice, out device)) newGraph.TunerDevice = device; else throw new Exception(string.Format(Properties.Resources.TunerDeviceNotFound, channelDVB.TunerDevice)); } if (!string.IsNullOrEmpty(channelDVB.CaptureDevice)) { if (GraphBuilderBDA.CaptureDevices.TryGetValue(channelDVB.CaptureDevice, out device)) newGraph.CaptureDevice = device; else throw new Exception(string.Format(Properties.Resources.CaptureDeviceNotFound, channelDVB.CaptureDevice)); } IDVBTuningSpace tuningSpace = (IDVBTuningSpace)new DVBTuningSpace(); if (channel is ChannelDVBT) { tuningSpace.put_UniqueName("DVBT TuningSpace"); tuningSpace.put_FriendlyName("DVBT TuningSpace"); tuningSpace.put_NetworkType(CLSID.DVBTNetworkProvider); tuningSpace.put_SystemType(DVBSystemType.Terrestrial); } else if (channel is ChannelDVBC) { tuningSpace.put_UniqueName("DVBC TuningSpace"); tuningSpace.put_FriendlyName("DVBC TuningSpace"); tuningSpace.put_NetworkType(CLSID.DVBCNetworkProvider); tuningSpace.put_SystemType(DVBSystemType.Cable); } else if (channel is ChannelDVBS) { tuningSpace.put_UniqueName("DVBS TuningSpace"); tuningSpace.put_FriendlyName("DVBS TuningSpace"); tuningSpace.put_NetworkType(CLSID.DVBSNetworkProvider); tuningSpace.put_SystemType(DVBSystemType.Satellite); } newGraph.TuningSpace = tuningSpace as ITuningSpace; newGraph.BuildGraph(); } currentGraphTV.SubmitTuneRequest(channel); currentGraphTV.VideoZoomMode = channelDVB.VideoZoomMode; currentGraphTV.VideoKeepAspectRatio = channelDVB.VideoKeepAspectRatio; currentGraphTV.VideoOffset = channelDVB.VideoOffset; currentGraphTV.VideoZoom = channelDVB.VideoZoom; currentGraphTV.VideoAspectRatioFactor = channelDVB.VideoAspectRatioFactor; currentGraphTV.RunGraph(); //currentGraph.VideoResizer(); currentGraphTV.CurrentChannel = channel; } else if (channel is ChannelAnalogic) { ChannelAnalogic channelAnalogic = channel as ChannelAnalogic; if (needRebuild) { GraphBuilderWDM newGraph = new GraphBuilderWDM(hostingControl); newGraph.GraphStarted += new EventHandler(newGraph_GraphStarted); newGraph.GraphEnded += new EventHandler(newGraph_GraphEnded); newGraph.PossibleChanged += new EventHandler<GraphBuilderBase.PossibleEventArgs>(newGraph_PossibleChanged); newGraph.Settings = Settings; currentGraphTV = newGraph; DsDevice device; if (GraphBuilderWDM.AudioRendererDevices.TryGetValue(channelAnalogic.AudioRendererDevice, out device)) newGraph.AudioRendererDevice = device; if (GraphBuilderWDM.VideoInputDevices.TryGetValue(channelAnalogic.VideoCaptureDeviceName, out device)) newGraph.VideoCaptureDevice = device; if (GraphBuilderWDM.AudioInputDevices.TryGetValue(channelAnalogic.AudioCaptureDeviceName, out device)) newGraph.AudioCaptureDevice = device; newGraph.FormatOfCapture = channelAnalogic.FormatOfCapture; newGraph.BuildGraph(); } bool goodTuning = true; try { currentGraphTV.SubmitTuneRequest(channel); } catch (COMException) { goodTuning = false; } if (goodTuning) { currentGraphTV.VideoZoomMode = channelAnalogic.VideoZoomMode; currentGraphTV.VideoKeepAspectRatio = channelAnalogic.VideoKeepAspectRatio; currentGraphTV.VideoOffset = channelAnalogic.VideoOffset; currentGraphTV.VideoZoom = channelAnalogic.VideoZoom; currentGraphTV.VideoAspectRatioFactor = channelAnalogic.VideoAspectRatioFactor; currentGraphTV.RunGraph(); //currentGraph.VideoResizer(); currentGraphTV.CurrentChannel = channel; } else currentGraphTV.CurrentChannel = null; } return currentGraphTV; }
private void TuneMosaicChannel(Channel channel) { //if (channel is ChannelDVBT) //{ // ChannelDVBT channelDVBT = channel as ChannelDVBT; // ClearGraph(); // this.currentGraphBuilder = new GraphBuilderBDA2(this.videoControl); // DsDevice device; // if (this.bdaTunerDevices.TryGetValue(channelDVBT.TunerDevice, out device)) // this.currentGraphBuilder.TunerDevice = device; // if (this.bdaTunerDevices.TryGetValue(channelDVBT.CaptureDevice, out device)) // this.currentGraphBuilder.CaptureDevice = device; // IDVBTuningSpace tuningSpace = (IDVBTuningSpace)new DVBTuningSpace(); // tuningSpace.put_UniqueName("DVBT TuningSpace"); // tuningSpace.put_FriendlyName("DVBT TuningSpace"); // tuningSpace.put_NetworkType(CLSID.DVBTNetworkProvider); // tuningSpace.put_SystemType(DVBSystemType.Terrestrial); // this.objTuningSpace = tuningSpace as ITuningSpace; // this.objTuningSpace.CreateTuneRequest(out objTuneRequest); // IDVBTuneRequest dvbTuneRequest = (IDVBTuneRequest)objTuneRequest; // IDVBTLocator dvbtLocator = (IDVBTLocator)new DVBTLocator(); // dvbtLocator.put_CarrierFrequency((int)channelDVBT.Frequency); // dvbTuneRequest.put_Locator(dvbtLocator as ILocator); // dvbTuneRequest.put_ONID(channelDVBT.ONID); // dvbTuneRequest.put_TSID(channelDVBT.TSID); // dvbTuneRequest.put_SID(channelDVBT.SID); // this.currentGraphBuilder.BuildGraphWithNoRenderer(this.objTuningSpace); // this.epg.RegisterEvent(this.currentGraphBuilder.TransportInformationFilter as IConnectionPointContainer); // this.currentGraphBuilder.SubmitTuneRequest(this.objTuneRequest); // this.currentGraphBuilder.RunGraph(); // IMpeg2Data mpeg2Data = this.currentGraphBuilder.SectionsAndTables as IMpeg2Data; // PSISection[] psis = PSISection.GetPSITable((int)PIDS.PAT, (int)TABLE_IDS.PAT, mpeg2Data); // for (int i = 0; i < psis.Length; i++ ) // { // ArrayList pmts = new ArrayList(); // PSISection psi = psis[i]; // if (psi != null && psi is PSIPAT) // { // PSIPAT pat = (PSIPAT)psi; // Trace.WriteLineIf(trace.TraceVerbose, "PSI Table " + i + "/" + psis.Length + "\r\n"); // Trace.WriteLineIf(trace.TraceVerbose, pat.ToString()); // foreach (PSIPAT.Data program in pat.ProgramIds) // { // if (!program.IsNetworkPID) // { // PSISection[] psis2 = PSISection.GetPSITable(program.Pid, (int)TABLE_IDS.PMT, mpeg2Data); // for (int i2 = 0; i2 < psis2.Length; i2++) // { // PSISection psi2 = psis2[i2]; // if (psi2 != null && psi2 is PSIPMT) // { // PSIPMT pmt = (PSIPMT)psi2; // Trace.WriteLineIf(trace.TraceVerbose, "PSI Table " + i2 + "/" + psis2.Length + "\r\n"); // Trace.WriteLineIf(trace.TraceVerbose, pmt.ToString()); // PSIPMT.Data videoStream = pmt.GetStreamByType(STREAM_TYPES.STREAMTYPE_13818_VIDEO); // if (videoStream != null) // { // if (channelDVBT.SID == pmt.TransportStreamId) // pmts.Insert(0, pmt); // else // pmts.Add(pmt); // } // } // } // } // //if (pmts.Count == 2) break; // } // } // this.currentGraphBuilder.StopGraph(); // this.currentGraphBuilder.AddMosaicFilters(this.objTuningSpace, pmts); // this.currentGraphBuilder.RunGraph(); // } // this.currentChannel = channel; // this.currentModeIsMosaic = true; //} }
internal bool TuneChannelGUI(Channel channel, bool forceRebuild) { this.videoControl.BackColor = Color.Transparent; try { try { if (channel.Tag is TreeNode) panelChannel.treeViewChannel.SelectedNode = channel.Tag as TreeNode; } catch { } //if (this.currentGraphBuilder != null && !(this.currentGraphBuilder is GraphBuilderTV)) //{ // OnGraphStop(); // this.currentGraphBuilder.Dispose(); // this.currentGraphBuilder = null; //} bool needRebuild = forceRebuild || !(this.currentGraphBuilder is GraphBuilderTV) || (this.currentGraphBuilder as GraphBuilderTV).NeedToRebuildTheGraph(channel); TuneChannel(channel, needRebuild); videoControl.Focus(); return true; } catch (Exception ex) { ClearGraph(); Trace.WriteLineIf(trace.TraceError, ex.ToString()); toolStripStatusLabelVideoStatus.Text = Properties.Resources.Error + " " + ex.Message; toolStripStatusLabelChannelName.Text = Properties.Resources.NoChannel; this.videoControl.BackColor = Settings.VideoBackgroundColor; } return false; }
internal bool TuneChannelGUI(Channel channel) { return TuneChannelGUI(channel, false); }
public virtual bool NeedToRebuildTheGraph(Channel newChannel) { if (!(newChannel is ChannelTV) || !(this.currentChannel is ChannelTV)) return true; ChannelTV channelNew = newChannel as ChannelTV; ChannelTV channelCurrent = this.currentChannel as ChannelTV; return channelCurrent.NeedToRebuildTheGraph(channelNew); }
internal void AddChannelToFavorite(ChannelFolder channelFolder, Channel[] channels) { TreeNode parentTreeNode = channelFolder.Tag as TreeNode; TreeNodeCollection parentTreeNodeCollection = (parentTreeNode == null ? this.treeViewChannel.Nodes : parentTreeNode.Nodes); foreach (Channel channel in channels) { channelFolder.Add(channel); parentTreeNodeCollection.Add(MakeTreeNodeFromChannel(channel)); } }
public override void SubmitTuneRequest(Channel channel) { if (channel is ChannelAnalogic) { ChannelAnalogic channelAnalogic = channel as ChannelAnalogic; int hr = 0; //SetCaptureResolution(this.captureFormat); // channelAnalogic.CaptureResolution); if (this.videoCaptureFilter != null) { IAMAnalogVideoDecoder analogVideoDecoder = this.videoCaptureFilter as IAMAnalogVideoDecoder; if (analogVideoDecoder != null) { AnalogVideoStandard videoStandard; hr = analogVideoDecoder.get_TVFormat(out videoStandard); if (videoStandard != channelAnalogic.VideoStandard) hr = analogVideoDecoder.put_TVFormat(channelAnalogic.VideoStandard); } } if (this.tuner != null) { int tuningSpace = 0; hr = this.tuner.get_TuningSpace(out tuningSpace); if (hr < 0 || channelAnalogic.TuningSpace != tuningSpace) this.tuner.put_TuningSpace(channelAnalogic.TuningSpace); int countryCode = 0; hr = this.tuner.get_CountryCode(out countryCode); if (hr < 0 || channelAnalogic.CountryCode != countryCode) this.tuner.put_CountryCode(channelAnalogic.CountryCode); int connectInput = 0; hr = this.tuner.get_ConnectInput(out connectInput); if (hr < 0 || channelAnalogic.ConnectInput != connectInput) this.tuner.put_ConnectInput(channelAnalogic.ConnectInput); TunerInputType inputType = TunerInputType.Antenna; hr = this.tuner.get_InputType(channelAnalogic.ConnectInput, out inputType); if (hr < 0 || channelAnalogic.InputType != inputType) this.tuner.put_InputType(channelAnalogic.ConnectInput, channelAnalogic.InputType); AMTunerModeType mode = AMTunerModeType.Default; hr = this.tuner.get_Mode(out mode); if (hr < 0 || channelAnalogic.Mode != mode) this.tuner.put_Mode(channelAnalogic.Mode); if (channelAnalogic.Channel > 0) { hr = this.tuner.put_Channel(channelAnalogic.Channel, AMTunerSubChannel.Default, AMTunerSubChannel.Default); DsError.ThrowExceptionForHR(hr); } //int plChannel; //AMTunerSubChannel plVideoSubChannel; //AMTunerSubChannel plAudioSubChannel; //hr = this.tuner.get_Channel(out plChannel, out plVideoSubChannel, out plAudioSubChannel); //if (plChannel != channelAnalogic.Channel) //{ // DsError.ThrowExceptionForHR(-2147024809); //} } if (this.amTVAudio != null && channelAnalogic.AudioMode != TVAudioMode.None) { TVAudioMode audioMode = TVAudioMode.Stereo; hr = this.amTVAudio.get_TVAudioMode(out audioMode); if (hr < 0 || channelAnalogic.AudioMode != audioMode) this.amTVAudio.put_TVAudioMode(channelAnalogic.AudioMode); } if (WDMCrossbar != null) { try { if (channelAnalogic.AudioSource != WDMCrossbar.GetAudioInput()) WDMCrossbar.SetAudioInput(channelAnalogic.AudioSource, false); } catch { } try { if (channelAnalogic.VideoSource != WDMCrossbar.GetVideoInput()) WDMCrossbar.SetVideoInput(channelAnalogic.VideoSource, false); } catch { } } RunGraph(); } if (useWPF) WpfUpdateVideoSize(); }