Changeset 207


Ignore:
Timestamp:
Aug 9, 2013, 12:23:17 AM (11 years ago)
Author:
roman
Message:

Added crossbar information on textual filter graph representation

Location:
trunk/DirectShowSpy
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/DirectShowSpy/DirectShowSpy.rc

    r202 r207  
    6060
    6161VS_VERSION_INFO VERSIONINFO
    62  FILEVERSION  1, 0, 0, 980
     62 FILEVERSION  1, 0, 0, 988
    6363 PRODUCTVERSION 1,0,0,1
    6464 FILEFLAGSMASK 0x3fL
     
    7979            VALUE "CompanyName", "Roman Ryltsov"
    8080            VALUE "FileDescription", "Alax.Info DirectShow Spy Module"
    81             VALUE "FileVersion",  "1, 0, 0, 980\0"
     81            VALUE "FileVersion",  "1, 0, 0, 988\0"
    8282            VALUE "InternalName", "DirectShowSpy.dll"
    8383            VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2013"
  • trunk/DirectShowSpy/FilterGraphHelper.h

    r202 r207  
    121121        }
    122122        #define I FormatIdentifier
     123        static CString FormatPhysicalConnectorType(PhysicalConnectorType Value)
     124        {
     125                struct
     126                {
     127                        PhysicalConnectorType Value;
     128                        LPCSTR pszName;
     129                } g_pMap[] =
     130                {
     131                        #define A(x) { x, #x },
     132                        A(PhysConn_Video_Tuner)
     133                        A(PhysConn_Video_Composite)
     134                        A(PhysConn_Video_SVideo)
     135                        A(PhysConn_Video_RGB)
     136                        A(PhysConn_Video_YRYBY)
     137                        A(PhysConn_Video_SerialDigital)
     138                        A(PhysConn_Video_ParallelDigital)
     139                        A(PhysConn_Video_SCSI)
     140                        A(PhysConn_Video_AUX)
     141                        A(PhysConn_Video_1394)
     142                        A(PhysConn_Video_USB)
     143                        A(PhysConn_Video_VideoDecoder)
     144                        A(PhysConn_Video_VideoEncoder)
     145                        A(PhysConn_Video_SCART)
     146                        A(PhysConn_Video_Black)
     147                        A(PhysConn_Audio_Tuner)
     148                        A(PhysConn_Audio_Line)
     149                        A(PhysConn_Audio_Mic)
     150                        A(PhysConn_Audio_AESDigital)
     151                        A(PhysConn_Audio_SPDIFDigital)
     152                        A(PhysConn_Audio_SCSI)
     153                        A(PhysConn_Audio_AUX)
     154                        A(PhysConn_Audio_1394)
     155                        A(PhysConn_Audio_USB)
     156                        A(PhysConn_Audio_AudioDecoder)
     157                        #undef A
     158                };
     159                for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++)
     160                        if(g_pMap[nIndex].Value == Value)
     161                                return CString(g_pMap[nIndex].pszName);
     162                return AtlFormatString(_T("0x%04X"), Value);
     163        }
    123164        static CString FormatPins(_FilterGraphHelper::CPinArray& PinArray)
    124165        {
     
    231272                                        const CComQIPtr<IFileSourceFilter> pFileSourceFilter = pBaseFilter;
    232273                                        if(pFileSourceFilter)
    233                                         {
    234                                                 CComHeapPtr<OLECHAR> pszFileName;
    235                                                 CMediaType pMediaType;
    236                                                 pMediaType.Allocate(MEDIATYPE_NULL, MEDIASUBTYPE_NULL);
    237                                                 const HRESULT nGetCurFileResult = pFileSourceFilter->GetCurFile(&pszFileName, pMediaType);
    238                                                 _Z45_DSHRESULT(nGetCurFileResult);
    239                                                 if(SUCCEEDED(nGetCurFileResult))
    240                                                         sText += AtlFormatString(_T(" * ") _T("File Source: %s") _T("\r\n"), I(pszFileName));
    241                                         }
     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                                                }
    242288                                        #pragma endregion
    243289                                        #pragma region IFileSinkFilter
    244290                                        const CComQIPtr<IFileSinkFilter> pFileSinkFilter = pBaseFilter;
    245291                                        if(pFileSinkFilter)
    246                                         {
    247                                                 CComHeapPtr<OLECHAR> pszFileName;
    248                                                 CMediaType pMediaType;
    249                                                 pMediaType.Allocate(MEDIATYPE_NULL, MEDIASUBTYPE_NULL);
    250                                                 const HRESULT nGetCurFileResult = pFileSinkFilter->GetCurFile(&pszFileName, pMediaType);
    251                                                 _Z45_DSHRESULT(nGetCurFileResult);
    252                                                 if(SUCCEEDED(nGetCurFileResult))
    253                                                         sText += AtlFormatString(_T(" * ") _T("File Sink: %s") _T("\r\n"), I(pszFileName));
    254                                         }
     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                                                }
    255372                                        #pragma endregion
    256373                                }
Note: See TracChangeset for help on using the changeset viewer.