Access DirectShow Filter Property Page? (1 Viewer)

FlipGer

Retired Team Member
  • Premium Supporter
  • April 27, 2004
    2,658
    115
    48
    Leipzig, Germany
    Home Country
    Germany Germany
    Hi,

    a question to DirectShow Gurus. :)

    How do I access the property page of a direct show filter?

    I know I can open it with:

    page PropertyPage;
    (?)
    page.open();

    But the interessting part is the (?). How do I access the page of the filter?

    The only example code I found used the graphbuilder. Is this the only possibilty? Create a graph, add the filter and collect the PropertyPages?

    And how can this easily be done? A short example would be nice. :D

    Flip.
     

    CHli

    Portal Pro
    July 5, 2005
    1,251
    14
    Switzerland
    Home Country
    Switzerland Switzerland
    Are you using DirectShowNet Library ?

    Edit : Anyway here is the included sample.

    You can grab the IPropertyPages from the IBaseFilter no need to have a GraphBuilder.

    Code:
    //Some Interop !
    //A (modified) definition of OleCreatePropertyFrame found here: http://groups.google.no/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/db794e9779144a46/55dbed2bab4cd772?lnk=st&q=[DllImport(%22olepro32.dll%22)]&rnum=1&hl=no#55dbed2bab4cd772
           [DllImport("olepro32.dll")]
           public static extern int OleCreatePropertyFrame(
               IntPtr hwndOwner,
               int x,
               int y,
               [MarshalAs(UnmanagedType.LPWStr)] string lpszCaption,
               int cObjects,
               [MarshalAs(UnmanagedType.Interface, ArraySubType=UnmanagedType.IUnknown)]
               ref object ppUnk,
               int cPages,
               IntPtr lpPageClsID,
               int lcid,
               int dwReserved,
               IntPtr lpvReserved); 
    
    
       /// <summary>
           /// Displays a property page for a filter
           /// </summary>
           /// <param name="dev">The filter for which to display a property page</param>
           private void DisplayPropertyPage(IBaseFilter dev)
           {
               //Get the ISpecifyPropertyPages for the filter
               ISpecifyPropertyPages pProp = dev as ISpecifyPropertyPages;
               int hr = 0;
    
               if (pProp == null)
               {
                   //If the filter doesn't implement ISpecifyPropertyPages, try displaying IAMVfwCompressDialogs instead!
                   IAMVfwCompressDialogs compressDialog = dev as IAMVfwCompressDialogs;
                   if (compressDialog != null)
                   {
    
                       hr = compressDialog.ShowDialog(VfwCompressDialogs.Config, IntPtr.Zero);
                       DsError.ThrowExceptionForHR(hr);
                   }
                   return;
               }
    
               //Get the name of the filter from the FilterInfo struct
               FilterInfo filterInfo;
               hr = dev.QueryFilterInfo(out filterInfo);
               DsError.ThrowExceptionForHR(hr);
    
               // Get the propertypages from the property bag
               DsCAUUID caGUID;
               hr = pProp.GetPages(out caGUID);
               DsError.ThrowExceptionForHR(hr);
    
               //Create and display the OlePropertyFrame
               object oDevice = (object)dev;
               hr = OleCreatePropertyFrame(this.Handle, 0, 0, filterInfo.achName, 1, ref oDevice, caGUID.cElems, caGUID.pElems, 0, 0, IntPtr.Zero);
               DsError.ThrowExceptionForHR(hr);
    
               // Release COM objects
               Marshal.FreeCoTaskMem(caGUID.pElems);
               Marshal.ReleaseComObject(pProp);
               Marshal.ReleaseComObject(filterInfo.pGraph);
           }
     

    FlipGer

    Retired Team Member
  • Premium Supporter
  • April 27, 2004
    2,658
    115
    48
    Leipzig, Germany
    Home Country
    Germany Germany
    Hi,

    thanks for the reply! :)
    Will test it this evening.

    And yes, I am using DirectShowNet (trying)...

    Flip.
     

    CHli

    Portal Pro
    July 5, 2005
    1,251
    14
    Switzerland
    Home Country
    Switzerland Switzerland
    I have some code (by me) building manually a graph using a capture filter, a sample grabber and a null renderer if you are interested. (i'm getting the filter by their name)

    Anyway PM me if you want more informations or if you're stuck.
     

    Users who are viewing this thread

    Top Bottom