Changeset 295
- Timestamp:
- Jun 15, 2014, 7:30:53 AM (9 years ago)
- Location:
- trunk/Utilities/RenderInterlacedVideo
- Files:
-
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/RenderInterlacedVideo
- Property svn:ignore
-
old new 4 4 *.aps 5 5 *.sdf 6 *.opensdf
-
- Property svn:ignore
-
trunk/Utilities/RenderInterlacedVideo/MainPropertySheet.h
r76 r295 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 22 // Copyright (C) Roman Ryltsov, 2008-2014 3 3 // Created by Roman Ryltsov roman@alax.info 4 //5 // $Id$6 4 7 5 #pragma once … … 14 12 #include <evr9.h> 15 13 #include <dxva.h> 14 #import "libid:B9EC374B-834B-4DA9-BFB5-C1872CE736FF" raw_interfaces_only // AlaxInfoDirectShowSpy 16 15 #include "rodshow.h" 16 17 //////////////////////////////////////////////////////////// 18 // CVrWindowT 19 20 template <typename T> 21 class CVrWindowT 22 { 23 public: 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 }; 17 41 18 42 //////////////////////////////////////////////////////////// … … 20 44 21 45 class CVmr7Window : 22 public CControlWindowT<CVmr7Window> 46 public CControlWindowT<CVmr7Window>, 47 public CVrWindowT<CVmr7Window> 23 48 { 24 49 public: … … 39 64 public: 40 65 // CVmr7Window 41 static CLSID GetRendererClassIdentifier() throw()66 static CLSID GetRendererClassIdentifier() 42 67 { 43 68 return CLSID_VideoMixingRenderer; … … 63 88 __D(m_pVmrWindowlessControl, E_NOINTERFACE); 64 89 __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() 70 93 { 71 94 m_pBaseFilter = NULL; 72 95 m_pVmrWindowlessControl = NULL; 73 96 } 74 CRect GetVideoPosition() const throw()97 CRect GetVideoPosition() const 75 98 { 76 99 CRect Position; 77 100 _W(GetClientRect(Position)); 78 101 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); 79 111 } 80 112 … … 96 128 CPaintDC Dc(m_hWnd); 97 129 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); 99 131 } else 100 132 SetMsgHandled(FALSE); … … 106 138 { 107 139 const HRESULT nDisplayModeChangedResult = m_pVmrWindowlessControl->DisplayModeChanged(); 108 _Z4 (atlTraceUI, 4, _T("nDisplayModeChangedResult 0x%08x\n"),nDisplayModeChangedResult);140 _Z4_DSHRESULT(nDisplayModeChangedResult); 109 141 } 110 142 return 0; … … 114 146 if(nType != SIZE_MINIMIZED) 115 147 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(); 121 149 return 0; 122 150 } 123 151 LRESULT OnLButtonDblClk(UINT, CPoint Position) 124 152 { 125 COlePropertyFrameDialog Dialog; 126 Dialog.SetObject(m_pBaseFilter); 127 Dialog.SetObjectPages(); 128 Dialog.DoModal(m_hWnd); 153 DoHelperModal(m_pBaseFilter, _T("VMR-7")); 129 154 return 0; 130 155 } … … 135 160 136 161 class CVmr9Window : 137 public CControlWindowT<CVmr9Window> 162 public CControlWindowT<CVmr9Window>, 163 public CVrWindowT<CVmr9Window> 138 164 { 139 165 public: … … 153 179 154 180 public: 155 // CVmr 7Window156 static CLSID GetRendererClassIdentifier() throw()181 // CVmr9Window 182 static CLSID GetRendererClassIdentifier() 157 183 { 158 184 return CLSID_VideoMixingRenderer9; … … 175 201 __D(m_pVmrWindowlessControl, E_NOINTERFACE); 176 202 __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() 182 206 { 183 207 m_pBaseFilter = NULL; 184 208 m_pVmrWindowlessControl = NULL; 185 209 } 186 CRect GetVideoPosition() const throw()210 CRect GetVideoPosition() const 187 211 { 188 212 CRect Position; 189 213 _W(GetClientRect(Position)); 190 214 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); 191 224 } 192 225 … … 208 241 CPaintDC Dc(m_hWnd); 209 242 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); 211 244 } else 212 245 SetMsgHandled(FALSE); … … 218 251 { 219 252 const HRESULT nDisplayModeChangedResult = m_pVmrWindowlessControl->DisplayModeChanged(); 220 _Z4 (atlTraceUI, 4, _T("nDisplayModeChangedResult 0x%08x\n"),nDisplayModeChangedResult);253 _Z45_DSHRESULT(nDisplayModeChangedResult); 221 254 } 222 255 return 0; … … 226 259 if(nType != SIZE_MINIMIZED) 227 260 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(); 233 262 return 0; 234 263 } 235 264 LRESULT OnLButtonDblClk(UINT, CPoint Position) 236 265 { 237 COlePropertyFrameDialog Dialog; 238 Dialog.SetObject(m_pBaseFilter); 239 Dialog.SetObjectPages(); 240 Dialog.DoModal(m_hWnd); 266 DoHelperModal(m_pBaseFilter, _T("VMR-9")); 241 267 return 0; 242 268 } … … 247 273 248 274 class CEvrWindow : 249 public CControlWindowT<CEvrWindow> 275 public CControlWindowT<CEvrWindow>, 276 public CVrWindowT<CEvrWindow> 250 277 { 251 278 public: … … 265 292 public: 266 293 // CEvrWindow 267 static CLSID GetRendererClassIdentifier() throw()294 static CLSID GetRendererClassIdentifier() 268 295 { 269 296 return CLSID_EnhancedVideoRenderer; … … 286 313 m_pMfVideoDisplayControl = pMfVideoDisplayControl; 287 314 __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(); 291 316 //__C(pMfVideoDisplayControl->SetAspectRatioMode(MFVideoARMode_None)); // As opposed to default MFVideoARMode_Picture - disable letterboxing 292 317 } 293 VOID Terminate() throw()318 VOID Terminate() 294 319 { 295 320 m_pBaseFilter = NULL; 296 321 m_pMfVideoDisplayControl = NULL; 297 322 } 298 CRect GetVideoPosition() const throw()323 CRect GetVideoPosition() const 299 324 { 300 325 CRect Position; 301 326 _W(GetClientRect(Position)); 302 327 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); 303 337 } 304 338 … … 329 363 if(nType != SIZE_MINIMIZED) 330 364 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(); 336 366 return 0; 337 367 } 338 368 LRESULT OnLButtonDblClk(UINT, CPoint Position) 339 369 { 340 COlePropertyFrameDialog Dialog; 341 Dialog.SetObject(m_pBaseFilter); 342 Dialog.SetObjectPages(); 343 Dialog.DoModal(m_hWnd); 370 DoHelperModal(m_pBaseFilter, _T("EVR")); 344 371 return 0; 345 372 } … … 408 435 public: 409 436 // CThreadContext 410 CThreadContext(CEvent& TerminationEvent) throw():437 CThreadContext(CEvent& TerminationEvent) : 411 438 CPushSourceFilter::CThreadContext(TerminationEvent), 412 439 m_nMediaSampleIndex(0) … … 448 475 public: 449 476 // COutputPin 450 COutputPin() throw()477 COutputPin() 451 478 { 452 479 _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); 453 480 } 454 ~COutputPin() throw()481 ~COutputPin() 455 482 { 456 483 _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); … … 461 488 _W(MediaTypeList.AddTail(GetFilter()->m_pRequestedMediaType)); 462 489 } 463 BOOL CheckMediaType(const CMediaType& pMediaType) const throw()490 BOOL CheckMediaType(const CMediaType& pMediaType) const 464 491 { 465 492 _A(pMediaType); … … 472 499 return CVideoInfoHeader::Compare(&GetFilter()->m_pRequestedMediaType.GetCompatibleVideoInfoHeader(), &pMediaType.GetCompatibleVideoInfoHeader(), FALSE); 473 500 } 474 BOOL DecideMemAllocatorProperties(IMemAllocator* pMemAllocator, ALLOCATOR_PROPERTIES Properties) throw()501 BOOL DecideMemAllocatorProperties(IMemAllocator* pMemAllocator, ALLOCATOR_PROPERTIES Properties) 475 502 { 476 503 static const SIZE_T g_nMiminalBufferCount = 8; … … 496 523 { 497 524 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); 507 526 const CMediaType pMediaType = GetMediaType(); 508 527 const CVideoInfoHeader2* pVideoInfoHeader2 = pMediaType.GetVideoInfoHeader2(); … … 551 570 public: 552 571 // CSourceFilter 553 CSourceFilter() throw():572 CSourceFilter() : 554 573 CBasePersistT<CSourceFilter>(GetDataCriticalSection()), 555 574 m_bWeave(FALSE), … … 558 577 _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); 559 578 } 560 ~CSourceFilter() throw()579 ~CSourceFilter() 561 580 { 562 581 _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); 563 582 } 564 HRESULT FinalConstruct() throw()583 HRESULT FinalConstruct() 565 584 { 566 585 _ATLTRY … … 575 594 return S_OK; 576 595 } 577 VOID FinalRelease() throw()596 VOID FinalRelease() 578 597 { 579 598 m_pOutputPin = NULL; … … 591 610 m_pOutputPin->DeliverNewSegment(nStartTime, nStopTime, fRate); 592 611 } 593 static BOOL CanCue() throw()612 static BOOL CanCue() 594 613 { 595 614 return FALSE; … … 603 622 m_pOutputPin->RunPin(nStartTime); 604 623 } 605 VOID PauseFilter() throw()624 VOID PauseFilter() 606 625 { 607 626 m_pOutputPin->PausePin(); 608 627 } 609 VOID StopFilter() throw()628 VOID StopFilter() 610 629 { 611 630 m_pOutputPin->StopPin(); 612 631 } 613 const CObjectPtr<COutputPin>& GetOutputPin() const throw()632 const CObjectPtr<COutputPin>& GetOutputPin() const 614 633 { 615 634 return m_pOutputPin; … … 643 662 m_pRequestedMediaType = pMediaType; 644 663 } 645 const CMediaType& GetRequestedMediaType() const throw()664 const CMediaType& GetRequestedMediaType() const 646 665 { 647 666 return m_pRequestedMediaType; 648 667 } 649 BOOL GetWeave() const throw()668 BOOL GetWeave() const 650 669 { 651 670 CRoCriticalSectionLock DataLock(GetDataCriticalSection()); 652 671 return m_bWeave; 653 672 } 654 VOID SetWeave(BOOL bWeave) throw()673 VOID SetWeave(BOOL bWeave) 655 674 { 656 675 CRoCriticalSectionLock DataLock(GetDataCriticalSection()); 657 676 m_bWeave = bWeave; 658 677 } 659 BOOL GetColorize() const throw()678 BOOL GetColorize() const 660 679 { 661 680 CRoCriticalSectionLock DataLock(GetDataCriticalSection()); 662 681 return m_bColorize; 663 682 } 664 VOID SetColorize(BOOL bColorize) throw()683 VOID SetColorize(BOOL bColorize) 665 684 { 666 685 CRoCriticalSectionLock DataLock(GetDataCriticalSection()); … … 684 703 public: 685 704 // CAmGraphBuilderCallback 686 CAmGraphBuilderCallback() throw()705 CAmGraphBuilderCallback() 687 706 { 688 707 _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); 689 708 } 690 ~CAmGraphBuilderCallback() throw()709 ~CAmGraphBuilderCallback() 691 710 { 692 711 _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); … … 700 719 701 720 // IAMGraphBuilderCallback 702 STDMETHOD(SelectedFilter)(IMoniker* pMoniker) throw()721 STDMETHOD(SelectedFilter)(IMoniker* pMoniker) 703 722 { 704 723 _Z5(atlTraceCOM, 5, _T("...\n")); … … 724 743 return S_OK; 725 744 } 726 STDMETHOD(CreatedFilter)(IBaseFilter* pBaseFilter) throw()745 STDMETHOD(CreatedFilter)(IBaseFilter* pBaseFilter) 727 746 { 728 747 _Z5(atlTraceCOM, 5, _T("...\n")); … … 741 760 742 761 //////////////////////////////////////////////////// 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 //////////////////////////////////////////////////// 743 885 // CVmr7PropertyPage 744 886 745 887 class CVmr7PropertyPage : 746 888 public CPropertyPageT<CVmr7PropertyPage>, 747 public CDialogResize<CVmr7PropertyPage> 889 public CDialogResize<CVmr7PropertyPage>, 890 public CVrPropertyPageT<CVmr7PropertyPage> 748 891 { 749 892 public: … … 829 972 } 830 973 831 // Window Message Hand elrs974 // Window Message Handlers 832 975 LRESULT OnInitDialog(HWND, LPARAM) 833 976 { … … 864 1007 return 0; 865 1008 } 866 LRESULT OnDestroy() throw()1009 LRESULT OnDestroy() 867 1010 { 868 1011 if(m_FilterGraph.m_pMediaControl) … … 979 1122 _ATLTRY 980 1123 { 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); 991 1125 } 992 1126 _ATLCATCHALL() … … 1016 1150 class CVmr9PropertyPage : 1017 1151 public CPropertyPageT<CVmr9PropertyPage>, 1018 public CDialogResize<CVmr9PropertyPage> 1152 public CDialogResize<CVmr9PropertyPage>, 1153 public CVrPropertyPageT<CVmr9PropertyPage> 1019 1154 { 1020 1155 public: … … 1100 1235 } 1101 1236 1102 // Window Message Hand elrs1237 // Window Message Handlers 1103 1238 LRESULT OnInitDialog(HWND, LPARAM) 1104 1239 { … … 1118 1253 pAmGraphBuilderCallback.Construct(); 1119 1254 pAmGraphBuilderCallback->SetGraphBuilder(m_FilterGraph.m_pFilterGraph); 1255 1120 1256 const CComPtr<IBaseFilter> pBaseFilter = m_RendererWindow.CoCreateBaseFilterInstance(); 1121 1257 __C(m_FilterGraph->AddFilter(pBaseFilter, CT2CW(_T("VMR-9")))); … … 1132 1268 __C(m_FilterGraph->Connect(pSourceFilter->GetOutputPin(), _FilterGraphHelper::GetFilterPin(m_RendererWindow.m_pBaseFilter))); 1133 1269 __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 1134 1335 UpdateControls(); 1135 1336 return 0; 1136 1337 } 1137 LRESULT OnDestroy() throw()1338 LRESULT OnDestroy() 1138 1339 { 1139 1340 if(m_FilterGraph.m_pMediaControl) … … 1250 1451 _ATLTRY 1251 1452 { 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); 1262 1454 } 1263 1455 _ATLCATCHALL() … … 1287 1479 class CEvrPropertyPage : 1288 1480 public CPropertyPageT<CEvrPropertyPage>, 1289 public CDialogResize<CEvrPropertyPage> 1481 public CDialogResize<CEvrPropertyPage>, 1482 public CVrPropertyPageT<CEvrPropertyPage> 1290 1483 { 1291 1484 public: … … 1371 1564 } 1372 1565 1373 // Window Message Hand elrs1566 // Window Message Handlers 1374 1567 LRESULT OnInitDialog(HWND, LPARAM) 1375 1568 { … … 1406 1599 return 0; 1407 1600 } 1408 LRESULT OnDestroy() throw()1601 LRESULT OnDestroy() 1409 1602 { 1410 1603 if(m_FilterGraph.m_pMediaControl) … … 1522 1715 _ATLTRY 1523 1716 { 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); 1534 1718 } 1535 1719 _ATLCATCHALL() … … 1567 1751 m_EvrPropertyPage(this) 1568 1752 { 1569 AddPage(m_Vmr7PropertyPage);1753 //AddPage(m_Vmr7PropertyPage); 1570 1754 AddPage(m_Vmr9PropertyPage); 1571 AddPage(m_EvrPropertyPage);1755 //AddPage(m_EvrPropertyPage); 1572 1756 } 1573 1757 BOOL SetInitialPosition() … … 1602 1786 } 1603 1787 1604 // Window Message Hand elrs1788 // Window Message Handlers 1605 1789 LRESULT OnSetLargerInitialPosition(UINT, WPARAM, LPARAM) 1606 1790 { -
trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.cpp
r74 r295 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 22 // Copyright (C) Roman Ryltsov, 2008-2014 3 3 // Created by Roman Ryltsov roman@alax.info 4 //5 // $Id$6 4 7 5 #include "stdafx.h" … … 25 23 public: 26 24 // CRenderInterlacedVideoModule 27 CRenderInterlacedVideoModule() throw()25 CRenderInterlacedVideoModule() 28 26 { 29 #if defined(_DEBUG) 30 AtlTraceLoadSettings(NULL); 31 #endif // defined(_DEBUG) 27 AtlTraceSetDefaultSettings(); 32 28 _W(CExceptionFilter::Initialize()); 33 _Z4 (atlTraceRefcount, 4, _T("this 0x%p\n"), this);29 _Z4_THIS(); 34 30 } 35 ~CRenderInterlacedVideoModule() throw()31 ~CRenderInterlacedVideoModule() 36 32 { 37 _Z4 (atlTraceRefcount, 4, _T("this 0x%p\n"), this);33 _Z4_THIS(); 38 34 CExceptionFilter::Terminate(); 39 35 } 40 HRESULT PreMessageLoop(INT nShowCommand) throw()36 HRESULT PreMessageLoop(INT nShowCommand) 41 37 { 42 38 _ATLTRY … … 53 49 return S_OK; 54 50 } 55 VOID RunMessageLoop() throw()51 VOID RunMessageLoop() 56 52 { 57 53 Lock(); … … 67 63 Unlock(); 68 64 } 69 HRESULT PostMessageLoop() throw()65 HRESULT PostMessageLoop() 70 66 { 71 67 _ATLTRY -
trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.idl
r74 r295 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 22 // Copyright (C) Roman Ryltsov, 2008-2014 3 3 // Created by Roman Ryltsov roman@alax.info 4 //5 // $Id$6 4 7 5 import "oaidl.idl"; -
trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.sln
r74 r295 1 1 2 2 Microsoft Visual Studio Solution File, Format Version 11.00 3 # Visual Studio 201 03 # Visual Studio 2012 4 4 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderInterlacedVideo", "RenderInterlacedVideo.vcxproj", "{D5F58BC2-453A-4C4E-888E-9C7C511D8FD4}" 5 5 EndProject -
trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.vcxproj
r74 r295 566 566 <None Include="Information.ico" /> 567 567 <None Include="Module.ico" /> 568 <None Include="ReadMe.txt" />569 568 <None Include="RenderInterlacedVideo.rgs" /> 570 569 </ItemGroup> -
trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo.vcxproj.filters
r74 r295 53 53 </ItemGroup> 54 54 <ItemGroup> 55 <None Include="ReadMe.txt" />56 55 <None Include="RenderInterlacedVideo.rgs"> 57 56 <Filter>Resource Files</Filter> -
trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo_i.c
r75 r295 7 7 8 8 /* File created by MIDL compiler version 7.00.0555 */ 9 /* at Sun Ju l 15 14:15:39 20129 /* at Sun Jun 15 11:37:54 2014 10 10 */ 11 11 /* Compiler settings for RenderInterlacedVideo.idl: -
trunk/Utilities/RenderInterlacedVideo/RenderInterlacedVideo_i.h
r75 r295 5 5 6 6 /* File created by MIDL compiler version 7.00.0555 */ 7 /* at Sun Ju l 15 14:15:39 20127 /* at Sun Jun 15 11:37:54 2014 8 8 */ 9 9 /* Compiler settings for RenderInterlacedVideo.idl: -
trunk/Utilities/RenderInterlacedVideo/stdafx.cpp
r74 r295 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 22 // Copyright (C) Roman Ryltsov, 2008-2014 3 3 // Created by Roman Ryltsov roman@alax.info 4 //5 // $Id$6 4 7 5 #include "stdafx.h" -
trunk/Utilities/RenderInterlacedVideo/stdafx.h
r74 r295 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-2014 2 3 // Created by Roman Ryltsov roman@alax.info 3 // $Id$4 4 5 5 #pragma once -
trunk/Utilities/RenderInterlacedVideo/targetver.h
r74 r295 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 22 // Copyright (C) Roman Ryltsov, 2008-2014 3 3 // Created by Roman Ryltsov roman@alax.info 4 //5 // $Id$6 4 7 5 #pragma once
Note: See TracChangeset
for help on using the changeset viewer.