Changeset 295


Ignore:
Timestamp:
Jun 15, 2014, 7:30:53 AM (10 years ago)
Author:
roman
Message:

Small code refactoring and simulation of EC_DISPLAY_CHANGED event due to activity at "wrong" monitor

Location:
trunk/Utilities/RenderInterlacedVideo
Files:
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/RenderInterlacedVideo

    • Property svn:ignore
      •  

        old new  
        44*.aps
        55*.sdf
         6*.opensdf
  • trunk/Utilities/RenderInterlacedVideo/MainPropertySheet.h

    r76 r295  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2012
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
     
    1412#include <evr9.h>
    1513#include <dxva.h>
     14#import "libid:B9EC374B-834B-4DA9-BFB5-C1872CE736FF" raw_interfaces_only // AlaxInfoDirectShowSpy
    1615#include "rodshow.h"
     16
     17////////////////////////////////////////////////////////////
     18// CVrWindowT
     19
     20template <typename T>
     21class CVrWindowT
     22{
     23public:
     24// CVrWindowT
     25        VOID DoHelperModal(IUnknown* pUnknown, LPCTSTR pszCaption = NULL)
     26        {
     27                T* pT = static_cast<T*>(this);
     28                CComPtr<AlaxInfoDirectShowSpy::IFilterGraphHelper> pFilterGraphHelper;
     29                const HRESULT nCoCreateInstanceResult = pFilterGraphHelper.CoCreateInstance(__uuidof(AlaxInfoDirectShowSpy::FilterGraphHelper));
     30                if(SUCCEEDED(nCoCreateInstanceResult))
     31                {
     32                        __C(pFilterGraphHelper->put_FilterGraph(pUnknown));
     33                        __C(pFilterGraphHelper->DoPropertyFrameModal((LONG) (LONG_PTR) pT->m_hWnd));
     34                        return;
     35                }
     36                COlePropertyFrameDialog Dialog(pUnknown, pszCaption);
     37                Dialog.SetObjectPages();
     38                Dialog.DoModal(pT->m_hWnd);
     39        }
     40};
    1741
    1842////////////////////////////////////////////////////////////
     
    2044
    2145class CVmr7Window :
    22         public CControlWindowT<CVmr7Window>
     46        public CControlWindowT<CVmr7Window>,
     47        public CVrWindowT<CVmr7Window>
    2348{
    2449public:
     
    3964public:
    4065// CVmr7Window
    41         static CLSID GetRendererClassIdentifier() throw()
     66        static CLSID GetRendererClassIdentifier()
    4267        {
    4368                return CLSID_VideoMixingRenderer;
     
    6388                __D(m_pVmrWindowlessControl, E_NOINTERFACE);
    6489                __C(m_pVmrWindowlessControl->SetVideoClippingWindow(m_hWnd));
    65                 CRect VideoPosition = GetVideoPosition();
    66                 _Z4(atlTraceGeneral, 4, _T(".m_pVmrWindowlessControl 0x%p, VideoPosition at (%d, %d) size (%d, %d)\n"), m_pVmrWindowlessControl, VideoPosition.left, VideoPosition.top, VideoPosition.Width(), VideoPosition.Height());
    67                 __C(m_pVmrWindowlessControl->SetVideoPosition(NULL, VideoPosition));
    68         }
    69         VOID Terminate() throw()
     90                UpdateVideoPosition();
     91        }
     92        VOID Terminate()
    7093        {
    7194                m_pBaseFilter = NULL;
    7295                m_pVmrWindowlessControl = NULL;
    7396        }
    74         CRect GetVideoPosition() const throw()
     97        CRect GetVideoPosition() const
    7598        {
    7699                CRect Position;
    77100                _W(GetClientRect(Position));
    78101                return Position;
     102        }
     103        BOOL UpdateVideoPosition()
     104        {
     105                _A(m_pVmrWindowlessControl && IsWindow());
     106                CRect VideoPosition = GetVideoPosition();
     107                _Z4(atlTraceGeneral, 4, _T("m_pVmrWindowlessControl 0x%p, VideoPosition at (%d, %d) size (%d, %d)\n"), m_pVmrWindowlessControl, VideoPosition.left, VideoPosition.top, VideoPosition.Width(), VideoPosition.Height());
     108                const HRESULT nSetVideoPositionResult = m_pVmrWindowlessControl->SetVideoPosition(NULL, VideoPosition);
     109                __C(nSetVideoPositionResult); //_Z45_DSHRESULT(nSetVideoPositionResult);
     110                return SUCCEEDED(nSetVideoPositionResult);
    79111        }
    80112
     
    96128                        CPaintDC Dc(m_hWnd);
    97129                        const HRESULT nRepaintVideoResult = m_pVmrWindowlessControl->RepaintVideo(m_hWnd, Dc);
    98                         _Z4(atlTraceUI, SUCCEEDED(nRepaintVideoResult) ? 6 : 4, _T("nRepaintVideoResult 0x%08x\n"), nRepaintVideoResult);
     130                        _Z45_DSHRESULT(nRepaintVideoResult);
    99131                } else
    100132                        SetMsgHandled(FALSE);
     
    106138                {
    107139                        const HRESULT nDisplayModeChangedResult = m_pVmrWindowlessControl->DisplayModeChanged();
    108                         _Z4(atlTraceUI, 4, _T("nDisplayModeChangedResult 0x%08x\n"), nDisplayModeChangedResult);
     140                        _Z4_DSHRESULT(nDisplayModeChangedResult);
    109141                }
    110142                return 0;
     
    114146                if(nType != SIZE_MINIMIZED)
    115147                        if(m_pVmrWindowlessControl)
    116                         {
    117                                 CRect VideoPosition = GetVideoPosition();
    118                                 const HRESULT nSetVideoPositionResult = m_pVmrWindowlessControl->SetVideoPosition(NULL, &VideoPosition);
    119                                 _Z4(atlTraceUI, SUCCEEDED(nSetVideoPositionResult) ? 6 : 4, _T("nSetVideoPositionResult 0x%08x\n"), nSetVideoPositionResult);
    120                         }
     148                                UpdateVideoPosition();
    121149                return 0;
    122150        }
    123151        LRESULT OnLButtonDblClk(UINT, CPoint Position)
    124152        {
    125                 COlePropertyFrameDialog Dialog;
    126                 Dialog.SetObject(m_pBaseFilter);
    127                 Dialog.SetObjectPages();
    128                 Dialog.DoModal(m_hWnd);
     153                DoHelperModal(m_pBaseFilter, _T("VMR-7"));
    129154                return 0;
    130155        }
     
    135160
    136161class CVmr9Window :
    137         public CControlWindowT<CVmr9Window>
     162        public CControlWindowT<CVmr9Window>,
     163        public CVrWindowT<CVmr9Window>
    138164{
    139165public:
     
    153179
    154180public:
    155 // CVmr7Window
    156         static CLSID GetRendererClassIdentifier() throw()
     181// CVmr9Window
     182        static CLSID GetRendererClassIdentifier()
    157183        {
    158184                return CLSID_VideoMixingRenderer9;
     
    175201                __D(m_pVmrWindowlessControl, E_NOINTERFACE);
    176202                __C(m_pVmrWindowlessControl->SetVideoClippingWindow(m_hWnd));
    177                 CRect VideoPosition = GetVideoPosition();
    178                 _Z4(atlTraceGeneral, 4, _T(".m_pVmrWindowlessControl 0x%p, VideoPosition at (%d, %d) size (%d, %d)\n"), m_pVmrWindowlessControl, VideoPosition.left, VideoPosition.top, VideoPosition.Width(), VideoPosition.Height());
    179                 __C(m_pVmrWindowlessControl->SetVideoPosition(NULL, VideoPosition));
    180         }
    181         VOID Terminate() throw()
     203                UpdateVideoPosition();
     204        }
     205        VOID Terminate()
    182206        {
    183207                m_pBaseFilter = NULL;
    184208                m_pVmrWindowlessControl = NULL;
    185209        }
    186         CRect GetVideoPosition() const throw()
     210        CRect GetVideoPosition() const
    187211        {
    188212                CRect Position;
    189213                _W(GetClientRect(Position));
    190214                return Position;
     215        }
     216        BOOL UpdateVideoPosition()
     217        {
     218                _A(m_pVmrWindowlessControl && IsWindow());
     219                CRect VideoPosition = GetVideoPosition();
     220                _Z4(atlTraceGeneral, 4, _T("m_pVmrWindowlessControl 0x%p, VideoPosition at (%d, %d) size (%d, %d)\n"), m_pVmrWindowlessControl, VideoPosition.left, VideoPosition.top, VideoPosition.Width(), VideoPosition.Height());
     221                const HRESULT nSetVideoPositionResult = m_pVmrWindowlessControl->SetVideoPosition(NULL, VideoPosition);
     222                __C(nSetVideoPositionResult); //_Z45_DSHRESULT(nSetVideoPositionResult);
     223                return SUCCEEDED(nSetVideoPositionResult);
    191224        }
    192225
     
    208241                        CPaintDC Dc(m_hWnd);
    209242                        const HRESULT nRepaintVideoResult = m_pVmrWindowlessControl->RepaintVideo(m_hWnd, Dc);
    210                         _Z4(atlTraceUI, SUCCEEDED(nRepaintVideoResult) ? 6 : 4, _T("nRepaintVideoResult 0x%08x\n"), nRepaintVideoResult);
     243                        _Z45_DSHRESULT(nRepaintVideoResult);
    211244                } else
    212245                        SetMsgHandled(FALSE);
     
    218251                {
    219252                        const HRESULT nDisplayModeChangedResult = m_pVmrWindowlessControl->DisplayModeChanged();
    220                         _Z4(atlTraceUI, 4, _T("nDisplayModeChangedResult 0x%08x\n"), nDisplayModeChangedResult);
     253                        _Z45_DSHRESULT(nDisplayModeChangedResult);
    221254                }
    222255                return 0;
     
    226259                if(nType != SIZE_MINIMIZED)
    227260                        if(m_pVmrWindowlessControl)
    228                         {
    229                                 CRect VideoPosition = GetVideoPosition();
    230                                 const HRESULT nSetVideoPositionResult = m_pVmrWindowlessControl->SetVideoPosition(NULL, &VideoPosition);
    231                                 _Z4(atlTraceUI, SUCCEEDED(nSetVideoPositionResult) ? 6 : 4, _T("nSetVideoPositionResult 0x%08x\n"), nSetVideoPositionResult);
    232                         }
     261                                UpdateVideoPosition();
    233262                return 0;
    234263        }
    235264        LRESULT OnLButtonDblClk(UINT, CPoint Position)
    236265        {
    237                 COlePropertyFrameDialog Dialog;
    238                 Dialog.SetObject(m_pBaseFilter);
    239                 Dialog.SetObjectPages();
    240                 Dialog.DoModal(m_hWnd);
     266                DoHelperModal(m_pBaseFilter, _T("VMR-9"));
    241267                return 0;
    242268        }
     
    247273
    248274class CEvrWindow :
    249         public CControlWindowT<CEvrWindow>
     275        public CControlWindowT<CEvrWindow>,
     276        public CVrWindowT<CEvrWindow>
    250277{
    251278public:
     
    265292public:
    266293// CEvrWindow
    267         static CLSID GetRendererClassIdentifier() throw()
     294        static CLSID GetRendererClassIdentifier()
    268295        {
    269296                return CLSID_EnhancedVideoRenderer;
     
    286313                m_pMfVideoDisplayControl = pMfVideoDisplayControl;
    287314                __C(pMfVideoDisplayControl->SetVideoWindow(m_hWnd));
    288                 CRect VideoPosition = GetVideoPosition();
    289                 _Z4(atlTraceGeneral, 4, _T("pMfVideoDisplayControl 0x%p, VideoPosition at (%d, %d) size (%d, %d)\n"), pMfVideoDisplayControl, VideoPosition.left, VideoPosition.top, VideoPosition.Width(), VideoPosition.Height());
    290                 __C(pMfVideoDisplayControl->SetVideoPosition(NULL, VideoPosition));
     315                UpdateVideoPosition();
    291316                //__C(pMfVideoDisplayControl->SetAspectRatioMode(MFVideoARMode_None)); // As opposed to default MFVideoARMode_Picture - disable letterboxing
    292317        }
    293         VOID Terminate() throw()
     318        VOID Terminate()
    294319        {
    295320                m_pBaseFilter = NULL;
    296321                m_pMfVideoDisplayControl = NULL;
    297322        }
    298         CRect GetVideoPosition() const throw()
     323        CRect GetVideoPosition() const
    299324        {
    300325                CRect Position;
    301326                _W(GetClientRect(Position));
    302327                return Position;
     328        }
     329        BOOL UpdateVideoPosition()
     330        {
     331                _A(m_pMfVideoDisplayControl && IsWindow());
     332                CRect VideoPosition = GetVideoPosition();
     333                _Z4(atlTraceGeneral, 4, _T("m_pMfVideoDisplayControl 0x%p, VideoPosition at (%d, %d) size (%d, %d)\n"), m_pMfVideoDisplayControl, VideoPosition.left, VideoPosition.top, VideoPosition.Width(), VideoPosition.Height());
     334                const HRESULT nSetVideoPositionResult = m_pMfVideoDisplayControl->SetVideoPosition(NULL, VideoPosition);
     335                __C(nSetVideoPositionResult); //_Z45_DSHRESULT(nSetVideoPositionResult);
     336                return SUCCEEDED(nSetVideoPositionResult);
    303337        }
    304338
     
    329363                if(nType != SIZE_MINIMIZED)
    330364                        if(m_pMfVideoDisplayControl)
    331                         {
    332                                 CRect VideoPosition = GetVideoPosition();
    333                                 const HRESULT nSetVideoPositionResult = m_pMfVideoDisplayControl->SetVideoPosition(NULL, &VideoPosition);
    334                                 _Z4(atlTraceUI, SUCCEEDED(nSetVideoPositionResult) ? 6 : 4, _T("nSetVideoPositionResult 0x%08x\n"), nSetVideoPositionResult);
    335                         }
     365                                UpdateVideoPosition();
    336366                return 0;
    337367        }
    338368        LRESULT OnLButtonDblClk(UINT, CPoint Position)
    339369        {
    340                 COlePropertyFrameDialog Dialog;
    341                 Dialog.SetObject(m_pBaseFilter);
    342                 Dialog.SetObjectPages();
    343                 Dialog.DoModal(m_hWnd);
     370                DoHelperModal(m_pBaseFilter, _T("EVR"));
    344371                return 0;
    345372        }
     
    408435                public:
    409436                // CThreadContext
    410                         CThreadContext(CEvent& TerminationEvent) throw() :
     437                        CThreadContext(CEvent& TerminationEvent) :
    411438                                CPushSourceFilter::CThreadContext(TerminationEvent),
    412439                                m_nMediaSampleIndex(0)
     
    448475                public:
    449476                // COutputPin
    450                         COutputPin() throw()
     477                        COutputPin()
    451478                        {
    452479                                _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
    453480                        }
    454                         ~COutputPin() throw()
     481                        ~COutputPin()
    455482                        {
    456483                                _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
     
    461488                                _W(MediaTypeList.AddTail(GetFilter()->m_pRequestedMediaType));
    462489                        }
    463                         BOOL CheckMediaType(const CMediaType& pMediaType) const throw()
     490                        BOOL CheckMediaType(const CMediaType& pMediaType) const
    464491                        {
    465492                                _A(pMediaType);
     
    472499                                return CVideoInfoHeader::Compare(&GetFilter()->m_pRequestedMediaType.GetCompatibleVideoInfoHeader(), &pMediaType.GetCompatibleVideoInfoHeader(), FALSE);
    473500                        }
    474                         BOOL DecideMemAllocatorProperties(IMemAllocator* pMemAllocator, ALLOCATOR_PROPERTIES Properties) throw()
     501                        BOOL DecideMemAllocatorProperties(IMemAllocator* pMemAllocator, ALLOCATOR_PROPERTIES Properties)
    475502                        {
    476503                                static const SIZE_T g_nMiminalBufferCount = 8;
     
    496523                        {
    497524                                CMediaSampleProperties OutputProperties(pMediaSample);
    498                                 #pragma region Dynamic Type Change
    499                                 if(OutputProperties.dwSampleFlags & AM_SAMPLE_TYPECHANGED)
    500                                 {
    501                                         _A(OutputProperties.pMediaType);
    502                                         _A(CheckMediaType(OutputProperties.pMediaType));
    503                                         SetMediaType(OutputProperties.pMediaType);
    504                                 } else
    505                                         _A(!OutputProperties.pMediaType);
    506                                 #pragma endregion
     525                                HandleMediaTypeChange(OutputProperties);
    507526                                const CMediaType pMediaType = GetMediaType();
    508527                                const CVideoInfoHeader2* pVideoInfoHeader2 = pMediaType.GetVideoInfoHeader2();
     
    551570        public:
    552571        // CSourceFilter
    553                 CSourceFilter() throw() :
     572                CSourceFilter() :
    554573                        CBasePersistT<CSourceFilter>(GetDataCriticalSection()),
    555574                        m_bWeave(FALSE),
     
    558577                        _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
    559578                }
    560                 ~CSourceFilter() throw()
     579                ~CSourceFilter()
    561580                {
    562581                        _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
    563582                }
    564                 HRESULT FinalConstruct() throw()
     583                HRESULT FinalConstruct()
    565584                {
    566585                        _ATLTRY
     
    575594                        return S_OK;
    576595                }
    577                 VOID FinalRelease() throw()
     596                VOID FinalRelease()
    578597                {
    579598                        m_pOutputPin = NULL;
     
    591610                        m_pOutputPin->DeliverNewSegment(nStartTime, nStopTime, fRate);
    592611                }
    593                 static BOOL CanCue() throw()
     612                static BOOL CanCue()
    594613                {
    595614                        return FALSE;
     
    603622                        m_pOutputPin->RunPin(nStartTime);
    604623                }
    605                 VOID PauseFilter() throw()
     624                VOID PauseFilter()
    606625                {
    607626                        m_pOutputPin->PausePin();
    608627                }
    609                 VOID StopFilter() throw()
     628                VOID StopFilter()
    610629                {
    611630                        m_pOutputPin->StopPin();
    612631                }
    613                 const CObjectPtr<COutputPin>& GetOutputPin() const throw()
     632                const CObjectPtr<COutputPin>& GetOutputPin() const
    614633                {
    615634                        return m_pOutputPin;
     
    643662                        m_pRequestedMediaType = pMediaType;
    644663                }
    645                 const CMediaType& GetRequestedMediaType() const throw()
     664                const CMediaType& GetRequestedMediaType() const
    646665                {
    647666                        return m_pRequestedMediaType;
    648667                }
    649                 BOOL GetWeave() const throw()
     668                BOOL GetWeave() const
    650669                {
    651670                        CRoCriticalSectionLock DataLock(GetDataCriticalSection());
    652671                        return m_bWeave;
    653672                }
    654                 VOID SetWeave(BOOL bWeave) throw()
     673                VOID SetWeave(BOOL bWeave)
    655674                {
    656675                        CRoCriticalSectionLock DataLock(GetDataCriticalSection());
    657676                        m_bWeave = bWeave;
    658677                }
    659                 BOOL GetColorize() const throw()
     678                BOOL GetColorize() const
    660679                {
    661680                        CRoCriticalSectionLock DataLock(GetDataCriticalSection());
    662681                        return m_bColorize;
    663682                }
    664                 VOID SetColorize(BOOL bColorize) throw()
     683                VOID SetColorize(BOOL bColorize)
    665684                {
    666685                        CRoCriticalSectionLock DataLock(GetDataCriticalSection());
     
    684703        public:
    685704        // CAmGraphBuilderCallback
    686                 CAmGraphBuilderCallback() throw()
     705                CAmGraphBuilderCallback()
    687706                {
    688707                        _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
    689708                }
    690                 ~CAmGraphBuilderCallback() throw()
     709                ~CAmGraphBuilderCallback()
    691710                {
    692711                        _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
     
    700719
    701720        // IAMGraphBuilderCallback
    702                 STDMETHOD(SelectedFilter)(IMoniker* pMoniker) throw()
     721                STDMETHOD(SelectedFilter)(IMoniker* pMoniker)
    703722                {
    704723                        _Z5(atlTraceCOM, 5, _T("...\n"));
     
    724743                        return S_OK;
    725744                }
    726                 STDMETHOD(CreatedFilter)(IBaseFilter* pBaseFilter) throw()
     745                STDMETHOD(CreatedFilter)(IBaseFilter* pBaseFilter)
    727746                {
    728747                        _Z5(atlTraceCOM, 5, _T("...\n"));
     
    741760
    742761        ////////////////////////////////////////////////////
     762        // CVrPropertyPageT
     763
     764        template <typename T>
     765        class CVrPropertyPageT
     766        {
     767        public:
     768        // CVrPropertyPageT
     769                VOID HandleMediaEvent(LONG nEventCode, LONG_PTR nParameter1, LONG_PTR nParameter2)
     770                {
     771                        T* pT = static_cast<T*>(this);
     772                        switch(nEventCode)
     773                        {
     774                        #pragma region EC_COMPLETE
     775                        case EC_COMPLETE:
     776                                _Z2(atlTraceGeneral, 2, _T("Filter Graph EC_COMPLETE (0x%X) Event, nParameter1 0x%08X, nParameter2 0x%08X\n"), nEventCode, nParameter1, nParameter2);
     777                                break;
     778                        #pragma endregion
     779                        #pragma region EC_USERABORT
     780                        case EC_USERABORT:
     781                                _Z2(atlTraceGeneral, 2, _T("Filter Graph EC_USERABORT (0x%X) Event, nParameter1 0x%08X, nParameter2 0x%08X\n"), nEventCode, nParameter1, nParameter2);
     782                                break;
     783                        #pragma endregion
     784                        #pragma region EC_ERRORABORT
     785                        case EC_ERRORABORT:
     786                                _Z2(atlTraceGeneral, 2, _T("Filter Graph EC_ERRORABORT (0x%X) Event, nParameter1 0x%08X, nParameter2 0x%08X\n"), nEventCode, nParameter1, nParameter2);
     787                                _A(FAILED(nParameter1));
     788                                AtlMessageBoxEx(pT->m_hWnd, (LPCTSTR) AtlFormatString(_T("EC_ERRORABORT Event: %s."), Ds::FormatResult((HRESULT) nParameter1).TrimRight(_T("\t\n\r ."))), IDS_ERROR, MB_ICONERROR | MB_OK);
     789                                break;
     790                        #pragma endregion
     791                        #pragma region EC_PAUSED
     792                        case EC_PAUSED:
     793                                _Z2(atlTraceGeneral, 2, _T("Filter Graph EC_PAUSED (0x%X) Event, nParameter1 0x%08X, nParameter2 0x%08X\n"), nEventCode, nParameter1, nParameter2);
     794                                break;
     795                        #pragma endregion
     796                        #pragma region EC_VMR_RENDERDEVICE_SET
     797                        case EC_VMR_RENDERDEVICE_SET:
     798                                {
     799                                        CString sParameter1;
     800                                        switch(nParameter1)
     801                                        {
     802                                        case VMR_RENDER_DEVICE_OVERLAY:
     803                                                sParameter1 = AtlFormatString(_T("VMR_RENDER_DEVICE_OVERLAY (0x%02X)"), nParameter1);
     804                                                break;
     805                                        case VMR_RENDER_DEVICE_VIDMEM:
     806                                                sParameter1 = AtlFormatString(_T("VMR_RENDER_DEVICE_VIDMEM (0x%02X)"), nParameter1);
     807                                                break;
     808                                        case VMR_RENDER_DEVICE_SYSMEM:
     809                                                sParameter1 = AtlFormatString(_T("VMR_RENDER_DEVICE_SYSMEM (0x%02X)"), nParameter1);
     810                                                break;
     811                                        default:
     812                                                sParameter1 = AtlFormatString(_T("0x%02X"), nParameter1);
     813
     814                                        }
     815                                        _Z2(atlTraceGeneral, 2, _T("Filter Graph EC_VMR_RENDERDEVICE_SET (0x%X) Event, nParameter1 %s, nParameter2 0x%08X\n"), nEventCode, sParameter1, nParameter2);
     816                                }
     817                                break;
     818                        #pragma endregion
     819                        default:
     820                                #pragma region EC_xxx (Development)
     821                                #if _DEVELOPMENT
     822                                        #define A(x) { x, #x },
     823                                        static const struct
     824                                        {
     825                                                LONG nEventCode;
     826                                                LPCSTR pszEventName;
     827                                        } g_pMap[] =
     828                                        {
     829                                                A(EC_COMPLETE)
     830                                                A(EC_USERABORT)
     831                                                A(EC_ERRORABORT)
     832                                                A(EC_TIME)
     833                                                A(EC_REPAINT)
     834                                                A(EC_STREAM_ERROR_STOPPED)
     835                                                A(EC_STREAM_ERROR_STILLPLAYING)
     836                                                A(EC_ERROR_STILLPLAYING)
     837                                                A(EC_PALETTE_CHANGED)
     838                                                A(EC_VIDEO_SIZE_CHANGED)
     839                                                A(EC_QUALITY_CHANGE)
     840                                                A(EC_SHUTTING_DOWN)
     841                                                A(EC_CLOCK_CHANGED)
     842                                                A(EC_PAUSED)
     843                                                A(EC_OPENING_FILE)
     844                                                A(EC_BUFFERING_DATA)
     845                                                A(EC_FULLSCREEN_LOST)
     846                                                A(EC_ACTIVATE)
     847                                                A(EC_NEED_RESTART)
     848                                                A(EC_WINDOW_DESTROYED)
     849                                                A(EC_DISPLAY_CHANGED)
     850                                                A(EC_STARVATION)
     851                                                A(EC_OLE_EVENT)
     852                                                A(EC_NOTIFY_WINDOW)
     853                                                A(EC_STREAM_CONTROL_STOPPED)
     854                                                A(EC_STREAM_CONTROL_STARTED)
     855                                                A(EC_END_OF_SEGMENT)
     856                                                A(EC_SEGMENT_STARTED)
     857                                                A(EC_LENGTH_CHANGED)
     858                                                A(EC_DEVICE_LOST)
     859                                                A(EC_SAMPLE_NEEDED)
     860                                                A(EC_PROCESSING_LATENCY)
     861                                                A(EC_SAMPLE_LATENCY)
     862                                                A(EC_SCRUB_TIME)
     863                                                A(EC_STEP_COMPLETE)
     864                                                A(EC_WMT_INDEX_EVENT)
     865                                                A(EC_WMT_EVENT)
     866                                        };
     867                                        #undef A
     868                                        BOOL bFound = FALSE;
     869                                        for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++)
     870                                                if(g_pMap[nIndex].nEventCode == nEventCode)
     871                                                {
     872                                                        _Z2(atlTraceGeneral, 2, _T("Filter Graph %hs Event, nEventCode 0x%X, nParameter1 0x%08X, nParameter2 0x%08X\n"), g_pMap[nIndex].pszEventName, nEventCode, nParameter1, nParameter2);
     873                                                        bFound = TRUE;
     874                                                        break;
     875                                                }
     876                                        if(!bFound)
     877                                #endif // _DEVELOPMENT
     878                                #pragma endregion
     879                                _Z2(atlTraceGeneral, 2, _T("Filter Graph Event, nEventCode 0x%X, nParameter1 0x%08X, nParameter2 0x%08X\n"), nEventCode, nParameter1, nParameter2);
     880                        }
     881                }
     882        };
     883
     884        ////////////////////////////////////////////////////
    743885        // CVmr7PropertyPage
    744886
    745887        class CVmr7PropertyPage :
    746888                public CPropertyPageT<CVmr7PropertyPage>,
    747                 public CDialogResize<CVmr7PropertyPage>
     889                public CDialogResize<CVmr7PropertyPage>,
     890                public CVrPropertyPageT<CVmr7PropertyPage>
    748891        {
    749892        public:
     
    829972                }
    830973
    831         // Window Message Handelrs
     974        // Window Message Handlers
    832975                LRESULT OnInitDialog(HWND, LPARAM)
    833976                {
     
    8641007                        return 0;
    8651008                }
    866                 LRESULT OnDestroy() throw()
     1009                LRESULT OnDestroy()
    8671010                {
    8681011                        if(m_FilterGraph.m_pMediaControl)
     
    9791122                                        _ATLTRY
    9801123                                        {
    981                                                 switch(nEventCode)
    982                                                 {
    983                                                 case EC_ERRORABORT:
    984                                                         _Z2(atlTraceGeneral, 2, _T("nEventCode EC_ERRORABORT 0x%02X, nParameter1 0x%08x, nParameter2 0x%08x\n"), nEventCode, nParameter1, nParameter2);
    985                                                         _A(FAILED(nParameter1));
    986                                                         AtlMessageBoxEx(m_hWnd, (LPCTSTR) AtlFormatString(_T("EC_ERRORABORT Event: %s."), AtlFormatSystemMessage((HRESULT) nParameter1).TrimRight(_T("\t\n\r ."))), IDS_ERROR, MB_ICONERROR | MB_OK);
    987                                                         break;
    988                                                 default:
    989                                                         _Z1(atlTraceGeneral, 1, _T("nEventCode 0x%02X, nParameter1 0x%08x, nParameter2 0x%08x\n"), nEventCode, nParameter1, nParameter2);
    990                                                 }
     1124                                                HandleMediaEvent(nEventCode, nParameter1, nParameter2);
    9911125                                        }
    9921126                                        _ATLCATCHALL()
     
    10161150        class CVmr9PropertyPage :
    10171151                public CPropertyPageT<CVmr9PropertyPage>,
    1018                 public CDialogResize<CVmr9PropertyPage>
     1152                public CDialogResize<CVmr9PropertyPage>,
     1153                public CVrPropertyPageT<CVmr9PropertyPage>
    10191154        {
    10201155        public:
     
    11001235                }
    11011236
    1102         // Window Message Handelrs
     1237        // Window Message Handlers
    11031238                LRESULT OnInitDialog(HWND, LPARAM)
    11041239                {
     
    11181253                        pAmGraphBuilderCallback.Construct();
    11191254                        pAmGraphBuilderCallback->SetGraphBuilder(m_FilterGraph.m_pFilterGraph);
     1255
    11201256                        const CComPtr<IBaseFilter> pBaseFilter = m_RendererWindow.CoCreateBaseFilterInstance();
    11211257                        __C(m_FilterGraph->AddFilter(pBaseFilter, CT2CW(_T("VMR-9"))));
     
    11321268                        __C(m_FilterGraph->Connect(pSourceFilter->GetOutputPin(), _FilterGraphHelper::GetFilterPin(m_RendererWindow.m_pBaseFilter)));
    11331269                        __C(m_FilterGraph.m_pMediaEventEx->SetNotifyWindow((OAHWND) m_hWnd, WM_FILTERGRAPHEVENT, (LONG_PTR) this));
     1270
     1271                        __C(m_FilterGraph.m_pMediaEventEx->CancelDefaultHandling(EC_DISPLAY_CHANGED));
     1272                        _W(GetParent().SetWindowPos(NULL, 1680 + 100, 100, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE));
     1273                        CRect RendererPosition;
     1274                        _W(m_RendererWindow.GetWindowRect(RendererPosition));
     1275
     1276                        CComQIPtr<IVMRMonitorConfig9> pVmrMonitorConfig9 = pBaseFilter;
     1277                        UINT nMonitor, nDefaultMonitor;
     1278                        __C(pVmrMonitorConfig9->GetMonitor(&nMonitor));
     1279                        __C(pVmrMonitorConfig9->GetDefaultMonitor(&nDefaultMonitor));
     1280                        _Z4(atlTraceGeneral, 4, _T("nMonitor %d, nDefaultMonitor %d\n"), nMonitor, nDefaultMonitor);
     1281                        CTempBufferT<VMR9MonitorInfo> pMonitorInformations(32);
     1282                        DWORD nMonitorInformationCount = 0;
     1283                        __C(pVmrMonitorConfig9->GetAvailableMonitors(pMonitorInformations, 32, &nMonitorInformationCount));
     1284                        for(DWORD nMonitorIndex = 0; nMonitorIndex < nMonitorInformationCount; nMonitorIndex++)
     1285                        {
     1286                                const VMR9MonitorInfo& MonitorInformation = pMonitorInformations[nMonitorIndex];
     1287                                const CRect& MonitorPosition = reinterpret_cast<const CRect&>(MonitorInformation.rcMonitor);
     1288                                _Z4(atlTraceGeneral, 4, _T("MonitorInformation.uDevID %d, .hMon 0x%08X, .dwFlags 0x%X, .szDevice \"%ls\", .szDescription \"%ls\"\n"),
     1289                                        MonitorInformation.uDevID,
     1290                                        //MonitorInformation.rcMonitor.left, ...
     1291                                        MonitorInformation.hMon, MonitorInformation.dwFlags,
     1292                                        MonitorInformation.szDevice, MonitorInformation.szDescription,
     1293                                        //MonitorInformation.liDriverVersion,
     1294                                        //MonitorInformation.dwVendorId, MonitorInformation.dwDeviceId, MonitorInformation.dwSubSysId, MonitorInformation.dwRevision,
     1295                                        0);
     1296                                if(MonitorPosition.PtInRect(RendererPosition.TopLeft()) && MonitorPosition.PtInRect(RendererPosition.BottomRight()))
     1297                                {
     1298                                        _Z4(atlTraceGeneral, 4, _T("MonitorInformation.uDevID %d\n"), MonitorInformation.uDevID);
     1299                                        HRESULT nSetMonitorResult = pVmrMonitorConfig9->SetMonitor(MonitorInformation.uDevID);
     1300                                        _Z45_DSHRESULT(nSetMonitorResult);
     1301                                        if(nSetMonitorResult == VFW_E_WRONG_STATE)
     1302                                        {
     1303                                                const CComPtr<IPin> pInputPin = _FilterGraphHelper::GetFilterPin(pBaseFilter, PINDIR_INPUT);
     1304                                                const CComPtr<IPin> pOutputPin = _FilterGraphHelper::GetPeerPin(pInputPin);
     1305                                                __D(pInputPin && pOutputPin, E_NOINTERFACE);
     1306                                                const CMediaType pMediaType = _FilterGraphHelper::GetPinMediaType(pOutputPin);
     1307                                                __C(m_FilterGraph.Disconnect(pOutputPin));
     1308                                                __C(m_FilterGraph.Disconnect(pInputPin));
     1309
     1310
     1311                                                //m_RendererWindow.Terminate();
     1312                                                //__C(m_FilterGraph.RemoveFilter(pBaseFilter));
     1313                                                nSetMonitorResult = pVmrMonitorConfig9->SetMonitor(MonitorInformation.uDevID);
     1314                                                _Z45_DSHRESULT(nSetMonitorResult);
     1315                                                //__C(m_FilterGraph->AddFilter(pBaseFilter, CT2CW(_T("VMR-9"))));
     1316                                                //m_RendererWindow.Initialize(pBaseFilter);
     1317                                                m_RendererWindow.UpdateVideoPosition();
     1318                                               
     1319
     1320                                                if(SUCCEEDED(nSetMonitorResult))
     1321                                                {
     1322                                                        const HRESULT nConnectResult = m_FilterGraph.ConnectDirect(pOutputPin, pInputPin, pMediaType);
     1323                                                        _Z45_DSHRESULT(nConnectResult);
     1324                                                        __C(nConnectResult);
     1325                                                }
     1326                                        }
     1327                                        __C(nSetMonitorResult);
     1328                                        __C(pVmrMonitorConfig9->GetMonitor(&nMonitor));
     1329                                        __C(pVmrMonitorConfig9->GetDefaultMonitor(&nDefaultMonitor));
     1330                                        _Z4(atlTraceGeneral, 4, _T("nMonitor %d, nDefaultMonitor %d\n"), nMonitor, nDefaultMonitor);
     1331                                        break;
     1332                                }
     1333                        }
     1334
    11341335                        UpdateControls();
    11351336                        return 0;
    11361337                }
    1137                 LRESULT OnDestroy() throw()
     1338                LRESULT OnDestroy()
    11381339                {
    11391340                        if(m_FilterGraph.m_pMediaControl)
     
    12501451                                        _ATLTRY
    12511452                                        {
    1252                                                 switch(nEventCode)
    1253                                                 {
    1254                                                 case EC_ERRORABORT:
    1255                                                         _Z2(atlTraceGeneral, 2, _T("nEventCode EC_ERRORABORT 0x%02X, nParameter1 0x%08x, nParameter2 0x%08x\n"), nEventCode, nParameter1, nParameter2);
    1256                                                         _A(FAILED(nParameter1));
    1257                                                         AtlMessageBoxEx(m_hWnd, (LPCTSTR) AtlFormatString(_T("EC_ERRORABORT Event: %s."), AtlFormatSystemMessage((HRESULT) nParameter1).TrimRight(_T("\t\n\r ."))), IDS_ERROR, MB_ICONERROR | MB_OK);
    1258                                                         break;
    1259                                                 default:
    1260                                                         _Z1(atlTraceGeneral, 1, _T("nEventCode 0x%02X, nParameter1 0x%08x, nParameter2 0x%08x\n"), nEventCode, nParameter1, nParameter2);
    1261                                                 }
     1453                                                HandleMediaEvent(nEventCode, nParameter1, nParameter2);
    12621454                                        }
    12631455                                        _ATLCATCHALL()
     
    12871479        class CEvrPropertyPage :
    12881480                public CPropertyPageT<CEvrPropertyPage>,
    1289                 public CDialogResize<CEvrPropertyPage>
     1481                public CDialogResize<CEvrPropertyPage>,
     1482                public CVrPropertyPageT<CEvrPropertyPage>
    12901483        {
    12911484        public:
     
    13711564                }
    13721565
    1373         // Window Message Handelrs
     1566        // Window Message Handlers
    13741567                LRESULT OnInitDialog(HWND, LPARAM)
    13751568                {
     
    14061599                        return 0;
    14071600                }
    1408                 LRESULT OnDestroy() throw()
     1601                LRESULT OnDestroy()
    14091602                {
    14101603                        if(m_FilterGraph.m_pMediaControl)
     
    15221715                                        _ATLTRY
    15231716                                        {
    1524                                                 switch(nEventCode)
    1525                                                 {
    1526                                                 case EC_ERRORABORT:
    1527                                                         _Z2(atlTraceGeneral, 2, _T("nEventCode EC_ERRORABORT 0x%02X, nParameter1 0x%08x, nParameter2 0x%08x\n"), nEventCode, nParameter1, nParameter2);
    1528                                                         _A(FAILED(nParameter1));
    1529                                                         AtlMessageBoxEx(m_hWnd, (LPCTSTR) AtlFormatString(_T("EC_ERRORABORT Event: %s."), AtlFormatSystemMessage((HRESULT) nParameter1).TrimRight(_T("\t\n\r ."))), IDS_ERROR, MB_ICONERROR | MB_OK);
    1530                                                         break;
    1531                                                 default:
    1532                                                         _Z1(atlTraceGeneral, 1, _T("nEventCode 0x%02X, nParameter1 0x%08x, nParameter2 0x%08x\n"), nEventCode, nParameter1, nParameter2);
    1533                                                 }
     1717                                                HandleMediaEvent(nEventCode, nParameter1, nParameter2);
    15341718                                        }
    15351719                                        _ATLCATCHALL()
     
    15671751                m_EvrPropertyPage(this)
    15681752        {
    1569                 AddPage(m_Vmr7PropertyPage);
     1753                //AddPage(m_Vmr7PropertyPage);
    15701754                AddPage(m_Vmr9PropertyPage);
    1571                 AddPage(m_EvrPropertyPage);
     1755                //AddPage(m_EvrPropertyPage);
    15721756        }
    15731757        BOOL SetInitialPosition()
     
    16021786        }
    16031787
    1604 // Window Message Handelrs
     1788// Window Message Handlers
    16051789        LRESULT OnSetLargerInitialPosition(UINT, WPARAM, LPARAM)
    16061790        {
  • trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.cpp

    r74 r295  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2012
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#include "stdafx.h"
     
    2523public:
    2624// CRenderInterlacedVideoModule
    27         CRenderInterlacedVideoModule() throw()
     25        CRenderInterlacedVideoModule()
    2826        {
    29                 #if defined(_DEBUG)
    30                 AtlTraceLoadSettings(NULL);
    31                 #endif // defined(_DEBUG)
     27                AtlTraceSetDefaultSettings();
    3228                _W(CExceptionFilter::Initialize());
    33                 _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
     29                _Z4_THIS();
    3430        }
    35         ~CRenderInterlacedVideoModule() throw()
     31        ~CRenderInterlacedVideoModule()
    3632        {
    37                 _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
     33                _Z4_THIS();
    3834                CExceptionFilter::Terminate();
    3935        }
    40         HRESULT PreMessageLoop(INT nShowCommand) throw()
     36        HRESULT PreMessageLoop(INT nShowCommand)
    4137        {
    4238                _ATLTRY
     
    5349                return S_OK;
    5450        }
    55         VOID RunMessageLoop() throw()
     51        VOID RunMessageLoop()
    5652        {
    5753                Lock();
     
    6763                Unlock();
    6864        }
    69         HRESULT PostMessageLoop() throw()
     65        HRESULT PostMessageLoop()
    7066        {
    7167                _ATLTRY
  • trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.idl

    r74 r295  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2012
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75import "oaidl.idl";
  • trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.sln

    r74 r295  
    11
    22Microsoft Visual Studio Solution File, Format Version 11.00
    3 # Visual Studio 2010
     3# Visual Studio 2012
    44Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderInterlacedVideo", "RenderInterlacedVideo.vcxproj", "{D5F58BC2-453A-4C4E-888E-9C7C511D8FD4}"
    55EndProject
  • trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.vcxproj

    r74 r295  
    566566    <None Include="Information.ico" />
    567567    <None Include="Module.ico" />
    568     <None Include="ReadMe.txt" />
    569568    <None Include="RenderInterlacedVideo.rgs" />
    570569  </ItemGroup>
  • trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.vcxproj.filters

    r74 r295  
    5353  </ItemGroup>
    5454  <ItemGroup>
    55     <None Include="ReadMe.txt" />
    5655    <None Include="RenderInterlacedVideo.rgs">
    5756      <Filter>Resource Files</Filter>
  • trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo_i.c

    r75 r295  
    77
    88 /* File created by MIDL compiler version 7.00.0555 */
    9 /* at Sun Jul 15 14:15:39 2012
     9/* at Sun Jun 15 11:37:54 2014
    1010 */
    1111/* Compiler settings for RenderInterlacedVideo.idl:
  • trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo_i.h

    r75 r295  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Sun Jul 15 14:15:39 2012
     7/* at Sun Jun 15 11:37:54 2014
    88 */
    99/* Compiler settings for RenderInterlacedVideo.idl:
  • trunk/Utilities/RenderInterlacedVideo/stdafx.cpp

    r74 r295  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2012
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#include "stdafx.h"
  • trunk/Utilities/RenderInterlacedVideo/stdafx.h

    r74 r295  
    11////////////////////////////////////////////////////////////
     2// Copyright (C) Roman Ryltsov, 2008-2014
    23// Created by Roman Ryltsov roman@alax.info
    3 // $Id$
    44
    55#pragma once
  • trunk/Utilities/RenderInterlacedVideo/targetver.h

    r74 r295  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2012
     2// Copyright (C) Roman Ryltsov, 2008-2014
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
Note: See TracChangeset for help on using the changeset viewer.