/// <summary> /// Returns the object as an ISpecificPropertyPage /// if the object supports the ISpecificPropertyPage /// interface and has at least one property page. /// </summary> protected bool addIfSupported(object o, string name) { ISpecifyPropertyPages specifyPropertyPages = null; DsCAUUID cauuid = new DsCAUUID(); bool wasAdded = false; // Determine if the object supports the interface // and has at least 1 property page try { specifyPropertyPages = o as ISpecifyPropertyPages; if (specifyPropertyPages != null) { int hr = specifyPropertyPages.GetPages(out cauuid); if ((hr != 0) || (cauuid.cElems <= 0)) { specifyPropertyPages = null; } } } finally { if (cauuid.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(cauuid.pElems); } } // Add the page to the internal collection if (specifyPropertyPages != null) { DirectShowPropertyPage p = new DirectShowPropertyPage(name, specifyPropertyPages); InnerList.Add(p); wasAdded = true; } return(wasAdded); }
/// <summary> /// Show property page of object /// </summary> /// <param name="filter"></param> /// <param name="o"></param> /// <returns></returns> public bool ShowPropertyPage(int filter, Control o) { ISpecifyPropertyPages specifyPropertyPages = null; String propertyPageName = ""; switch(filter) { case 1: if(this.videoRendererFilter != null) { specifyPropertyPages = this.videoRendererFilter as ISpecifyPropertyPages; propertyPageName = "Video Renderer"; } break; case 2: if(this.deInterlaceFilter != null) { specifyPropertyPages = this.deInterlaceFilter as ISpecifyPropertyPages; propertyPageName = "De-Interlacer"; } break; default: break; } DirectShowPropertyPage PropertyPage = new DirectShowPropertyPage(propertyPageName, specifyPropertyPages); if(PropertyPage != null) { PropertyPage.Show(o); PropertyPage.Dispose(); return true; } return false; }
/// <summary> /// Returns the object as an ISpecificPropertyPage /// if the object supports the ISpecificPropertyPage /// interface and has at least one property page. /// </summary> protected bool addIfSupported(object o, string name) { ISpecifyPropertyPages specifyPropertyPages = null; DsCAUUID cauuid = new DsCAUUID(); bool wasAdded = false; // Determine if the object supports the interface // and has at least 1 property page try { specifyPropertyPages = o as ISpecifyPropertyPages; if ( specifyPropertyPages != null ) { int hr = specifyPropertyPages.GetPages( out cauuid ); if ( ( hr != 0 ) || ( cauuid.cElems <= 0 ) ) specifyPropertyPages = null; } } finally { if( cauuid.pElems != IntPtr.Zero ) Marshal.FreeCoTaskMem( cauuid.pElems ); } // Add the page to the internal collection if ( specifyPropertyPages != null ) { DirectShowPropertyPage p = new DirectShowPropertyPage( name, specifyPropertyPages ); InnerList.Add( p ); wasAdded = true; } return( wasAdded ); }