Ignore:
Timestamp:
Oct 16, 2012, 12:32:20 PM (10 years ago)
Author:
roman
Message:

better readability with V macro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/Miscellaneous/PlayMp3File/PlayMp3File.cpp

    r133 r138  
    1212#pragma comment(lib, "strmiids.lib")
    1313
     14#define V(x) ATLVERIFY(SUCCEEDED(x))
     15
    1416int _tmain(int argc, _TCHAR* argv[])
    1517{
    1618        static LPCTSTR g_pszPath = _T("F:\\Music\\Cher - Walking In Memphis.mp3");
    17         ATLVERIFY(SUCCEEDED(CoInitialize(NULL)));
     19        V(CoInitialize(NULL));
    1820        {
    1921                CComPtr<IGraphBuilder> pGraphBuilder;
    20                 ATLVERIFY(SUCCEEDED(pGraphBuilder.CoCreateInstance(CLSID_FilterGraph)));
     22                V(pGraphBuilder.CoCreateInstance(CLSID_FilterGraph));
    2123                // NOTE: A simpler version is good for the files you are sure of that they don't have too much of ID3 tags on the header:
    2224                //       with a large headers the files might be rejected; the longer versions takes all .MP3 files
    2325                #if TRUE
    2426                        CComPtr<IBaseFilter> pBaseFilter;
    25                         ATLVERIFY(SUCCEEDED(pBaseFilter.CoCreateInstance(CLSID_WMAsfReader)));
     27                        V(pBaseFilter.CoCreateInstance(CLSID_WMAsfReader));
    2628                        CComQIPtr<IFileSourceFilter> pFileSourceFilter = pBaseFilter;
    2729                        ATLASSERT(pFileSourceFilter);
    28                         ATLVERIFY(SUCCEEDED(pFileSourceFilter->Load(CT2COLE(g_pszPath), NULL)));
    29                         ATLVERIFY(SUCCEEDED(pGraphBuilder->AddFilter(pBaseFilter, NULL)));
     30                        V(pFileSourceFilter->Load(CT2COLE(g_pszPath), NULL));
     31                        V(pGraphBuilder->AddFilter(pBaseFilter, NULL));
    3032                        CComPtr<IEnumPins> pEnumPins;
    31                         ATLVERIFY(SUCCEEDED(pBaseFilter->EnumPins(&pEnumPins)));
     33                        V(pBaseFilter->EnumPins(&pEnumPins));
    3234                        CComPtr<IPin> pPin;
    3335                        ATLVERIFY(pEnumPins->Next(1, &pPin, NULL) == S_OK);
    34                         ATLVERIFY(SUCCEEDED(pGraphBuilder->Render(pPin)));
     36                        V(pGraphBuilder->Render(pPin));
    3537                #else
    36                         ATLVERIFY(SUCCEEDED(pGraphBuilder->RenderFile(CT2CW(g_pszPath), NULL)));
     38                        V(pGraphBuilder->RenderFile(CT2CW(g_pszPath), NULL)));
    3739                #endif
    3840                CComQIPtr<IMediaControl> pMediaControl = pGraphBuilder;
    3941                CComQIPtr<IMediaEvent> pMediaEvent = pGraphBuilder;
    4042                ATLASSERT(pMediaControl && pMediaEvent);
    41                 ATLVERIFY(SUCCEEDED(pMediaControl->Run()));
     43                V(pMediaControl->Run());
    4244                LONG nEventCode = 0;
    43                 ATLVERIFY(SUCCEEDED(pMediaEvent->WaitForCompletion(INFINITE, &nEventCode)));
     45                V(pMediaEvent->WaitForCompletion(INFINITE, &nEventCode));
    4446        }
    4547        CoUninitialize();
Note: See TracChangeset for help on using the changeset viewer.