Changeset 231 for trunk/DirectShowSpy


Ignore:
Timestamp:
Jan 9, 2014, 2:51:09 PM (10 years ago)
Author:
roman
Message:

Added IFilterGraphHelper::DoPropertyFrameModal? UI for filter graph review, also available from graph list Properties button

Location:
trunk/DirectShowSpy
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/DirectShowSpy/Configuration.cpp

    r196 r231  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2013
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    44
  • trunk/DirectShowSpy/DirectShowSpy.cpp

    r196 r231  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2011
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    44
     
    99
    1010#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
    11 #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
     11        #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
    1212#endif
    1313
     
    1919    return _AtlModule.DllCanUnloadNow();
    2020}
    21 
    2221STDAPI DllGetClassObject(REFCLSID ClassIdentifier, REFIID InterfaceIdentifier, LPVOID* ppvObject) throw()
    2322{
    2423    return _AtlModule.DllGetClassObject(ClassIdentifier, InterfaceIdentifier, ppvObject);
    2524}
    26 
    2725STDAPI DllRegisterServer() throw()
    2826{
     
    3937        return nResult;
    4038}
    41 
    4239STDAPI DllUnregisterServer() throw()
    4340{
     
    5451        return nResult;
    5552}
    56 
    5753STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCommandLine) throw()
    5854{
  • trunk/DirectShowSpy/DirectShowSpy.idl

    r199 r231  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2013
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    44
     
    5656        [id(DISPID_VALUE), propput] HRESULT FilterGraph([in] IUnknown* pFilterGraphUnknown);
    5757        [id(1), propget] HRESULT Text([out, retval] BSTR* psText);
     58        [id(2)] HRESULT DoPropertyFrameModal([in] LONG nParentWindowHandle);
    5859};
    5960[
  • trunk/DirectShowSpy/DirectShowSpy.rc

    r207 r231  
    1 // Microsoft Visual C++ generated resource script.
     1// Microsoft Visual C++ generated resource script.
    22//
    33#include "resource.h"
     
    2323#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
    2424LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
    25 #pragma code_page(1252)
    2625
    2726#ifdef APSTUDIO_INVOKED
     
    33321 TEXTINCLUDE
    3433BEGIN
    35     "resource.h\r\n"
     34    "resource.h\0"
    3635END
    3736
     
    4342    "#include ""winres.h""\r\n"
    4443    "#include ""atlres.h""\r\n"
    45     "#include ""rores.rc""\r\n"
     44    "#include ""rores.rc""\r\0"
    4645END
    4746
    48473 TEXTINCLUDE
    4948BEGIN
    50     "1 TYPELIB ""DirectShowSpy.tlb""\r\n"
     49    "1 TYPELIB ""DirectShowSpy.tlb""\r\0"
    5150END
    5251
     
    6059
    6160VS_VERSION_INFO VERSIONINFO
    62  FILEVERSION  1, 0, 0, 988
     61 FILEVERSION  1, 0, 0, 1065
    6362 PRODUCTVERSION 1,0,0,1
    6463 FILEFLAGSMASK 0x3fL
     
    7978            VALUE "CompanyName", "Roman Ryltsov"
    8079            VALUE "FileDescription", "Alax.Info DirectShow Spy Module"
    81             VALUE "FileVersion",  "1, 0, 0, 988\0"
     80            VALUE "FileVersion",  "1, 0, 0, 1065\0"
    8281            VALUE "InternalName", "DirectShowSpy.dll"
    83             VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2013"
     82            VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2014"
    8483            VALUE "OLESelfRegister", "Yes"
    8584            VALUE "OriginalFilename", "DirectShowSpy.dll"
     
    142141    LTEXT           "Email:",IDC_ABOUT_EMAILTITLE,60,72,20,8
    143142    LTEXT           "<A HREF=""mailto:support@alax.info"">support@alax.info</A>",IDC_ABOUT_EMAIL,108,72,162,8,NOT WS_GROUP | WS_TABSTOP
    144     LTEXT           "Copyright © Alax.Info, Roman Ryltsov, 2008-2013",IDC_ABOUT_COPYRIGHT,60,84,210,8,SS_NOPREFIX
     143    LTEXT           "Copyright © Alax.Info, Roman Ryltsov, 2008-2014",IDC_ABOUT_COPYRIGHT,60,84,210,8,SS_NOPREFIX
    145144    DEFPUSHBUTTON   "OK",1,220,102,50,14
    146145    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,122,267,1
     
    242241    PUSHBUTTON      "C&heck",IDC_FILTERGRAPHLIST_LIST_CHECK,60,180,50,14
    243242    PUSHBUTTON      "&Copy",IDC_FILTERGRAPHLIST_LIST_COPYTOCLIPBOARD,114,180,50,14
     243    PUSHBUTTON      "&Properties...",IDC_FILTERGRAPHLIST_LIST_PROPERTIES,168,180,50,14
     244END
     245
     246IDD_FILTERGRAPHHELPER_PROPERTYFRAME DIALOGEX 0, 0, 423, 255
     247STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
     248CAPTION "DirectShow Filter Graph Properties"
     249FONT 8, "MS Shell Dlg", 400, 0, 0x1
     250BEGIN
     251    CONTROL         "",IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TREE,
     252                    "SysTreeView32",TVS_HASLINES | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,6,156,222
     253    EDITTEXT        IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TEXT,168,6,246,222,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
     254    DEFPUSHBUTTON   "OK",IDOK,246,234,50,14
     255    PUSHBUTTON      "Cancel",IDCANCEL,300,234,50,14
     256    PUSHBUTTON      "Apply",IDC_FILTERGRAPHHELPER_PROPERTYFRAME_APPLY,354,234,50,14
    244257END
    245258
     
    279292        TOPMARGIN, 6
    280293        BOTTOMMARGIN, 193
     294    END
     295
     296    IDD_FILTERGRAPHHELPER_PROPERTYFRAME, DIALOG
     297    BEGIN
    281298    END
    282299END
     
    302319    IDR_SYSTEMDEVICEENUMERATORSPY
    303320                            "\n\nAlax.Info DirectShow System Device Enumerator Spy\n"
    304         IDR_FILTERGRAPHHELPER   "AlaxInfo.DirectShowSpy.FilterGraphHelper\nAlaxInfo.DirectShowSpy.FilterGraphHelper.1\nAlax.Info DirectShow Filter Graph Helper\n"
     321END
     322
     323STRINGTABLE
     324BEGIN
     325    IDR_FILTERGRAPHHELPER   "AlaxInfo.DirectShowSpy.FilterGraphHelper\nAlaxInfo.DirectShowSpy.FilterGraphHelper.1\nAlax.Info DirectShow Filter Graph Helper\n"
    305326END
    306327
  • trunk/DirectShowSpy/DirectShowSpy.sln

    r193 r231  
    44Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectShowSpy", "DirectShowSpy.vcxproj", "{1A5DA4E5-ED09-476A-9A42-538D0DDA3FB9}"
    55EndProject
    6 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectShowSpyPS", "DirectShowSpyPS.vcproj", "{E0A3323D-478E-4046-909A-AD12AD399A68}"
    7         ProjectSection(ProjectDependencies) = postProject
    8                 {1A5DA4E5-ED09-476A-9A42-538D0DDA3FB9} = {1A5DA4E5-ED09-476A-9A42-538D0DDA3FB9}
    9         EndProjectSection
     6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectShowSpyPS", "DirectShowSpyPS.vcxproj", "{E0A3323D-478E-4046-909A-AD12AD399A68}"
    107EndProject
    118Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BdaHooks", "BdaHooks\BdaHooks.vcxproj", "{42B74EE4-45E2-44E8-B3EE-6061DBCDD86D}"
  • trunk/DirectShowSpy/DirectShowSpy_i.c

    r199 r231  
    77
    88 /* File created by MIDL compiler version 7.00.0555 */
    9 /* at Sun Jul 07 20:56:18 2013
     9/* at Fri Jan 10 00:26:35 2014
    1010 */
    1111/* Compiler settings for DirectShowSpy.idl:
  • trunk/DirectShowSpy/DirectShowSpy_i.h

    r199 r231  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Sun Jul 07 20:56:18 2013
     7/* at Fri Jan 10 00:26:35 2014
    88 */
    99/* Compiler settings for DirectShowSpy.idl:
     
    514514            /* [retval][out] */ BSTR *psText) = 0;
    515515       
     516        virtual /* [id] */ HRESULT STDMETHODCALLTYPE DoPropertyFrameModal(
     517            /* [in] */ LONG nParentWindowHandle) = 0;
     518       
    516519    };
    517520   
     
    575578            /* [retval][out] */ BSTR *psText);
    576579       
     580        /* [id] */ HRESULT ( STDMETHODCALLTYPE *DoPropertyFrameModal )(
     581            IFilterGraphHelper * This,
     582            /* [in] */ LONG nParentWindowHandle);
     583       
    577584        END_INTERFACE
    578585    } IFilterGraphHelperVtbl;
     
    619626#define IFilterGraphHelper_get_Text(This,psText)        \
    620627    ( (This)->lpVtbl -> get_Text(This,psText) )
     628
     629#define IFilterGraphHelper_DoPropertyFrameModal(This,nParentWindowHandle)       \
     630    ( (This)->lpVtbl -> DoPropertyFrameModal(This,nParentWindowHandle) )
    621631
    622632#endif /* COBJMACROS */
  • trunk/DirectShowSpy/DirectShowSpy_p.c

    r199 r231  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Sun Jul 07 20:56:18 2013
     7/* at Fri Jan 10 00:26:35 2014
    88 */
    99/* Compiler settings for DirectShowSpy.idl:
     
    5151
    5252#define TYPE_FORMAT_STRING_SIZE   65                               
    53 #define PROC_FORMAT_STRING_SIZE   109                               
     53#define PROC_FORMAT_STRING_SIZE   145                               
    5454#define EXPR_FORMAT_STRING_SIZE   1                                 
    5555#define TRANSMIT_AS_TABLE_SIZE    0           
     
    219219/* 104 */       NdrFcShort( 0x8 ),      /* x86 Stack size/offset = 8 */
    220220/* 106 */       0x8,            /* FC_LONG */
     221                        0x0,            /* 0 */
     222
     223        /* Procedure DoPropertyFrameModal */
     224
     225/* 108 */       0x33,           /* FC_AUTO_HANDLE */
     226                        0x6c,           /* Old Flags:  object, Oi2 */
     227/* 110 */       NdrFcLong( 0x0 ),       /* 0 */
     228/* 114 */       NdrFcShort( 0xa ),      /* 10 */
     229/* 116 */       NdrFcShort( 0xc ),      /* x86 Stack size/offset = 12 */
     230/* 118 */       NdrFcShort( 0x8 ),      /* 8 */
     231/* 120 */       NdrFcShort( 0x8 ),      /* 8 */
     232/* 122 */       0x44,           /* Oi2 Flags:  has return, has ext, */
     233                        0x2,            /* 2 */
     234/* 124 */       0x8,            /* 8 */
     235                        0x1,            /* Ext Flags:  new corr desc, */
     236/* 126 */       NdrFcShort( 0x0 ),      /* 0 */
     237/* 128 */       NdrFcShort( 0x0 ),      /* 0 */
     238/* 130 */       NdrFcShort( 0x0 ),      /* 0 */
     239
     240        /* Parameter nParentWindowHandle */
     241
     242/* 132 */       NdrFcShort( 0x48 ),     /* Flags:  in, base type, */
     243/* 134 */       NdrFcShort( 0x4 ),      /* x86 Stack size/offset = 4 */
     244/* 136 */       0x8,            /* FC_LONG */
     245                        0x0,            /* 0 */
     246
     247        /* Return value */
     248
     249/* 138 */       NdrFcShort( 0x70 ),     /* Flags:  out, return, base type, */
     250/* 140 */       NdrFcShort( 0x8 ),      /* x86 Stack size/offset = 8 */
     251/* 142 */       0x8,            /* FC_LONG */
    221252                        0x0,            /* 0 */
    222253
     
    515546    0,
    516547    36,
    517     72
     548    72,
     549    108
    518550    };
    519551
     
    539571    0,
    540572    0};
    541 CINTERFACE_PROXY_VTABLE(10) _IFilterGraphHelperProxyVtbl =
     573CINTERFACE_PROXY_VTABLE(11) _IFilterGraphHelperProxyVtbl =
    542574{
    543575    &IFilterGraphHelper_ProxyInfo,
     
    552584    (void *) (INT_PTR) -1 /* IFilterGraphHelper::get_FilterGraph */ ,
    553585    (void *) (INT_PTR) -1 /* IFilterGraphHelper::put_FilterGraph */ ,
    554     (void *) (INT_PTR) -1 /* IFilterGraphHelper::get_Text */
     586    (void *) (INT_PTR) -1 /* IFilterGraphHelper::get_Text */ ,
     587    (void *) (INT_PTR) -1 /* IFilterGraphHelper::DoPropertyFrameModal */
    555588};
    556589
     
    562595    STUB_FORWARDING_FUNCTION,
    563596    STUB_FORWARDING_FUNCTION,
     597    NdrStubCall2,
    564598    NdrStubCall2,
    565599    NdrStubCall2,
     
    571605    &IID_IFilterGraphHelper,
    572606    &IFilterGraphHelper_ServerInfo,
    573     10,
     607    11,
    574608    &IFilterGraphHelper_table[-3],
    575609    CStdStubBuffer_DELEGATING_METHODS
  • trunk/DirectShowSpy/FilterGraphHelper.h

    r207 r231  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2013
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    44
     
    99#include "DirectShowSpy_i.h"
    1010#include "Common.h"
     11#include "AboutDialog.h"
    1112
    1213////////////////////////////////////////////////////////////
     
    4445        };
    4546
     47        ////////////////////////////////////////////////////////
     48        // CPropertyFrameDialog
     49
     50        class CPropertyFrameDialog :
     51                public CDialogImpl<CPropertyFrameDialog>,
     52                public CDialogResize<CPropertyFrameDialog>
     53        {
     54        public:
     55                enum { IDD = IDD_FILTERGRAPHHELPER_PROPERTYFRAME };
     56
     57        BEGIN_MSG_MAP_EX(CPropertyFrameDialog)
     58                //CHAIN_MSG_MAP(CDialogImpl<CPropertyFrameDialog>)
     59                CHAIN_MSG_MAP(CDialogResize<CPropertyFrameDialog>)
     60                MSG_WM_INITDIALOG(OnInitDialog)
     61                MSG_WM_DESTROY(OnDestroy)
     62                MSG_TVN_SELCHANGED(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TREE, OnTreeViewSelChanged)
     63                MSG_TVN_ITEMEXPANDING(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TREE, OnTreeViewItemExplanding)
     64                MSG_TVN_DBLCLK(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TREE, OnTreeViewDblClk)
     65                MSG_WM_SYSCOMMAND(OnSysCommand)
     66                COMMAND_ID_HANDLER_EX(IDOK, OnOk)
     67                COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel)
     68                COMMAND_ID_HANDLER_EX(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_APPLY, OnApply)
     69                REFLECT_NOTIFICATIONS()
     70        END_MSG_MAP()
     71
     72        BEGIN_DLGRESIZE_MAP(CPropertyFrameDialog)
     73                DLGRESIZE_CONTROL(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TREE, DLSZ_SIZE_Y)
     74                DLGRESIZE_CONTROL(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TEXT, DLSZ_SIZE_X | DLSZ_SIZE_Y)
     75                DLGRESIZE_CONTROL(IDOK, DLSZ_MOVE_X | DLSZ_MOVE_Y)
     76                DLGRESIZE_CONTROL(IDCANCEL, DLSZ_MOVE_X | DLSZ_MOVE_Y)
     77                DLGRESIZE_CONTROL(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_APPLY, DLSZ_MOVE_X | DLSZ_MOVE_Y)
     78        END_DLGRESIZE_MAP()
     79
     80        public:
     81
     82                ////////////////////////////////////////////////////
     83                // CPropertyPageSite
     84
     85                class ATL_NO_VTABLE CPropertyPageSite :
     86                        public CComObjectRootEx<CComSingleThreadModel>,
     87                        public IPropertyPageSite
     88                {
     89                        friend class CPropertyFrameDialog;
     90
     91                public:
     92
     93                BEGIN_COM_MAP(CPropertyPageSite)
     94                        COM_INTERFACE_ENTRY(IPropertyPageSite)
     95                END_COM_MAP()
     96
     97                private:
     98                        CPropertyFrameDialog* m_pOwner;
     99                        CComPtr<IUnknown> m_pUnknown;
     100                        CComPtr<IPropertyPage> m_pPropertyPage;
     101                        CString m_sTitle;
     102                        DWORD m_nStatus;
     103
     104                public:
     105                // CPropertyPageSite
     106                        CPropertyPageSite() :
     107                                m_pOwner(NULL)
     108                        {
     109                        }
     110                        VOID Initialize(CPropertyFrameDialog* pOwner, IUnknown* pUnknown, IPropertyPage* pPropertyPage)
     111                        {
     112                                _A(pOwner && pUnknown && pPropertyPage);
     113                                _A(!m_pOwner);
     114                                m_pOwner = pOwner;
     115                                m_pUnknown = pUnknown;
     116                                m_pPropertyPage = pPropertyPage;
     117                                __C(pPropertyPage->SetObjects(1, &m_pUnknown.p));
     118                                PROPPAGEINFO Information;
     119                                ZeroMemory(&Information, sizeof Information);
     120                                Information.cb = sizeof Information;
     121                                __C(pPropertyPage->GetPageInfo(&Information));
     122                                CStringW sTitle = Information.pszTitle;
     123                                CoTaskMemFree(Information.pszTitle);
     124                                CoTaskMemFree(Information.pszDocString);
     125                                CoTaskMemFree(Information.pszHelpFile);
     126                                m_sTitle = CString(sTitle);
     127                                m_nStatus = 0;
     128                                __C(pPropertyPage->SetPageSite(this));
     129                        }
     130                        VOID Terminate()
     131                        {
     132                                if(m_pPropertyPage)
     133                                {
     134                                        _V(m_pPropertyPage->SetPageSite(NULL));
     135                                        m_pPropertyPage.Release();
     136                                }
     137                                m_pUnknown.Release();
     138                                m_pOwner = NULL;
     139                        }
     140                        BOOL IsDirty()
     141                        {
     142                                return m_nStatus & PROPPAGESTATUS_DIRTY;
     143                        }
     144
     145                // IPropertyPageSite
     146                        STDMETHOD(OnStatusChange)(DWORD nFlags)
     147                        {
     148                                _Z4(atlTraceCOM, 4, _T("nFlags 0x%x\n"), nFlags);
     149                                m_nStatus = nFlags;
     150                                m_pOwner->HandleStatusChange(this);
     151                                return S_OK;
     152                        }
     153                        STDMETHOD(GetLocaleID)(LCID* pLocaleIdentifier)
     154                        {
     155                                _Z4(atlTraceCOM, 4, _T("...\n"));
     156                                pLocaleIdentifier;
     157                                return E_NOTIMPL;
     158                        }
     159                        STDMETHOD(GetPageContainer)(IUnknown** ppUnknown)
     160                        {
     161                                _Z4(atlTraceCOM, 4, _T("...\n"));
     162                                ppUnknown;
     163                                return E_NOTIMPL;
     164                        }
     165                        STDMETHOD(TranslateAccelerator)(MSG* pMessage)
     166                        {
     167                                _Z4(atlTraceCOM, 4, _T("...\n"));
     168                                pMessage;
     169                                return E_NOTIMPL;
     170                        }
     171                };
     172
     173                ////////////////////////////////////////////////////
     174                // CData
     175
     176                class CData
     177                {
     178                public:
     179                        CComPtr<IBaseFilter> m_pBaseFilter;
     180                        CLSID m_ClassIdentifier;
     181                        CComPtr<IPropertyPage> m_pPropertyPage;
     182                        CObjectPtr<CPropertyPageSite> m_pSite;
     183                        BOOL m_bSiteActivated;
     184
     185                public:
     186                // CData
     187                        CData() :
     188                                m_ClassIdentifier(CLSID_NULL)
     189                        {
     190                        }
     191                        CData(IBaseFilter* pBaseFilter) :
     192                                m_pBaseFilter(pBaseFilter),
     193                                m_ClassIdentifier(CLSID_NULL)
     194                        {
     195                        }
     196                        CData(IBaseFilter* pBaseFilter, const CLSID& ClassIdentifier, IPropertyPage* pPropertyPage) :
     197                                m_pBaseFilter(pBaseFilter),
     198                                m_ClassIdentifier(ClassIdentifier),
     199                                m_pPropertyPage(pPropertyPage),
     200                                m_bSiteActivated(FALSE)
     201                        {
     202                                _A(pPropertyPage);
     203                        }
     204                        CString GetPropertyPageTitle() const
     205                        {
     206                                if(!m_pPropertyPage)
     207                                        return _T("");
     208                                PROPPAGEINFO PageInformation;
     209                                ZeroMemory(&PageInformation, sizeof PageInformation);
     210                                PageInformation.cb = sizeof PageInformation;
     211                                __C(m_pPropertyPage->GetPageInfo(&PageInformation));
     212                                CString sTitle(PageInformation.pszTitle);
     213                                CoTaskMemFree(PageInformation.pszTitle);
     214                                CoTaskMemFree(PageInformation.pszDocString);
     215                                CoTaskMemFree(PageInformation.pszHelpFile);
     216                                return sTitle;
     217                        }
     218                };
     219
     220        private:
     221                CFilterGraphHelper& m_Owner;
     222                BOOL m_bActivating;
     223                CRoTreeViewT<CData, CRoListControlDataTraitsT> m_TreeView;
     224                CTreeItem m_FiltersItem;
     225                CTabCtrl m_Tab;
     226                CRoEdit m_TextEdit;
     227                CRect m_TextPosition;
     228                CFont m_TextFont;
     229                CButton m_OkButton;
     230                CButton m_CancelButton;
     231                CButton m_ApplyButton;
     232                CObjectPtr<CPropertyPageSite> m_pCurrentSite;
     233
     234        public:
     235        // CPropertyFrameDialog
     236                CPropertyFrameDialog(CFilterGraphHelper* pOwner) :
     237                        m_Owner(*pOwner)
     238                {
     239                }
     240                CRect GetTextEditPosition() const
     241                {
     242                        CRect Position;
     243                        _W(m_TextEdit.GetWindowRect(Position));
     244                        _W(ScreenToClient(Position));
     245                        return Position;
     246                }
     247                VOID UpdateTree()
     248                {
     249                        CWindowRedraw TreeViewRedraw(m_TreeView);
     250                        m_TreeView.DeleteAllItems();
     251                        CTreeItem FiltersItem = m_TreeView.InsertItem(NULL, NULL, CData(), _T("Filters"));
     252                        _FilterGraphHelper::CFilterArray FilterArray;
     253                        _FilterGraphHelper::GetGraphFilters(m_Owner.m_pFilterGraph, FilterArray);
     254                        CTreeItem PreviousFilterItem;
     255                        for(SIZE_T nIndex = 0; nIndex < FilterArray.GetCount(); nIndex++)
     256                        {
     257                                const CComPtr<IBaseFilter>& pBaseFilter = FilterArray[nIndex];
     258                                CTreeItem FilterItem = m_TreeView.InsertItem(FiltersItem, PreviousFilterItem, CData(pBaseFilter), CString(_FilterGraphHelper::GetFilterName(pBaseFilter)));
     259                                PreviousFilterItem = FilterItem;
     260                                const CComQIPtr<ISpecifyPropertyPages> pSpecifyPropertyPages = pBaseFilter;
     261                                if(!pSpecifyPropertyPages)
     262                                        continue;
     263                                _ATLTRY
     264                                {
     265                                        CAUUID Pages;
     266                                        ZeroMemory(&Pages, sizeof Pages);
     267                                        __C(pSpecifyPropertyPages->GetPages(&Pages));
     268                                        CComHeapPtr<CLSID> pClassIdentifiers;
     269                                        pClassIdentifiers.Attach(Pages.pElems);
     270                                        CTreeItem PreviousPageItem;
     271                                        for(UINT nPageIndex = 0; nPageIndex < Pages.cElems; nPageIndex++)
     272                                        {
     273                                                const CLSID& ClassIdentifier = pClassIdentifiers[nPageIndex];
     274                                                if(ClassIdentifier == CLSID_NULL)
     275                                                        continue;
     276                                                _ATLTRY
     277                                                {
     278                                                        CComPtr<IPropertyPage> pPropertyPage;
     279                                                        __C(pPropertyPage.CoCreateInstance(ClassIdentifier));
     280                                                        CData Data(pBaseFilter, ClassIdentifier, pPropertyPage);
     281                                                        Data.m_pSite.Construct()->Initialize(this, pBaseFilter, pPropertyPage);
     282                                                        CTreeItem PageItem = m_TreeView.InsertItem(FilterItem, PreviousPageItem, Data, Data.GetPropertyPageTitle());
     283                                                        PreviousPageItem = PageItem;
     284                                                }
     285                                                _ATLCATCHALL()
     286                                                {
     287                                                        _Z_EXCEPTION();
     288                                                }
     289                                        }
     290                                        m_TreeView.Expand(FilterItem);
     291                                }
     292                                _ATLCATCHALL()
     293                                {
     294                                        _Z_EXCEPTION();
     295                                }
     296                        }
     297                        m_TreeView.Expand(FiltersItem);
     298                        m_FiltersItem.m_hTreeItem = FiltersItem;
     299                        m_FiltersItem.m_pTreeView = &m_TreeView;
     300                        // TODO: Email Item
     301                }
     302                VOID HideCurrentSite()
     303                {
     304                        if(!m_pCurrentSite)
     305                                return;
     306                        if(m_pCurrentSite->m_pPropertyPage)
     307                                __C(m_pCurrentSite->m_pPropertyPage->Show(SW_HIDE));
     308                        m_pCurrentSite.Release();
     309                }
     310                VOID HandleStatusChange(CPropertyPageSite* pPropertyPageSite)
     311                {
     312                        _A(pPropertyPageSite);
     313                        m_ApplyButton.EnableWindow(pPropertyPageSite->IsDirty());
     314                }
     315                VOID Apply()
     316                {
     317                        if(!m_pCurrentSite || !m_pCurrentSite->m_pPropertyPage)
     318                                return;
     319                        __C(m_pCurrentSite->m_pPropertyPage->Apply());
     320                        HandleStatusChange(m_pCurrentSite);
     321                }
     322
     323        // CDialogResize
     324                VOID DlgResize_UpdateLayout(INT nWidth, INT nHeight)
     325                {
     326                        __super::DlgResize_UpdateLayout(nWidth, nHeight);
     327                        if(m_pCurrentSite && m_pCurrentSite->m_pPropertyPage)
     328                                _V(m_pCurrentSite->m_pPropertyPage->Move(GetTextEditPosition()));
     329                }
     330
     331        // Window Message Handler
     332                LRESULT OnInitDialog(HWND, LPARAM)
     333                {
     334                        m_bActivating = TRUE;
     335                        _ATLTRY
     336                        {
     337                                CWaitCursor WaitCursor;
     338                                #pragma region Bitness Indication
     339                                CString sCaption;
     340                                _W(GetWindowText(sCaption));
     341                                #if defined(_WIN64)
     342                                        sCaption.Append(_T(" (64-bit)"));
     343                                #else
     344                                        if(SafeIsWow64Process())
     345                                                sCaption.Append(_T(" (32-bit)"));
     346                                #endif // defined(_WIN64)
     347                                _W(SetWindowText(sCaption));
     348                                #pragma endregion
     349                                #pragma region System Menu
     350                                CMenuHandle Menu = GetSystemMenu(FALSE);
     351                                _W(Menu.AppendMenu(MF_SEPARATOR));
     352                                _W(Menu.AppendMenu(MF_STRING, ID_APP_ABOUT, _T("&About...")));
     353                                #pragma endregion
     354                                m_TreeView.Initialize(GetDlgItem(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TREE));
     355                                m_TextEdit = GetDlgItem(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TEXT);
     356                                CRect TextPosition;
     357                                _W(m_TextEdit.GetWindowRect(TextPosition));
     358                                _W(ScreenToClient(TextPosition));
     359                                m_TextPosition = TextPosition;
     360                                CLogFont TextFont;
     361                                CFontHandle(AtlGetDefaultGuiFont()).GetLogFont(TextFont);
     362                                _tcsncpy_s(TextFont.lfFaceName, _T("Courier New"), _TRUNCATE);
     363                                TextFont.SetHeight(8);
     364                                m_TextFont = TextFont.CreateFontIndirect();
     365                                m_TextEdit.SetFont(m_TextFont);
     366                                m_OkButton = GetDlgItem(IDOK);
     367                                m_CancelButton = GetDlgItem(IDCANCEL);
     368                                m_ApplyButton = GetDlgItem(IDC_FILTERGRAPHHELPER_PROPERTYFRAME_APPLY);
     369                                DlgResize_Init(TRUE);
     370                                UpdateTree();
     371                                m_FiltersItem.Select();
     372                                m_FiltersItem.EnsureVisible();
     373                                CRect Position;
     374                                _W(GetWindowRect(Position));
     375                                Position.right += Position.Width() / 2;
     376                                Position.bottom += Position.Width() / 4;
     377                                _W(SetWindowPos(NULL, Position, SWP_NOMOVE | SWP_NOZORDER));
     378                                _W(CenterWindow());
     379                                m_bActivating = FALSE;
     380                        }
     381                        _ATLCATCH(Exception)
     382                        {
     383                                for(CWindow Window = GetWindow(GW_CHILD); Window; Window = Window.GetWindow(GW_HWNDNEXT))
     384                                        Window.EnableWindow(FALSE);
     385                                AtlExceptionMessageBox(m_hWnd, Exception);
     386                        }
     387                        return TRUE;
     388                }
     389                LRESULT OnDestroy()
     390                {
     391                        #pragma region Deactivate and Terminate Sites
     392                        for(POSITION Position = m_TreeView.GetDataList().GetHeadPosition(); Position; m_TreeView.GetDataList().GetNext(Position))
     393                        {
     394                                CData& Data = m_TreeView.GetDataList().GetAt(Position);
     395                                if(!Data.m_pSite)
     396                                        continue;
     397                                if(Data.m_bSiteActivated)
     398                                {
     399                                        const HRESULT nDeactivateResult = Data.m_pPropertyPage->Deactivate();
     400                                        _Z35_DSHRESULT(nDeactivateResult);
     401                                        Data.m_bSiteActivated = FALSE;
     402                                }
     403                                Data.m_pSite->Terminate();
     404                        }
     405                        #pragma endregion
     406                        return 0;
     407                }
     408                LRESULT OnTreeViewSelChanged(NMTREEVIEW* pHeader)
     409                {
     410                        _A(pHeader);
     411                        CTreeItem TreeItem(pHeader->itemNew.hItem);
     412                        if(TreeItem)
     413                        {
     414                                CData& Data = m_TreeView.GetItemData(TreeItem);
     415                                if(Data.m_pBaseFilter)
     416                                {
     417                                        if(Data.m_pPropertyPage)
     418                                        {
     419                                                m_TextEdit.ShowWindow(SW_HIDE);
     420                                                if(Data.m_pSite != m_pCurrentSite)
     421                                                        HideCurrentSite();
     422                                                if(!Data.m_bSiteActivated)
     423                                                {
     424                                                        __C(Data.m_pPropertyPage->Activate(m_hWnd, GetTextEditPosition(), TRUE));
     425                                                        Data.m_bSiteActivated = TRUE;
     426                                                } else
     427                                                        __C(Data.m_pPropertyPage->Move(GetTextEditPosition()));
     428                                                __C(Data.m_pPropertyPage->Show(SW_SHOWNORMAL));
     429                                                m_pCurrentSite = Data.m_pSite;
     430                                                HandleStatusChange(m_pCurrentSite);
     431                                        } else
     432                                        {
     433                                                CWaitCursor WaitCursor;
     434                                                HideCurrentSite();
     435                                                m_TextEdit.ShowWindow(SW_SHOW);
     436                                                CString sText;
     437                                                sText += AtlFormatString(_T("## ") _T("Filter %ls") _T("\r\n") _T("\r\n"), _FilterGraphHelper::GetFilterName(Data.m_pBaseFilter));
     438                                                sText += m_Owner.GetFilterText(Data.m_pBaseFilter);
     439                                                sText += _T("\r\n");
     440                                                #pragma region Connection
     441                                                _FilterGraphHelper::CPinArray InputPinArray, OutputPinArray;
     442                                                _FilterGraphHelper::GetFilterPins(Data.m_pBaseFilter, PINDIR_INPUT, InputPinArray);
     443                                                _FilterGraphHelper::GetFilterPins(Data.m_pBaseFilter, PINDIR_OUTPUT, OutputPinArray);
     444                                                if(!InputPinArray.IsEmpty() || !OutputPinArray.IsEmpty())
     445                                                {
     446                                                        sText += AtlFormatString(_T("## ") _T("Connections") _T("\r\n") _T("\r\n"));
     447                                                        if(!InputPinArray.IsEmpty())
     448                                                        {
     449                                                                sText += AtlFormatString(_T("### ") _T("Input") _T("\r\n") _T("\r\n"));
     450                                                                for(SIZE_T nPinIndex = 0; nPinIndex < InputPinArray.GetCount(); nPinIndex++)
     451                                                                {
     452                                                                        const CComPtr<IPin>& pInputPin = InputPinArray[nPinIndex];
     453                                                                        const CComPtr<IPin> pOutputPin = _FilterGraphHelper::GetPeerPin(pInputPin);
     454                                                                        if(!pOutputPin)
     455                                                                                continue;
     456                                                                        sText += AtlFormatString(_T(" * ") _T("%s") _T("\r\n"), m_Owner.GetConnectionText(pOutputPin, pInputPin));
     457                                                                }
     458                                                                sText += _T("\r\n");
     459                                                        }
     460                                                        if(!OutputPinArray.IsEmpty())
     461                                                        {
     462                                                                sText += AtlFormatString(_T("### ") _T("Output") _T("\r\n") _T("\r\n"));
     463                                                                for(SIZE_T nPinIndex = 0; nPinIndex < OutputPinArray.GetCount(); nPinIndex++)
     464                                                                {
     465                                                                        const CComPtr<IPin>& pOutputPin = OutputPinArray[nPinIndex];
     466                                                                        const CComPtr<IPin> pInputPin = _FilterGraphHelper::GetPeerPin(pOutputPin);
     467                                                                        if(!pInputPin)
     468                                                                                continue;
     469                                                                        sText += AtlFormatString(_T(" * ") _T("%s") _T("\r\n"), m_Owner.GetConnectionText(pOutputPin, pInputPin));
     470                                                                }
     471                                                                sText += _T("\r\n");
     472                                                        }
     473                                                }
     474                                                #pragma endregion
     475                                                #pragma region Media Type
     476                                                _FilterGraphHelper::CPinArray PinArray;
     477                                                if(_FilterGraphHelper::GetFilterPins(Data.m_pBaseFilter, PinArray))
     478                                                {
     479                                                        sText += AtlFormatString(_T("## ") _T("Media Types") _T("\r\n") _T("\r\n"));
     480                                                        for(SIZE_T nPinIndex = 0; nPinIndex < PinArray.GetCount(); nPinIndex++)
     481                                                        {
     482                                                                const CComPtr<IPin>& pPin = PinArray[nPinIndex];
     483                                                                CString sPinText = AtlFormatString(_T("%s"), FormatIdentifier(_FilterGraphHelper::GetPinFullName(pPin)));
     484                                                                const CComPtr<IPin> pPeerPin = _FilterGraphHelper::GetPeerPin(pPin);
     485                                                                if(pPeerPin)
     486                                                                        sPinText += AtlFormatString(_T(", %s"), FormatIdentifier(_FilterGraphHelper::GetPinFullName(pPeerPin)));
     487                                                                sText += AtlFormatString(_T("%d. ") _T("%s") _T("\r\n"), nPinIndex, sPinText);
     488                                                                _ATLTRY
     489                                                                {
     490                                                                        CMediaType pMediaType;
     491                                                                        if(pPeerPin)
     492                                                                                pMediaType = _FilterGraphHelper::GetPinMediaType(pPin);
     493                                                                        else
     494                                                                                pMediaType = _FilterGraphHelper::EnumerateFirstPinMediaType(pPin);
     495                                                                        if(!pMediaType)
     496                                                                                continue;
     497                                                                        sText += m_Owner.GetMediaTypeText(pMediaType);
     498                                                                }
     499                                                                _ATLCATCHALL()
     500                                                                {
     501                                                                        _Z_EXCEPTION();
     502                                                                }
     503                                                        }
     504                                                        sText += _T("\r\n");
     505                                                }
     506                                                #pragma endregion
     507                                                m_TextEdit.SetValue(sText);
     508                                                m_ApplyButton.EnableWindow(FALSE);
     509                                        }
     510                                } else
     511                                {
     512                                        CWaitCursor WaitCursor;
     513                                        HideCurrentSite();
     514                                        m_TextEdit.ShowWindow(SW_SHOW);
     515                                        m_TextEdit.SetValue(m_Owner.GetText());
     516                                        m_ApplyButton.EnableWindow(FALSE);
     517                                }
     518                        } else
     519                        {
     520                                HideCurrentSite();
     521                                m_TextEdit.ShowWindow(SW_HIDE);
     522                                m_ApplyButton.EnableWindow(FALSE);
     523                        }
     524                        return 0;
     525                }
     526                LRESULT OnTreeViewItemExplanding(NMTREEVIEW* pHeader)
     527                {
     528                        if(pHeader->action == TVE_COLLAPSE)
     529                                return TRUE; // Prevent Collapsing
     530                        return 0;
     531                }
     532                LRESULT OnTreeViewDblClk(NMHDR*)
     533                {
     534                        CTreeItem TreeItem = m_TreeView.GetSelectedItem();
     535                        if(!TreeItem)
     536                                return 0;
     537                        CData& Data = m_TreeView.GetItemData(TreeItem);
     538                        if(!Data.m_pBaseFilter)
     539                                return 0;
     540                        COlePropertyFrameDialog Dialog(Data.m_pBaseFilter);
     541                        if(!Dialog.SetObjectPages())
     542                                return 0;
     543                        Dialog.DoModal(m_hWnd);
     544                        return 0;
     545                }
     546                LRESULT OnSysCommand(UINT nCommand, CPoint)
     547                {
     548                        switch(nCommand)
     549                        {
     550                        case ID_APP_ABOUT:
     551                                {
     552                                        CAboutDialog Dialog;
     553                                        Dialog.DoModal(m_hWnd);
     554                                }
     555                                break;
     556                        default:
     557                                SetMsgHandled(FALSE);
     558                        }
     559                        return 0;
     560                }
     561                LRESULT OnOk(UINT, INT nIdentifier, HWND)
     562                {
     563                        _ATLTRY
     564                        {
     565                                #pragma region Apply All
     566                                for(POSITION Position = m_TreeView.GetDataList().GetHeadPosition(); Position; m_TreeView.GetDataList().GetNext(Position))
     567                                {
     568                                        CData& Data = m_TreeView.GetDataList().GetAt(Position);
     569                                        if(!Data.m_pSite)
     570                                                continue;
     571                                        _A(Data.m_pPropertyPage);
     572                                        if(Data.m_bSiteActivated && Data.m_pSite->IsDirty())
     573                                                __C(Data.m_pPropertyPage->Apply());
     574                                }
     575                                #pragma endregion
     576                        }
     577                        _ATLCATCH(Exception)
     578                        {
     579                                _Z_ATLEXCEPTION(Exception);
     580                                AtlMessageBoxEx(m_hWnd, (LPCTSTR) Ds::FormatResult(Exception), IDS_ERROR, MB_ICONERROR | MB_OK);
     581                                return 0;
     582                        }
     583                        EndDialog(nIdentifier);
     584                        return 0;
     585                }
     586                LRESULT OnCancel(UINT, INT nIdentifier, HWND)
     587                {
     588                        EndDialog(nIdentifier);
     589                        return 0;
     590                }
     591                LRESULT OnApply(UINT, INT, HWND)
     592                {
     593                        _ATLTRY
     594                        {
     595                                Apply();
     596                        }
     597                        _ATLCATCH(Exception)
     598                        {
     599                                _Z_ATLEXCEPTION(Exception);
     600                                AtlMessageBoxEx(m_hWnd, (LPCTSTR) Ds::FormatResult(Exception), IDS_ERROR, MB_ICONERROR | MB_OK);
     601                        }
     602                        return 0;
     603                }
     604        };
     605
    46606private:
    47607        mutable CRoCriticalSection m_DataCriticalSection;
     
    50610public:
    51611// CFilterGraphHelper
    52         static HRESULT WINAPI UpdateRegistry(BOOL bRegister) throw()
     612        static HRESULT WINAPI UpdateRegistry(BOOL bRegister)
    53613        {
    54614                _Z2(atlTraceRegistrar, 2, _T("bRegister %d\n"), bRegister);
     
    176736                return _StringHelper::Join(Array, _T(", "));
    177737        }
     738        static CString GetFilterText(IBaseFilter* pBaseFilter, IReferenceClock* pFilterGraphReferenceClock = NULL)
     739        {
     740                CString sText;
     741                const CStringW sClassIdentifierString = _FilterGraphHelper::GetFilterClassIdentifierString(pBaseFilter);
     742                if(!sClassIdentifierString.IsEmpty())
     743                        sText += AtlFormatString(_T(" * ") _T("Class: %s %s") _T("\r\n"), I(sClassIdentifierString), I(_FilterGraphHelper::GetFilterClassDescription(pBaseFilter)));
     744                _FilterGraphHelper::CPinArray InputPinArray;
     745                if(_FilterGraphHelper::GetFilterPins(pBaseFilter, PINDIR_INPUT, InputPinArray))
     746                        sText += AtlFormatString(_T(" * ") _T("Input Pins: %s") _T("\r\n"), FormatPins(InputPinArray));
     747                _FilterGraphHelper::CPinArray OutputPinArray;
     748                if(_FilterGraphHelper::GetFilterPins(pBaseFilter, PINDIR_OUTPUT, OutputPinArray))
     749                        sText += AtlFormatString(_T(" * ") _T("Output Pins: %s") _T("\r\n"), FormatPins(OutputPinArray));
     750                #pragma region IReferenceClock
     751                const CComQIPtr<IReferenceClock> pReferenceClock = pBaseFilter;
     752                if(pReferenceClock)
     753                {
     754                        CRoArrayT<CString> Array;
     755                        Array.Add(I(_T("Available")));
     756                        if(pReferenceClock == pFilterGraphReferenceClock)
     757                                Array.Add(I(_T("Selected")));
     758                        sText += AtlFormatString(_T(" * ") _T("Reference Clock: %s") _T("\r\n"), _StringHelper::Join(Array, _T(", ")));
     759                }
     760                #pragma endregion
     761                #pragma region IFileSourceFilter
     762                const CComQIPtr<IFileSourceFilter> pFileSourceFilter = pBaseFilter;
     763                if(pFileSourceFilter)
     764                        _ATLTRY
     765                        {
     766                                CComHeapPtr<OLECHAR> pszFileName;
     767                                CMediaType pMediaType;
     768                                pMediaType.Allocate(MEDIATYPE_NULL, MEDIASUBTYPE_NULL);
     769                                const HRESULT nGetCurFileResult = pFileSourceFilter->GetCurFile(&pszFileName, pMediaType);
     770                                _Z45_DSHRESULT(nGetCurFileResult);
     771                                if(SUCCEEDED(nGetCurFileResult))
     772                                        sText += AtlFormatString(_T(" * ") _T("File Source: %s") _T("\r\n"), I(pszFileName));
     773                        }
     774                        _ATLCATCHALL()
     775                        {
     776                                _Z_EXCEPTION();
     777                        }
     778                #pragma endregion
     779                #pragma region IFileSinkFilter
     780                const CComQIPtr<IFileSinkFilter> pFileSinkFilter = pBaseFilter;
     781                if(pFileSinkFilter)
     782                        _ATLTRY
     783                        {
     784                                CComHeapPtr<OLECHAR> pszFileName;
     785                                CMediaType pMediaType;
     786                                pMediaType.Allocate(MEDIATYPE_NULL, MEDIASUBTYPE_NULL);
     787                                const HRESULT nGetCurFileResult = pFileSinkFilter->GetCurFile(&pszFileName, pMediaType);
     788                                _Z45_DSHRESULT(nGetCurFileResult);
     789                                if(SUCCEEDED(nGetCurFileResult))
     790                                        sText += AtlFormatString(_T(" * ") _T("File Sink: %s") _T("\r\n"), I(pszFileName));
     791                        }
     792                        _ATLCATCHALL()
     793                        {
     794                                _Z_EXCEPTION();
     795                        }
     796                #pragma endregion
     797                #pragma region IAMCrossbar
     798                const CComQIPtr<IAMCrossbar> pAmCrossbar = pBaseFilter;
     799                if(pAmCrossbar)
     800                        _ATLTRY
     801                        {
     802                                sText += AtlFormatString(_T(" * ") _T("Crossbar:") _T("\r\n"));
     803                                LONG nOutputPinCount = 0, nInputPinCount = 0;
     804                                __C(pAmCrossbar->get_PinCounts(&nOutputPinCount, &nInputPinCount));
     805                                sText += AtlFormatString(_T("  * ") _T("Pins: %s Input, %s Output") _T("\r\n"), I(nInputPinCount), I(nOutputPinCount));
     806                                #pragma region Input
     807                                for(LONG nInputPinIndex = 0; nInputPinIndex < nInputPinCount; nInputPinIndex++)
     808                                        _ATLTRY
     809                                        {
     810                                                CRoArrayT<CString> Array;
     811                                                LONG nRelatedPinIndex = -1;
     812                                                LONG nPhysicalType = 0; // PhysicalConnectorType
     813                                                __C(pAmCrossbar->get_CrossbarPinInfo(TRUE, nInputPinIndex, &nRelatedPinIndex, &nPhysicalType));
     814                                                if(nRelatedPinIndex >= 0)
     815                                                        Array.Add(AtlFormatString(_T("Related %s"), I(nRelatedPinIndex)));
     816                                                Array.Add(AtlFormatString(_T("Physical Type %s"), I(FormatPhysicalConnectorType((PhysicalConnectorType) nPhysicalType))));
     817                                                sText += AtlFormatString(_T("  * ") _T("Input Pin %s: %s") _T("\r\n"), I(nInputPinIndex), _StringHelper::Join(Array, _T("; ")));
     818                                        }
     819                                        _ATLCATCHALL()
     820                                        {
     821                                                _Z_EXCEPTION();
     822                                        }
     823                                #pragma endregion
     824                                #pragma region Output
     825                                for(LONG nOutputPinIndex = 0; nOutputPinIndex < nOutputPinCount; nOutputPinIndex++)
     826                                        _ATLTRY
     827                                        {
     828                                                CRoArrayT<CString> Array;
     829                                                LONG nRelatedPinIndex = -1;
     830                                                LONG nPhysicalType = 0; // PhysicalConnectorType
     831                                                __C(pAmCrossbar->get_CrossbarPinInfo(FALSE, nOutputPinIndex, &nRelatedPinIndex, &nPhysicalType));
     832                                                if(nRelatedPinIndex >= 0)
     833                                                        Array.Add(AtlFormatString(_T("Related %s"), I(nRelatedPinIndex)));
     834                                                if(nPhysicalType > 0)
     835                                                        Array.Add(AtlFormatString(_T("Physical Type %s"), I(FormatPhysicalConnectorType((PhysicalConnectorType) nPhysicalType))));
     836                                                LONG nRoutedInputPinIndex = -1;
     837                                                const HRESULT nGetIsRoutedToResult = pAmCrossbar->get_IsRoutedTo(nOutputPinIndex, &nRoutedInputPinIndex);
     838                                                _A(nGetIsRoutedToResult == S_OK || nRoutedInputPinIndex == -1);
     839                                                if(nRoutedInputPinIndex >= 0)
     840                                                        Array.Add(AtlFormatString(_T("Routed to Input Pin %s"), I(nRoutedInputPinIndex)));
     841                                                CRoArrayT<CString> PinArray;
     842                                                for(LONG nInputPinIndex = 0; nInputPinIndex < nInputPinCount; nInputPinIndex++)
     843                                                {
     844                                                        const HRESULT nCanRouteResult = pAmCrossbar->CanRoute(nOutputPinIndex, nInputPinIndex);
     845                                                        if(nCanRouteResult == S_OK)
     846                                                                PinArray.Add(I(nInputPinIndex));
     847                                                }
     848                                                if(!PinArray.IsEmpty())
     849                                                        Array.Add(AtlFormatString(_T("Routeable to Input Pins %s"), _StringHelper::Join(PinArray, _T(", "))));
     850                                                sText += AtlFormatString(_T("  * ") _T("Output Pin %s: %s") _T("\r\n"), I(nOutputPinIndex), _StringHelper::Join(Array, _T("; ")));
     851                                        }
     852                                        _ATLCATCHALL()
     853                                        {
     854                                                _Z_EXCEPTION();
     855                                        }
     856                                #pragma endregion
     857                        }
     858                        _ATLCATCHALL()
     859                        {
     860                                _Z_EXCEPTION();
     861                        }
     862                #pragma endregion
     863                return sText;
     864        }
     865        static CString GetConnectionText(IPin* pOutputPin, IPin* pInputPin)
     866        {
     867                _A(pOutputPin && pInputPin);
     868                CString sText = AtlFormatString(_T("%s - %s"), I(_FilterGraphHelper::GetPinFullName(pOutputPin)), I(_FilterGraphHelper::GetPinFullName(pInputPin)));
     869                _ATLTRY
     870                {
     871                        const CMediaType pMediaType = _FilterGraphHelper::GetPinMediaType(pOutputPin);
     872                        if(pMediaType)
     873                        {
     874                                CStringW sMajorType = _FilterGraphHelper::FormatMajorType(pMediaType->majortype);
     875                                CStringW sSubtype;
     876                                if(pMediaType->subtype != MEDIASUBTYPE_NULL)
     877                                        sSubtype = _FilterGraphHelper::FormatSubtype(pMediaType->majortype, pMediaType->subtype);
     878                                CRoArrayT<CString> Array;
     879                                Array.Add(I(sMajorType));
     880                                Array.Add(I(sSubtype));
     881                                #pragma region MEDIATYPE_Video
     882                                if(pMediaType->majortype == MEDIATYPE_Video)
     883                                {
     884                                        const CVideoInfoHeader2 VideoInfoHeader2 = pMediaType.GetCompatibleVideoInfoHeader2();
     885                                        const CSize Extent = VideoInfoHeader2.GetExtent();
     886                                        if(Extent.cx || Extent.cy)
     887                                                Array.Add(AtlFormatString(_T("%s x %s"), I(Extent.cx), I(Extent.cy)));
     888                                } else
     889                                #pragma endregion
     890                                #pragma region MEDIATYPE_Audio
     891                                if(pMediaType->majortype == MEDIATYPE_Audio)
     892                                {
     893                                        const CWaveFormatEx* pWaveFormatEx = pMediaType.GetWaveFormatEx();
     894                                        if(pWaveFormatEx)
     895                                        {
     896                                                if(pWaveFormatEx->nSamplesPerSec)
     897                                                        Array.Add(AtlFormatString(_T("%s Hz"), I(pWaveFormatEx->nSamplesPerSec)));
     898                                                if(pWaveFormatEx->nChannels)
     899                                                        Array.Add(AtlFormatString(_T("%s channels"), I(pWaveFormatEx->nChannels)));
     900                                                if(pWaveFormatEx->wBitsPerSample)
     901                                                        Array.Add(AtlFormatString(_T("%s bits"), I(pWaveFormatEx->wBitsPerSample)));
     902                                        }
     903                                }
     904                                #pragma endregion
     905                                sText += AtlFormatString(_T(" (%s)"), _StringHelper::Join(Array, _T(", ")));
     906                        }
     907                }
     908                _ATLCATCHALL()
     909                {
     910                        _Z_EXCEPTION();
     911                }
     912                return sText;
     913        }
     914        static CString GetMediaTypeText(const CMediaType& pMediaType)
     915        {
     916                CString sText;
     917                #pragma region AM_MEDIA_TYPE
     918                #define J(x) I(pMediaType->x)
     919                #define K1(x) sText += AtlFormatString(_T(" * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
     920                sText += AtlFormatString(_T(" * ") _T("Data: %s") _T("\r\n"), I(AtlFormatData((const BYTE*) (const AM_MEDIA_TYPE*) pMediaType, sizeof *pMediaType).TrimRight()));
     921                sText += AtlFormatString(_T(" * ") _T("`majortype`: %s") _T("\r\n"), I(_FilterGraphHelper::FormatMajorType(pMediaType->majortype)));
     922                if(pMediaType->subtype != MEDIASUBTYPE_NULL)
     923                        sText += AtlFormatString(_T(" * ") _T("`subtype`: %s") _T("\r\n"), I(_FilterGraphHelper::FormatSubtype(pMediaType->majortype, pMediaType->subtype)));
     924                K1(bFixedSizeSamples);
     925                K1(bTemporalCompression);
     926                K1(lSampleSize);
     927                if(pMediaType->formattype != GUID_NULL)
     928                        sText += AtlFormatString(_T(" * ") _T("`formattype`: %s") _T("\r\n"), I(_FilterGraphHelper::FormatFormatType(pMediaType->formattype)));
     929                if(pMediaType->pUnk)
     930                        sText += AtlFormatString(_T(" * ") _T("`pUnk`: %s") _T("\r\n"), I(AtlFormatString(_T("0x%p"), pMediaType->pUnk)));
     931                if(pMediaType->cbFormat)
     932                {
     933                        K1(cbFormat);
     934                        if(pMediaType->pbFormat)
     935                                sText += AtlFormatString(_T(" * ") _T("Format Data, `pbFormat`: %s") _T("\r\n"), I(AtlFormatData(pMediaType->pbFormat, pMediaType->cbFormat).TrimRight()));
     936                }
     937                #undef J
     938                #undef K1
     939                #pragma endregion
     940                const BYTE* pnExtraData = NULL;
     941                SIZE_T nExtraDataSize = 0;
     942                #pragma region FORMAT_VideoInfo
     943                if(pMediaType->formattype == FORMAT_VideoInfo)
     944                {
     945                        sText += AtlFormatString(_T(" * ") _T("As `VIDEOINFOHEADER`:") _T("\r\n"));
     946                        const VIDEOINFOHEADER* pVideoInfoHeader = (const VIDEOINFOHEADER*) pMediaType->pbFormat;
     947                        #define J(x) I(pVideoInfoHeader->x)
     948                        #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
     949                        sText += AtlFormatString(_T("  * ") _T("`rcSource`: (%s, %s) - (%s, %s)") _T("\r\n"), J(rcSource.left), J(rcSource.top), J(rcSource.right), J(rcSource.bottom));
     950                        sText += AtlFormatString(_T("  * ") _T("`rcTarget`: (%s, %s) - (%s, %s)") _T("\r\n"), J(rcTarget.left), J(rcTarget.top), J(rcTarget.right), J(rcTarget.bottom));
     951                        K1(dwBitRate);
     952                        K1(dwBitErrorRate);
     953                        sText += AtlFormatString(_T("  * ") _T("`AvgTimePerFrame`: %s units") _T("\r\n"), I(_FilterGraphHelper::FormatReferenceTime(pVideoInfoHeader->AvgTimePerFrame)));
     954                        K1(bmiHeader.biSize);
     955                        K1(bmiHeader.biWidth);
     956                        K1(bmiHeader.biHeight);
     957                        K1(bmiHeader.biPlanes);
     958                        K1(bmiHeader.biBitCount);
     959                        sText += AtlFormatString(_T("  * ") _T("`bmiHeader.biCompression`: %s") _T("\r\n"), I(_FilterGraphHelper::GetFourccCodeString(pVideoInfoHeader->bmiHeader.biCompression)));
     960                        K1(bmiHeader.biSizeImage);
     961                        K1(bmiHeader.biXPelsPerMeter);
     962                        K1(bmiHeader.biYPelsPerMeter);
     963                        K1(bmiHeader.biClrUsed);
     964                        K1(bmiHeader.biClrImportant);
     965                        #undef J
     966                        #undef K1
     967                        nExtraDataSize = pMediaType->cbFormat - sizeof *pVideoInfoHeader;
     968                } else
     969                #pragma endregion
     970                #pragma region FORMAT_VideoInfo2
     971                if(pMediaType->formattype == FORMAT_VideoInfo2)
     972                {
     973                        sText += AtlFormatString(_T(" * ") _T("As `VIDEOINFOHEADER2`:") _T("\r\n"));
     974                        const VIDEOINFOHEADER2* pVideoInfoHeader2 = (const VIDEOINFOHEADER2*) pMediaType->pbFormat;
     975                        #define J(x) I(pVideoInfoHeader2->x)
     976                        #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
     977                        #define K2(x, y) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), I(pVideoInfoHeader2->x, y))
     978                        sText += AtlFormatString(_T("  * ") _T("rcSource: (%s, %s) - (%s, %s)") _T("\r\n"), J(rcSource.left), J(rcSource.top), J(rcSource.right), J(rcSource.bottom));
     979                        sText += AtlFormatString(_T("  * ") _T("rcTarget: (%s, %s) - (%s, %s)") _T("\r\n"), J(rcTarget.left), J(rcTarget.top), J(rcTarget.right), J(rcTarget.bottom));
     980                        K1(dwBitRate);
     981                        K1(dwBitErrorRate);
     982                        sText += AtlFormatString(_T("  * ") _T("`AvgTimePerFrame`: %s units") _T("\r\n"), I(_FilterGraphHelper::FormatReferenceTime(pVideoInfoHeader2->AvgTimePerFrame)));
     983                        K2(dwInterlaceFlags, _T("0x%X"));
     984                        K2(dwCopyProtectFlags, _T("0x%X"));
     985                        K1(dwPictAspectRatioX);
     986                        K1(dwPictAspectRatioY);
     987                        K2(dwControlFlags, _T("0x%X"));
     988                        K1(bmiHeader.biSize);
     989                        K1(bmiHeader.biWidth);
     990                        K1(bmiHeader.biHeight);
     991                        K1(bmiHeader.biPlanes);
     992                        K1(bmiHeader.biBitCount);
     993                        sText += AtlFormatString(_T("  * ") _T("`bmiHeader.biCompression`: %s") _T("\r\n"), I(_FilterGraphHelper::GetFourccCodeString(pVideoInfoHeader2->bmiHeader.biCompression)));
     994                        K1(bmiHeader.biSizeImage);
     995                        K1(bmiHeader.biXPelsPerMeter);
     996                        K1(bmiHeader.biYPelsPerMeter);
     997                        K1(bmiHeader.biClrUsed);
     998                        K1(bmiHeader.biClrImportant);
     999                        #undef J
     1000                        #undef K1
     1001                        #undef K2
     1002                        nExtraDataSize = pMediaType->cbFormat - sizeof *pVideoInfoHeader2;
     1003                        if(nExtraDataSize)
     1004                        {
     1005                                sText += AtlFormatString(_T("  * ") _T("Extra Data: (%d bytes)") _T("\r\n"), nExtraDataSize);
     1006                                nExtraDataSize = 0;
     1007                        }
     1008                } else
     1009                #pragma endregion
     1010                #pragma region FORMAT_MPEG2Video
     1011                if(pMediaType->formattype == FORMAT_MPEG2Video)
     1012                {
     1013                        sText += AtlFormatString(_T(" * ") _T("As `MPEG2VIDEOINFO`:") _T("\r\n"));
     1014                        const MPEG2VIDEOINFO* pMpeg2VideoInfo = (const MPEG2VIDEOINFO*) pMediaType->pbFormat;
     1015                        #define J(x) I(pMpeg2VideoInfo->x)
     1016                        #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
     1017                        #define K2(x, y) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), I(pMpeg2VideoInfo->x, y))
     1018                        sText += AtlFormatString(_T("  * ") _T("`hdr.rcSource`: (%s, %s) - (%s, %s)") _T("\r\n"), J(hdr.rcSource.left), J(hdr.rcSource.top), J(hdr.rcSource.right), J(hdr.rcSource.bottom));
     1019                        sText += AtlFormatString(_T("  * ") _T("`hdr.rcTarget`: (%s, %s) - (%s, %s)") _T("\r\n"), J(hdr.rcTarget.left), J(hdr.rcTarget.top), J(hdr.rcTarget.right), J(hdr.rcTarget.bottom));
     1020                        K1(hdr.dwBitRate);
     1021                        K1(hdr.dwBitErrorRate);
     1022                        sText += AtlFormatString(_T("  * ") _T("`hdr.AvgTimePerFrame`: %s") _T("\r\n"), I(_FilterGraphHelper::FormatReferenceTime(pMpeg2VideoInfo->hdr.AvgTimePerFrame)));
     1023                        K2(hdr.dwInterlaceFlags, _T("0x%X"));
     1024                        K2(hdr.dwCopyProtectFlags, _T("0x%X"));
     1025                        K1(hdr.dwPictAspectRatioX);
     1026                        K1(hdr.dwPictAspectRatioY);
     1027                        K2(hdr.dwControlFlags, _T("0x%X"));
     1028                        K1(hdr.bmiHeader.biSize);
     1029                        K1(hdr.bmiHeader.biWidth);
     1030                        K1(hdr.bmiHeader.biHeight);
     1031                        K1(hdr.bmiHeader.biPlanes);
     1032                        K1(hdr.bmiHeader.biBitCount);
     1033                        sText += AtlFormatString(_T("  * ") _T("`hdr.bmiHeader.biCompression`: %s") _T("\r\n"), I(_FilterGraphHelper::GetFourccCodeString(pMpeg2VideoInfo->hdr.bmiHeader.biCompression)));
     1034                        K1(hdr.bmiHeader.biSizeImage);
     1035                        K1(hdr.bmiHeader.biXPelsPerMeter);
     1036                        K1(hdr.bmiHeader.biYPelsPerMeter);
     1037                        K1(hdr.bmiHeader.biClrUsed);
     1038                        K1(hdr.bmiHeader.biClrImportant);
     1039                        K2(dwStartTimeCode, _T("0x%08X"));
     1040                        K1(cbSequenceHeader);
     1041                        K1(dwProfile);
     1042                        K1(dwLevel);
     1043                        K2(dwFlags, _T("0x%08X"));
     1044                        #undef J
     1045                        #undef K1
     1046                        #undef K2
     1047                        #undef J
     1048                        nExtraDataSize = pMediaType->cbFormat - (sizeof *pMpeg2VideoInfo - sizeof pMpeg2VideoInfo->dwSequenceHeader);
     1049                } else
     1050                #pragma endregion
     1051                #pragma region FORMAT_WaveFormatEx
     1052                if(pMediaType->formattype == FORMAT_WaveFormatEx)
     1053                {
     1054                        const WAVEFORMATEX* pWaveFormatEx = (const WAVEFORMATEX*) pMediaType->pbFormat;
     1055                        if(pWaveFormatEx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
     1056                        {
     1057                                const WAVEFORMATEXTENSIBLE* pWaveFormatExtensible = (const WAVEFORMATEXTENSIBLE*) pMediaType->pbFormat;
     1058                                #define J(x) I(pWaveFormatExtensible->x)
     1059                                #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
     1060                                #define K2(x, y) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), I(pWaveFormatExtensible->x, y))
     1061                                sText += AtlFormatString(_T(" * ") _T("As `WAVEFORMATEXTENSIBLE`:") _T("\r\n"));
     1062                                K2(Format.wFormatTag, _T("0x%02X"));
     1063                                K1(Format.nChannels);
     1064                                K1(Format.nSamplesPerSec);
     1065                                K1(Format.nAvgBytesPerSec);
     1066                                K1(Format.nBlockAlign);
     1067                                K1(Format.wBitsPerSample);
     1068                                K1(Format.cbSize);
     1069                                K1(Samples.wValidBitsPerSample);
     1070                                K2(dwChannelMask, _T("0x%02X"));
     1071                                sText += AtlFormatString(_T("  * ") _T("`SubFormat`: %s") _T("\r\n"), I(_PersistHelper::StringFromIdentifier(pWaveFormatExtensible->SubFormat)));
     1072                                #undef J
     1073                                #undef K1
     1074                                #undef K2
     1075                                nExtraDataSize = pWaveFormatEx->cbSize - (sizeof *pWaveFormatExtensible - sizeof *pWaveFormatEx);
     1076                        } else
     1077                        {
     1078                                #define J(x) I(pWaveFormatEx->x)
     1079                                #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
     1080                                #define K2(x, y) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), I(pWaveFormatEx->x, y))
     1081                                K2(wFormatTag, _T("0x%02X"));
     1082                                K1(nChannels);
     1083                                K1(nSamplesPerSec);
     1084                                K1(nAvgBytesPerSec);
     1085                                K1(nBlockAlign);
     1086                                K1(wBitsPerSample);
     1087                                K1(cbSize);
     1088                                #undef J
     1089                                #undef K1
     1090                                #undef K2
     1091                                nExtraDataSize = pWaveFormatEx->cbSize;
     1092                        }
     1093                }
     1094                #pragma endregion
     1095                #pragma region Extra Data
     1096                if(nExtraDataSize)
     1097                {
     1098                        if(!pnExtraData)
     1099                                pnExtraData = pMediaType->pbFormat + pMediaType->cbFormat - nExtraDataSize;
     1100                        sText += AtlFormatString(_T("  * ") _T("Extra Data: %s") _T("\r\n"), I(AtlFormatData(pnExtraData, nExtraDataSize).TrimRight()));
     1101                }
     1102                #pragma endregion
     1103                return sText;
     1104        }
    1781105        static CString GetText(IFilterGraph* pFilterGraph, const CProcessData* pProcessData = NULL)
    1791106        {
     
    2491176                                        const CComPtr<IBaseFilter>& pBaseFilter = FilterArray[nIndex];
    2501177                                        sText += AtlFormatString(_T("%d. ") _T("%ls") _T("\r\n"), nIndex + 1, _FilterGraphHelper::GetFilterName(pBaseFilter));
    251                                         const CStringW sClassIdentifierString = _FilterGraphHelper::GetFilterClassIdentifierString(pBaseFilter);
    252                                         if(!sClassIdentifierString.IsEmpty())
    253                                                 sText += AtlFormatString(_T(" * ") _T("Class: %s %s") _T("\r\n"), I(sClassIdentifierString), I(_FilterGraphHelper::GetFilterClassDescription(pBaseFilter)));
    254                                         _FilterGraphHelper::CPinArray InputPinArray;
    255                                         if(_FilterGraphHelper::GetFilterPins(pBaseFilter, PINDIR_INPUT, InputPinArray))
    256                                                 sText += AtlFormatString(_T(" * ") _T("Input Pins: %s") _T("\r\n"), FormatPins(InputPinArray));
    257                                         _FilterGraphHelper::CPinArray OutputPinArray;
    258                                         if(_FilterGraphHelper::GetFilterPins(pBaseFilter, PINDIR_OUTPUT, OutputPinArray))
    259                                                 sText += AtlFormatString(_T(" * ") _T("Output Pins: %s") _T("\r\n"), FormatPins(OutputPinArray));
    260                                         #pragma region IReferenceClock
    261                                         const CComQIPtr<IReferenceClock> pReferenceClock = pBaseFilter;
    262                                         if(pReferenceClock)
    263                                         {
    264                                                 CRoArrayT<CString> Array;
    265                                                 Array.Add(I(_T("Available")));
    266                                                 if(pReferenceClock == pFilterGraphReferenceClock)
    267                                                         Array.Add(I(_T("Selected")));
    268                                                 sText += AtlFormatString(_T(" * ") _T("Reference Clock: %s") _T("\r\n"), _StringHelper::Join(Array, _T(", ")));
    269                                         }
    270                                         #pragma endregion
    271                                         #pragma region IFileSourceFilter
    272                                         const CComQIPtr<IFileSourceFilter> pFileSourceFilter = pBaseFilter;
    273                                         if(pFileSourceFilter)
    274                                                 _ATLTRY
    275                                                 {
    276                                                         CComHeapPtr<OLECHAR> pszFileName;
    277                                                         CMediaType pMediaType;
    278                                                         pMediaType.Allocate(MEDIATYPE_NULL, MEDIASUBTYPE_NULL);
    279                                                         const HRESULT nGetCurFileResult = pFileSourceFilter->GetCurFile(&pszFileName, pMediaType);
    280                                                         _Z45_DSHRESULT(nGetCurFileResult);
    281                                                         if(SUCCEEDED(nGetCurFileResult))
    282                                                                 sText += AtlFormatString(_T(" * ") _T("File Source: %s") _T("\r\n"), I(pszFileName));
    283                                                 }
    284                                                 _ATLCATCHALL()
    285                                                 {
    286                                                         _Z_EXCEPTION();
    287                                                 }
    288                                         #pragma endregion
    289                                         #pragma region IFileSinkFilter
    290                                         const CComQIPtr<IFileSinkFilter> pFileSinkFilter = pBaseFilter;
    291                                         if(pFileSinkFilter)
    292                                                 _ATLTRY
    293                                                 {
    294                                                         CComHeapPtr<OLECHAR> pszFileName;
    295                                                         CMediaType pMediaType;
    296                                                         pMediaType.Allocate(MEDIATYPE_NULL, MEDIASUBTYPE_NULL);
    297                                                         const HRESULT nGetCurFileResult = pFileSinkFilter->GetCurFile(&pszFileName, pMediaType);
    298                                                         _Z45_DSHRESULT(nGetCurFileResult);
    299                                                         if(SUCCEEDED(nGetCurFileResult))
    300                                                                 sText += AtlFormatString(_T(" * ") _T("File Sink: %s") _T("\r\n"), I(pszFileName));
    301                                                 }
    302                                                 _ATLCATCHALL()
    303                                                 {
    304                                                         _Z_EXCEPTION();
    305                                                 }
    306                                         #pragma endregion
    307                                         #pragma region IAMCrossbar
    308                                         const CComQIPtr<IAMCrossbar> pAmCrossbar = pBaseFilter;
    309                                         if(pAmCrossbar)
    310                                                 _ATLTRY
    311                                                 {
    312                                                         sText += AtlFormatString(_T(" * ") _T("Crossbar:") _T("\r\n"));
    313                                                         LONG nOutputPinCount = 0, nInputPinCount = 0;
    314                                                         __C(pAmCrossbar->get_PinCounts(&nOutputPinCount, &nInputPinCount));
    315                                                         sText += AtlFormatString(_T("  * ") _T("Pins: %s Input, %s Output") _T("\r\n"), I(nInputPinCount), I(nOutputPinCount));
    316                                                         #pragma region Input
    317                                                         for(LONG nInputPinIndex = 0; nInputPinIndex < nInputPinCount; nInputPinIndex++)
    318                                                                 _ATLTRY
    319                                                                 {
    320                                                                         CRoArrayT<CString> Array;
    321                                                                         LONG nRelatedPinIndex = -1;
    322                                                                         LONG nPhysicalType = 0; // PhysicalConnectorType
    323                                                                         __C(pAmCrossbar->get_CrossbarPinInfo(TRUE, nInputPinIndex, &nRelatedPinIndex, &nPhysicalType));
    324                                                                         if(nRelatedPinIndex >= 0)
    325                                                                                 Array.Add(AtlFormatString(_T("Related %s"), I(nRelatedPinIndex)));
    326                                                                         Array.Add(AtlFormatString(_T("Physical Type %s"), I(FormatPhysicalConnectorType((PhysicalConnectorType) nPhysicalType))));
    327                                                                         sText += AtlFormatString(_T("  * ") _T("Input Pin %s: %s") _T("\r\n"), I(nInputPinIndex), _StringHelper::Join(Array, _T("; ")));
    328                                                                 }
    329                                                                 _ATLCATCHALL()
    330                                                                 {
    331                                                                         _Z_EXCEPTION();
    332                                                                 }
    333                                                         #pragma endregion
    334                                                         #pragma region Output
    335                                                         for(LONG nOutputPinIndex = 0; nOutputPinIndex < nOutputPinCount; nOutputPinIndex++)
    336                                                                 _ATLTRY
    337                                                                 {
    338                                                                         CRoArrayT<CString> Array;
    339                                                                         LONG nRelatedPinIndex = -1;
    340                                                                         LONG nPhysicalType = 0; // PhysicalConnectorType
    341                                                                         __C(pAmCrossbar->get_CrossbarPinInfo(FALSE, nOutputPinIndex, &nRelatedPinIndex, &nPhysicalType));
    342                                                                         if(nRelatedPinIndex >= 0)
    343                                                                                 Array.Add(AtlFormatString(_T("Related %s"), I(nRelatedPinIndex)));
    344                                                                         if(nPhysicalType > 0)
    345                                                                                 Array.Add(AtlFormatString(_T("Physical Type %s"), I(FormatPhysicalConnectorType((PhysicalConnectorType) nPhysicalType))));
    346                                                                         LONG nRoutedInputPinIndex = -1;
    347                                                                         const HRESULT nGetIsRoutedToResult = pAmCrossbar->get_IsRoutedTo(nOutputPinIndex, &nRoutedInputPinIndex);
    348                                                                         _A(nGetIsRoutedToResult == S_OK || nRoutedInputPinIndex == -1);
    349                                                                         if(nRoutedInputPinIndex >= 0)
    350                                                                                 Array.Add(AtlFormatString(_T("Routed to Input Pin %s"), I(nRoutedInputPinIndex)));
    351                                                                         CRoArrayT<CString> PinArray;
    352                                                                         for(LONG nInputPinIndex = 0; nInputPinIndex < nInputPinCount; nInputPinIndex++)
    353                                                                         {
    354                                                                                 const HRESULT nCanRouteResult = pAmCrossbar->CanRoute(nOutputPinIndex, nInputPinIndex);
    355                                                                                 if(nCanRouteResult == S_OK)
    356                                                                                         PinArray.Add(I(nInputPinIndex));
    357                                                                         }
    358                                                                         if(!PinArray.IsEmpty())
    359                                                                                 Array.Add(AtlFormatString(_T("Routeable to Input Pins %s"), _StringHelper::Join(PinArray, _T(", "))));
    360                                                                         sText += AtlFormatString(_T("  * ") _T("Output Pin %s: %s") _T("\r\n"), I(nOutputPinIndex), _StringHelper::Join(Array, _T("; ")));
    361                                                                 }
    362                                                                 _ATLCATCHALL()
    363                                                                 {
    364                                                                         _Z_EXCEPTION();
    365                                                                 }
    366                                                         #pragma endregion
    367                                                 }
    368                                                 _ATLCATCHALL()
    369                                                 {
    370                                                         _Z_EXCEPTION();
    371                                                 }
    372                                         #pragma endregion
     1178                                        sText += GetFilterText(pBaseFilter, pFilterGraphReferenceClock);
    3731179                                }
    3741180                                _ATLCATCHALL()
     
    3851191                                _FilterGraphHelper::CPinArray PinArray;
    3861192                                _FilterGraphHelper::GetFilterPins(pBaseFilter, PINDIR_OUTPUT, PinArray);
    387                                 for(SIZE_T nPinIndex  = 0; nPinIndex < PinArray.GetCount(); nPinIndex++)
     1193                                for(SIZE_T nPinIndex = 0; nPinIndex < PinArray.GetCount(); nPinIndex++)
    3881194                                {
    3891195                                        const CComPtr<IPin>& pOutputPin = PinArray[nPinIndex];
     
    3911197                                        if(!pInputPin)
    3921198                                                continue;
    393                                         CString sConnectionText = AtlFormatString(_T("%s - %s"), I(_FilterGraphHelper::GetPinFullName(pOutputPin)), I(_FilterGraphHelper::GetPinFullName(pInputPin)));
    394                                         _ATLTRY
    395                                         {
    396                                                 const CMediaType pMediaType = _FilterGraphHelper::GetPinMediaType(pOutputPin);
    397                                                 if(pMediaType)
    398                                                 {
    399                                                         CStringW sMajorType = _FilterGraphHelper::FormatMajorType(pMediaType->majortype);
    400                                                         CStringW sSubtype;
    401                                                         if(pMediaType->subtype != MEDIASUBTYPE_NULL)
    402                                                                 sSubtype = _FilterGraphHelper::FormatSubtype(pMediaType->majortype, pMediaType->subtype);
    403                                                         CRoArrayT<CString> Array;
    404                                                         Array.Add(I(sMajorType));
    405                                                         Array.Add(I(sSubtype));
    406                                                         #pragma region MEDIATYPE_Video
    407                                                         if(pMediaType->majortype == MEDIATYPE_Video)
    408                                                         {
    409                                                                 const CVideoInfoHeader2 VideoInfoHeader2 = pMediaType.GetCompatibleVideoInfoHeader2();
    410                                                                 const CSize Extent = VideoInfoHeader2.GetExtent();
    411                                                                 if(Extent.cx || Extent.cy)
    412                                                                         Array.Add(AtlFormatString(_T("%s x %s"), I(Extent.cx), I(Extent.cy)));
    413                                                         } else
    414                                                         #pragma endregion
    415                                                         #pragma region MEDIATYPE_Audio
    416                                                         if(pMediaType->majortype == MEDIATYPE_Audio)
    417                                                         {
    418                                                                 const CWaveFormatEx* pWaveFormatEx = pMediaType.GetWaveFormatEx();
    419                                                                 if(pWaveFormatEx)
    420                                                                 {
    421                                                                         if(pWaveFormatEx->nSamplesPerSec)
    422                                                                                 Array.Add(AtlFormatString(_T("%s Hz"), I(pWaveFormatEx->nSamplesPerSec)));
    423                                                                         if(pWaveFormatEx->nChannels)
    424                                                                                 Array.Add(AtlFormatString(_T("%s channels"), I(pWaveFormatEx->nChannels)));
    425                                                                         if(pWaveFormatEx->wBitsPerSample)
    426                                                                                 Array.Add(AtlFormatString(_T("%s bits"), I(pWaveFormatEx->wBitsPerSample)));
    427                                                                 }
    428                                                         }
    429                                                         #pragma endregion
    430                                                         sConnectionText += AtlFormatString(_T(" (%s)"), _StringHelper::Join(Array, _T(", ")));
    431                                                 }
    432                                         }
    433                                         _ATLCATCHALL()
    434                                         {
    435                                                 _Z_EXCEPTION();
    436                                         }
    437                                         sText += AtlFormatString(_T("%d. ") _T("%s") _T("\r\n"), ++nConnectionIndex, sConnectionText);
     1199                                        sText += AtlFormatString(_T("%d. ") _T("%s") _T("\r\n"), ++nConnectionIndex, GetConnectionText(pOutputPin, pInputPin));
    4381200                                }
    4391201                        }
     
    4491211                                _FilterGraphHelper::CPinArray PinArray;
    4501212                                _FilterGraphHelper::GetFilterPins(pBaseFilter, PinArray);
    451                                 for(SIZE_T nPinIndex  = 0; nPinIndex < PinArray.GetCount(); nPinIndex++)
     1213                                for(SIZE_T nPinIndex = 0; nPinIndex < PinArray.GetCount(); nPinIndex++)
    4521214                                {
    4531215                                        const CComPtr<IPin>& pPin = PinArray[nPinIndex];
     
    4721234                                                if(!pMediaType)
    4731235                                                        continue;
    474                                                 #pragma region AM_MEDIA_TYPE
    475                                                 #define J(x) I(pMediaType->x)
    476                                                 #define K1(x) sText += AtlFormatString(_T(" * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
    477                                                 sText += AtlFormatString(_T(" * ") _T("Data: %s") _T("\r\n"), I(AtlFormatData((const BYTE*) (const AM_MEDIA_TYPE*) pMediaType, sizeof *pMediaType).TrimRight()));
    478                                                 sText += AtlFormatString(_T(" * ") _T("`majortype`: %s") _T("\r\n"), I(_FilterGraphHelper::FormatMajorType(pMediaType->majortype)));
    479                                                 if(pMediaType->subtype != MEDIASUBTYPE_NULL)
    480                                                         sText += AtlFormatString(_T(" * ") _T("`subtype`: %s") _T("\r\n"), I(_FilterGraphHelper::FormatSubtype(pMediaType->majortype, pMediaType->subtype)));
    481                                                 K1(bFixedSizeSamples);
    482                                                 K1(bTemporalCompression);
    483                                                 K1(lSampleSize);
    484                                                 if(pMediaType->formattype != GUID_NULL)
    485                                                         sText += AtlFormatString(_T(" * ") _T("`formattype`: %s") _T("\r\n"), I(_FilterGraphHelper::FormatFormatType(pMediaType->formattype)));
    486                                                 if(pMediaType->pUnk)
    487                                                         sText += AtlFormatString(_T(" * ") _T("`pUnk`: %s") _T("\r\n"), I(AtlFormatString(_T("0x%p"), pMediaType->pUnk)));
    488                                                 if(pMediaType->cbFormat)
    489                                                 {
    490                                                         K1(cbFormat);
    491                                                         if(pMediaType->pbFormat)
    492                                                                 sText += AtlFormatString(_T(" * ") _T("Format Data, `pbFormat`: %s") _T("\r\n"), I(AtlFormatData(pMediaType->pbFormat, pMediaType->cbFormat).TrimRight()));
    493                                                 }
    494                                                 #undef J
    495                                                 #undef K1
    496                                                 #pragma endregion
    497                                                 const BYTE* pnExtraData = NULL;
    498                                                 SIZE_T nExtraDataSize = 0;
    499                                                 #pragma region FORMAT_VideoInfo
    500                                                 if(pMediaType->formattype == FORMAT_VideoInfo)
    501                                                 {
    502                                                         sText += AtlFormatString(_T(" * ") _T("As `VIDEOINFOHEADER`:") _T("\r\n"));
    503                                                         const VIDEOINFOHEADER* pVideoInfoHeader = (const VIDEOINFOHEADER*) pMediaType->pbFormat;
    504                                                         #define J(x) I(pVideoInfoHeader->x)
    505                                                         #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
    506                                                         sText += AtlFormatString(_T("  * ") _T("`rcSource`: (%s, %s) - (%s, %s)") _T("\r\n"), J(rcSource.left), J(rcSource.top), J(rcSource.right), J(rcSource.bottom));
    507                                                         sText += AtlFormatString(_T("  * ") _T("`rcTarget`: (%s, %s) - (%s, %s)") _T("\r\n"), J(rcTarget.left), J(rcTarget.top), J(rcTarget.right), J(rcTarget.bottom));
    508                                                         K1(dwBitRate);
    509                                                         K1(dwBitErrorRate);
    510                                                         sText += AtlFormatString(_T("  * ") _T("`AvgTimePerFrame`: %s units") _T("\r\n"), I(_FilterGraphHelper::FormatReferenceTime(pVideoInfoHeader->AvgTimePerFrame)));
    511                                                         K1(bmiHeader.biSize);
    512                                                         K1(bmiHeader.biWidth);
    513                                                         K1(bmiHeader.biHeight);
    514                                                         K1(bmiHeader.biPlanes);
    515                                                         K1(bmiHeader.biBitCount);
    516                                                         sText += AtlFormatString(_T("  * ") _T("`bmiHeader.biCompression`: %s") _T("\r\n"), I(_FilterGraphHelper::GetFourccCodeString(pVideoInfoHeader->bmiHeader.biCompression)));
    517                                                         K1(bmiHeader.biSizeImage);
    518                                                         K1(bmiHeader.biXPelsPerMeter);
    519                                                         K1(bmiHeader.biYPelsPerMeter);
    520                                                         K1(bmiHeader.biClrUsed);
    521                                                         K1(bmiHeader.biClrImportant);
    522                                                         #undef J
    523                                                         #undef K1
    524                                                         nExtraDataSize = pMediaType->cbFormat - sizeof *pVideoInfoHeader;
    525                                                 } else
    526                                                 #pragma endregion
    527                                                 #pragma region FORMAT_VideoInfo2
    528                                                 if(pMediaType->formattype == FORMAT_VideoInfo2)
    529                                                 {
    530                                                         sText += AtlFormatString(_T(" * ") _T("As `VIDEOINFOHEADER2`:") _T("\r\n"));
    531                                                         const VIDEOINFOHEADER2* pVideoInfoHeader2 = (const VIDEOINFOHEADER2*) pMediaType->pbFormat;
    532                                                         #define J(x) I(pVideoInfoHeader2->x)
    533                                                         #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
    534                                                         #define K2(x, y) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), I(pVideoInfoHeader2->x, y))
    535                                                         sText += AtlFormatString(_T("  * ") _T("rcSource: (%s, %s) - (%s, %s)") _T("\r\n"), J(rcSource.left), J(rcSource.top), J(rcSource.right), J(rcSource.bottom));
    536                                                         sText += AtlFormatString(_T("  * ") _T("rcTarget: (%s, %s) - (%s, %s)") _T("\r\n"), J(rcTarget.left), J(rcTarget.top), J(rcTarget.right), J(rcTarget.bottom));
    537                                                         K1(dwBitRate);
    538                                                         K1(dwBitErrorRate);
    539                                                         sText += AtlFormatString(_T("  * ") _T("`AvgTimePerFrame`: %s units") _T("\r\n"), I(_FilterGraphHelper::FormatReferenceTime(pVideoInfoHeader2->AvgTimePerFrame)));
    540                                                         K2(dwInterlaceFlags, _T("0x%X"));
    541                                                         K2(dwCopyProtectFlags, _T("0x%X"));
    542                                                         K1(dwPictAspectRatioX);
    543                                                         K1(dwPictAspectRatioY);
    544                                                         K2(dwControlFlags, _T("0x%X"));
    545                                                         K1(bmiHeader.biSize);
    546                                                         K1(bmiHeader.biWidth);
    547                                                         K1(bmiHeader.biHeight);
    548                                                         K1(bmiHeader.biPlanes);
    549                                                         K1(bmiHeader.biBitCount);
    550                                                         sText += AtlFormatString(_T("  * ") _T("`bmiHeader.biCompression`: %s") _T("\r\n"), I(_FilterGraphHelper::GetFourccCodeString(pVideoInfoHeader2->bmiHeader.biCompression)));
    551                                                         K1(bmiHeader.biSizeImage);
    552                                                         K1(bmiHeader.biXPelsPerMeter);
    553                                                         K1(bmiHeader.biYPelsPerMeter);
    554                                                         K1(bmiHeader.biClrUsed);
    555                                                         K1(bmiHeader.biClrImportant);
    556                                                         #undef J
    557                                                         #undef K1
    558                                                         #undef K2
    559                                                         nExtraDataSize = pMediaType->cbFormat - sizeof *pVideoInfoHeader2;
    560                                                         if(nExtraDataSize)
    561                                                         {
    562                                                                 sText += AtlFormatString(_T("  * ") _T("Extra Data: (%d bytes)") _T("\r\n"), nExtraDataSize);
    563                                                                 nExtraDataSize = 0;
    564                                                         }
    565                                                 } else
    566                                                 #pragma endregion
    567                                                 #pragma region FORMAT_MPEG2Video
    568                                                 if(pMediaType->formattype == FORMAT_MPEG2Video)
    569                                                 {
    570                                                         sText += AtlFormatString(_T(" * ") _T("As `MPEG2VIDEOINFO`:") _T("\r\n"));
    571                                                         const MPEG2VIDEOINFO* pMpeg2VideoInfo = (const MPEG2VIDEOINFO*) pMediaType->pbFormat;
    572                                                         #define J(x) I(pMpeg2VideoInfo->x)
    573                                                         #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
    574                                                         #define K2(x, y) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), I(pMpeg2VideoInfo->x, y))
    575                                                         sText += AtlFormatString(_T("  * ") _T("`hdr.rcSource`: (%s, %s) - (%s, %s)") _T("\r\n"), J(hdr.rcSource.left), J(hdr.rcSource.top), J(hdr.rcSource.right), J(hdr.rcSource.bottom));
    576                                                         sText += AtlFormatString(_T("  * ") _T("`hdr.rcTarget`: (%s, %s) - (%s, %s)") _T("\r\n"), J(hdr.rcTarget.left), J(hdr.rcTarget.top), J(hdr.rcTarget.right), J(hdr.rcTarget.bottom));
    577                                                         K1(hdr.dwBitRate);
    578                                                         K1(hdr.dwBitErrorRate);
    579                                                         sText += AtlFormatString(_T("  * ") _T("`hdr.AvgTimePerFrame`: %s") _T("\r\n"), I(_FilterGraphHelper::FormatReferenceTime(pMpeg2VideoInfo->hdr.AvgTimePerFrame)));
    580                                                         K2(hdr.dwInterlaceFlags, _T("0x%X"));
    581                                                         K2(hdr.dwCopyProtectFlags, _T("0x%X"));
    582                                                         K1(hdr.dwPictAspectRatioX);
    583                                                         K1(hdr.dwPictAspectRatioY);
    584                                                         K2(hdr.dwControlFlags, _T("0x%X"));
    585                                                         K1(hdr.bmiHeader.biSize);
    586                                                         K1(hdr.bmiHeader.biWidth);
    587                                                         K1(hdr.bmiHeader.biHeight);
    588                                                         K1(hdr.bmiHeader.biPlanes);
    589                                                         K1(hdr.bmiHeader.biBitCount);
    590                                                         sText += AtlFormatString(_T("  * ") _T("`hdr.bmiHeader.biCompression`: %s") _T("\r\n"), I(_FilterGraphHelper::GetFourccCodeString(pMpeg2VideoInfo->hdr.bmiHeader.biCompression)));
    591                                                         K1(hdr.bmiHeader.biSizeImage);
    592                                                         K1(hdr.bmiHeader.biXPelsPerMeter);
    593                                                         K1(hdr.bmiHeader.biYPelsPerMeter);
    594                                                         K1(hdr.bmiHeader.biClrUsed);
    595                                                         K1(hdr.bmiHeader.biClrImportant);
    596                                                         K2(dwStartTimeCode, _T("0x%08X"));
    597                                                         K1(cbSequenceHeader);
    598                                                         K1(dwProfile);
    599                                                         K1(dwLevel);
    600                                                         K2(dwFlags, _T("0x%08X"));
    601                                                         #undef J
    602                                                         #undef K1
    603                                                         #undef K2
    604                                                         #undef J
    605                                                         nExtraDataSize = pMediaType->cbFormat - (sizeof *pMpeg2VideoInfo - sizeof pMpeg2VideoInfo->dwSequenceHeader);
    606                                                 } else
    607                                                 #pragma endregion
    608                                                 #pragma region FORMAT_WaveFormatEx
    609                                                 if(pMediaType->formattype == FORMAT_WaveFormatEx)
    610                                                 {
    611                                                         const WAVEFORMATEX* pWaveFormatEx = (const WAVEFORMATEX*) pMediaType->pbFormat;
    612                                                         if(pWaveFormatEx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
    613                                                         {
    614                                                                 const WAVEFORMATEXTENSIBLE* pWaveFormatExtensible = (const WAVEFORMATEXTENSIBLE*) pMediaType->pbFormat;
    615                                                                 #define J(x) I(pWaveFormatExtensible->x)
    616                                                                 #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
    617                                                                 #define K2(x, y) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), I(pWaveFormatExtensible->x, y))
    618                                                                 sText += AtlFormatString(_T(" * ") _T("As `WAVEFORMATEXTENSIBLE`:") _T("\r\n"));
    619                                                                 K2(Format.wFormatTag, _T("0x%02X"));
    620                                                                 K1(Format.nChannels);
    621                                                                 K1(Format.nSamplesPerSec);
    622                                                                 K1(Format.nAvgBytesPerSec);
    623                                                                 K1(Format.nBlockAlign);
    624                                                                 K1(Format.wBitsPerSample);
    625                                                                 K1(Format.cbSize);
    626                                                                 K1(Samples.wValidBitsPerSample);
    627                                                                 K2(dwChannelMask, _T("0x%02X"));
    628                                                                 sText += AtlFormatString(_T("  * ") _T("`SubFormat`: %s") _T("\r\n"), I(_PersistHelper::StringFromIdentifier(pWaveFormatExtensible->SubFormat)));
    629                                                                 #undef J
    630                                                                 #undef K1
    631                                                                 #undef K2
    632                                                                 nExtraDataSize = pWaveFormatEx->cbSize - (sizeof *pWaveFormatExtensible - sizeof *pWaveFormatEx);
    633                                                         } else
    634                                                         {
    635                                                                 #define J(x) I(pWaveFormatEx->x)
    636                                                                 #define K1(x) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
    637                                                                 #define K2(x, y) sText += AtlFormatString(_T("  * `") _T(#x) _T("`: %s") _T("\r\n"), I(pWaveFormatEx->x, y))
    638                                                                 K2(wFormatTag, _T("0x%02X"));
    639                                                                 K1(nChannels);
    640                                                                 K1(nSamplesPerSec);
    641                                                                 K1(nAvgBytesPerSec);
    642                                                                 K1(nBlockAlign);
    643                                                                 K1(wBitsPerSample);
    644                                                                 K1(cbSize);
    645                                                                 #undef J
    646                                                                 #undef K1
    647                                                                 #undef K2
    648                                                                 nExtraDataSize = pWaveFormatEx->cbSize;
    649                                                         }
    650                                                 }
    651                                                 #pragma endregion
    652                                                 #pragma region Extra Data
    653                                                 if(nExtraDataSize)
    654                                                 {
    655                                                         if(!pnExtraData)
    656                                                                 pnExtraData = pMediaType->pbFormat + pMediaType->cbFormat - nExtraDataSize;
    657                                                         sText += AtlFormatString(_T("  * ") _T("Extra Data: %s") _T("\r\n"), I(AtlFormatData(pnExtraData, nExtraDataSize).TrimRight()));
    658                                                 }
    659                                                 #pragma endregion
     1236                                                sText += GetMediaTypeText(pMediaType);
    6601237                                        }
    6611238                                        _ATLCATCHALL()
     
    6721249        }
    6731250        #undef I
     1251        CComPtr<IFilterGraph> GetFilterGraph() const
     1252        {
     1253                CRoCriticalSectionLock DataLock(m_DataCriticalSection);
     1254                return m_pFilterGraph;
     1255        }
     1256        VOID SetFilterGraph(IFilterGraph* pFilterGraph)
     1257        {
     1258                CRoCriticalSectionLock DataLock(m_DataCriticalSection);
     1259                m_pFilterGraph = pFilterGraph;
     1260        }
     1261        CString GetText() const
     1262        {
     1263                CRoCriticalSectionLock DataLock(m_DataCriticalSection);
     1264                return GetText(m_pFilterGraph);
     1265        }
    6741266
    6751267// IFilterGraphHelper
    676         STDMETHOD(get_FilterGraph)(IUnknown** ppFilterGraphUnknown) throw()
     1268        STDMETHOD(get_FilterGraph)(IUnknown** ppFilterGraphUnknown)
    6771269        {
    6781270                _Z4(atlTraceCOM, 4, _T("...\n"));
     
    6801272                {
    6811273                        __D(ppFilterGraphUnknown, E_POINTER);
    682                         CRoCriticalSectionLock DataLock(m_DataCriticalSection);
    683                         *ppFilterGraphUnknown = CComPtr<IUnknown>(m_pFilterGraph).Detach();
     1274                        *ppFilterGraphUnknown = GetFilterGraph().Detach();
    6841275                }
    6851276                _ATLCATCH(Exception)
     
    6891280                return S_OK;
    6901281        }
    691         STDMETHOD(put_FilterGraph)(IUnknown* pFilterGraphUnknown) throw()
     1282        STDMETHOD(put_FilterGraph)(IUnknown* pFilterGraphUnknown)
    6921283        {
    6931284                _Z4(atlTraceCOM, 4, _T("pFilterGraphUnknown 0x%p\n"), pFilterGraphUnknown);
     
    6961287                        const CComQIPtr<IFilterGraph> pFilterGraph = pFilterGraphUnknown;
    6971288                        __D(!pFilterGraphUnknown || pFilterGraph, E_INVALIDARG);
    698                         CRoCriticalSectionLock DataLock(m_DataCriticalSection);
    699                         m_pFilterGraph = pFilterGraph;
     1289                        SetFilterGraph(pFilterGraph);
    7001290                }
    7011291                _ATLCATCH(Exception)
     
    7051295                return S_OK;
    7061296        }
    707         STDMETHOD(get_Text)(BSTR* psText) throw()
     1297        STDMETHOD(get_Text)(BSTR* psText)
    7081298        {
    7091299                _Z4(atlTraceCOM, 4, _T("...\n"));
     
    7201310                return S_OK;
    7211311        }
     1312        STDMETHOD(DoPropertyFrameModal)(LONG nParentWindowHandle)
     1313        {
     1314                _Z4(atlTraceCOM, 4, _T("...\n"));
     1315                _ATLTRY
     1316                {
     1317                        CWindow ParentWindow = (HWND) (LONG_PTR) nParentWindowHandle;
     1318                        if(!ParentWindow)
     1319                                ParentWindow = GetActiveWindow();
     1320                        __D(!ParentWindow || ParentWindow.IsWindow(), E_INVALIDARG);
     1321                        const CComQIPtr<IFilterGraph2> pFilterGraph2 = GetFilterGraph();
     1322                        __D(pFilterGraph2, E_NOINTERFACE);
     1323                        CPropertyFrameDialog PropertyFrameDialog(this);
     1324                        PropertyFrameDialog.DoModal(ParentWindow);
     1325                }
     1326                _ATLCATCH(Exception)
     1327                {
     1328                        _C(Exception);
     1329                }
     1330                return S_OK;
     1331        }
    7221332};
    7231333
  • trunk/DirectShowSpy/FilterGraphList.h

    r201 r231  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2013
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    44
     
    5353                COMMAND_ID_HANDLER_EX(IDC_FILTERGRAPHLIST_LIST_CHECK, OnCheck)
    5454                COMMAND_ID_HANDLER_EX(IDC_FILTERGRAPHLIST_LIST_COPYTOCLIPBOARD, OnCopyToClipboard)
     55                COMMAND_ID_HANDLER_EX(IDC_FILTERGRAPHLIST_LIST_PROPERTIES, OnProperties)
    5556                REFLECT_NOTIFICATIONS()
    5657        END_MSG_MAP()
     
    6162                DLGRESIZE_CONTROL(IDC_FILTERGRAPHLIST_LIST_CHECK, DLSZ_MOVE_Y)
    6263                DLGRESIZE_CONTROL(IDC_FILTERGRAPHLIST_LIST_COPYTOCLIPBOARD, DLSZ_MOVE_Y)
     64                DLGRESIZE_CONTROL(IDC_FILTERGRAPHLIST_LIST_PROPERTIES, DLSZ_MOVE_Y)
    6365        END_DLGRESIZE_MAP()
    6466
     
    171173                CButton m_CheckButton;
    172174                CButton m_CopyToClipboardButton;
     175                CButton m_PropertiesButton;
    173176                CComPtr<IRunningObjectTable> m_pRunningObjectTable;
    174177
     
    181184                VOID UpdateControls()
    182185                {
    183                         m_CopyToClipboardButton.EnableWindow(m_GraphListView.GetSelectedCount() > 0);
     186                        const UINT nSelectedCount = m_GraphListView.GetSelectedCount();
     187                        m_CopyToClipboardButton.EnableWindow(nSelectedCount > 0);
     188                        m_PropertiesButton.EnableWindow(nSelectedCount == 1);
    184189                }
    185190                INT SortGraphListViewItems(LPARAM nItemParameter1, LPARAM nItemParameter2)
     
    329334                                m_CheckButton = GetDlgItem(IDC_FILTERGRAPHLIST_LIST_CHECK);
    330335                                m_CopyToClipboardButton = GetDlgItem(IDC_FILTERGRAPHLIST_LIST_COPYTOCLIPBOARD);
     336                                m_PropertiesButton = GetDlgItem(IDC_FILTERGRAPHLIST_LIST_PROPERTIES);
    331337                                DlgResize_Init(FALSE, FALSE);
    332338                                Refresh();
     
    442448                LRESULT OnGraphListViewDblClk(NMITEMACTIVATE* pHeader)
    443449                {
    444                         m_CheckButton.Click();
     450                        //m_CheckButton.Click();
     451                        m_PropertiesButton.Click();
    445452                        return 0;
    446453                }
     
    472479                        SetClipboardText(m_hWnd, sText);
    473480                        MessageBeep(MB_OK);
     481                        return 0;
     482                }
     483                LRESULT OnProperties(UINT, INT, HWND)
     484                {
     485                        const INT nItem = m_GraphListView.GetNextItem(-1, LVNI_SELECTED);
     486                        if(nItem < 0)
     487                                return 0;
     488                        CItem& Item = m_GraphListView.GetItemData(nItem);
     489                        if(!Item.FilterGraphNeeded(m_pRunningObjectTable))
     490                                return 0;
     491                        Item.Check();
     492                        CLocalObjectPtr<CFilterGraphHelper> pFilterGraphHelper;
     493                        pFilterGraphHelper->SetFilterGraph(Item.m_pFilterGraph);
     494                        _V(pFilterGraphHelper->DoPropertyFrameModal((LONG) (LONG_PTR) m_hWnd));
    474495                        return 0;
    475496                }
  • trunk/DirectShowSpy/FilterGraphSpy.cpp

    r193 r231  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2013
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    44
  • trunk/DirectShowSpy/GraphBuilderCallbackPropertySheet.h

    r193 r231  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2013
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    44
  • trunk/DirectShowSpy/Helper.cpp

    r199 r231  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2013
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    44
     
    66#include "resource.h"
    77#include "FilterGraphHelper.h"
     8
     9////////////////////////////////////////////////////////////
     10// Test
     11
     12#if _DEVELOPMENT
     13
     14COMPILER_MESSAGE("Development: CFilterGraphHelper::DoPropertyFrameModal as Test")
     15
     16#if defined(_WIN64)
     17        extern "C" __declspec(dllexport)
     18#else
     19        #pragma comment(linker, "/EXPORT:Test=_Test@0,PRIVATE")
     20        extern "C" // __declspec(dllexport)
     21#endif // defined(_WIN64)
     22
     23HRESULT STDMETHODCALLTYPE Test() throw()
     24{
     25        _ATLTRY
     26        {
     27                CSingleThreadedApartment SingleThreadedApartment;
     28                CGenericFilterGraph FilterGraph;
     29                FilterGraph.CoCreateInstance();
     30                __C(FilterGraph.m_pFilterGraph->RenderFile(_T("E:\\Media\\Robotica_1080.wmv"), NULL));
     31                CLocalObjectPtr<CFilterGraphHelper> pHelper;
     32                pHelper->SetFilterGraph(FilterGraph.m_pFilterGraph);
     33                pHelper->DoPropertyFrameModal(0);
     34        }
     35        _ATLCATCH(Exception)
     36        {
     37                _C(Exception);
     38        }
     39        return S_OK;
     40}
     41
     42#endif // _DEVELOPMENT
  • trunk/DirectShowSpy/resource.h

    r199 r231  
    1 //{{NO_DEPENDENCIES}}
     1//{{NO_DEPENDENCIES}}
    22// Microsoft Visual C++ generated include file.
    33// Used by DirectShowSpy.rc
     
    1414#define IDR_FILTERMAPPERSPY             202
    1515#define IDR_SYSTEMDEVICEENUMERATORSPY   203
     16#define IDC_BUTTON1                     218
    1617#define IDR_FILTERGRAPHHELPER           300
    1718#define IDS_REGISTRATION_PROPERTYSHEETCAPTION 900
     
    6465#define IDC_FILTERGRAPHLIST_LIST_CHECK  1411
    6566#define IDC_FILTERGRAPHLIST_LIST_COPYTOCLIPBOARD 1412
     67#define IDC_FILTERGRAPHLIST_LIST_PROPERTIES 1413
     68#define IDD_FILTERGRAPHHELPER_PROPERTYFRAME 1500
     69#define IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TREE 1505
     70#define IDC_FILTERGRAPHHELPER_PROPERTYFRAME_APPLY 1507
     71#define IDC_FILTERGRAPHHELPER_PROPERTYFRAME_TEXT 1508
    6672#define IDD_ABOUT                       29900
    6773#define IDC_ABOUT_ICON                  29901
     
    8288#define _APS_NEXT_RESOURCE_VALUE        209
    8389#define _APS_NEXT_COMMAND_VALUE         32768
    84 #define _APS_NEXT_CONTROL_VALUE         218
     90#define _APS_NEXT_CONTROL_VALUE         219
    8591#define _APS_NEXT_SYMED_VALUE           103
    8692#endif
Note: See TracChangeset for help on using the changeset viewer.