Changeset 186 for trunk/Utilities/WindowsMediaCodecList/MainDialog.h
- Timestamp:
- Jun 28, 2013, 6:19:16 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/WindowsMediaCodecList/MainDialog.h
r67 r186 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 200 9-20122 // Copyright (C) Roman Ryltsov, 2008-2013 3 3 // Created by Roman Ryltsov roman@alax.info 4 //5 // $Id$6 4 7 5 #pragma once … … 476 474 { 477 475 if(!m_pCodecFormatData->m_sDescription.IsEmpty()) 476 { 478 477 sText.AppendFormat(_T("Description: %ls\r\n"), m_pCodecFormatData->m_sDescription); 478 sText.Append(_T("\r\n")); 479 } 480 #pragma region Interfaces 481 if(m_pCodecFormatData->m_pWmStreamConfig) 482 { 483 sText += AtlFormatString(_T("Interfaces:") _T("\r\n")); 484 static const struct 485 { 486 const IID* pIdentifier; 487 LPCSTR pszName; 488 } g_pMap[] = 489 { 490 #define A(x) { &__uuidof(x), #x }, 491 A(IWMMediaProps) 492 A(IWMStreamConfig) 493 A(IWMStreamConfig2) 494 A(IWMStreamConfig3) 495 A(IWMVideoMediaProps) 496 #undef A 497 }; 498 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 499 { 500 CComPtr<IUnknown> pUnknown; 501 m_pCodecFormatData->m_pWmStreamConfig->QueryInterface(*g_pMap[nIndex].pIdentifier, (VOID**) &pUnknown); 502 if(pUnknown) 503 sText += AtlFormatString(_T(" ") _T("%hs") _T("\r\n"), g_pMap[nIndex].pszName); 504 } 505 sText.Append(_T("\r\n")); 506 } 507 #pragma endregion 508 #pragma region Media Type 479 509 if(m_pCodecFormatData->m_pMediaType) 480 510 { 481 sText.Append(_T("\r\n"));482 511 sText.Append(_T("AM_MEDIA_TYPE:\r\n")); 483 512 const CMediaType& pMediaType = reinterpret_cast<const CMediaType&>(m_pCodecFormatData->m_pMediaType); … … 514 543 #pragma endregion 515 544 sText.AppendFormat(_T(" cbFormat: %s\r\n"), _StringHelper::FormatNumber((LONG) pMediaType->cbFormat)); 545 #pragma region FORMAT_VideoInfo 516 546 if(pMediaType->formattype == FORMAT_VideoInfo) 517 547 { … … 538 568 //biClrUsed; 539 569 //biClrImportant; 570 sText.Append(_T("\r\n")); 571 540 572 } else 573 #pragma endregion 574 #pragma region FORMAT_VideoInfo2 541 575 if(pMediaType->formattype == FORMAT_VideoInfo2) 542 576 { … … 572 606 //biClrImportant; 573 607 } else 608 #pragma endregion 609 #pragma region FORMAT_WaveFormatEx 574 610 if(pMediaType->formattype == FORMAT_WaveFormatEx) 575 611 { … … 596 632 sText.AppendFormat(_T(" %s\r\n"), StringFromData((const BYTE*) (pWaveFormatEx + 1), pWaveFormatEx->cbSize)); 597 633 } 598 } 634 #pragma endregion 635 } 636 #pragma endregion 637 #pragma region IWMMediaProps 638 const CComQIPtr<IWMMediaProps> pWmMediaProps = m_pCodecFormatData->m_pWmStreamConfig; 639 if(pWmMediaProps) 640 _ATLTRY 641 { 642 GUID Type = GUID_NULL; 643 __C(pWmMediaProps->GetType(&Type)); 644 sText.Append(_T("IWMMediaProps:\r\n")); 645 sText.AppendFormat(_T(" ") _T("Type: %ls") _T("\r\n"), _FilterGraphHelper::FormatMajorType(Type)); 646 sText.Append(_T("\r\n")); 647 } 648 _ATLCATCHALL() 649 { 650 _Z_EXCEPTION(); 651 } 652 #pragma endregion 653 #pragma region IWMStreamConfig 654 const CComQIPtr<IWMStreamConfig> pWmStreamConfig = m_pCodecFormatData->m_pWmStreamConfig; 655 if(pWmStreamConfig) 656 _ATLTRY 657 { 658 GUID StreamType = GUID_NULL; 659 __C(pWmStreamConfig->GetStreamType(&StreamType)); 660 WORD nStreamNumber = 0; 661 __C(pWmStreamConfig->GetStreamNumber(&nStreamNumber)); 662 WORD nStreamNameLength = 0; 663 pWmStreamConfig->GetStreamName(NULL, &nStreamNameLength); 664 CTempBufferT<WCHAR> pszStreamName(nStreamNameLength + 1); 665 __C(pWmStreamConfig->GetStreamName(pszStreamName, &nStreamNameLength)); 666 WORD nConnectionNameLength = 0; 667 pWmStreamConfig->GetConnectionName(NULL, &nConnectionNameLength); 668 CTempBufferT<WCHAR> pszConnectionName(nConnectionNameLength + 1); 669 __C(pWmStreamConfig->GetConnectionName(pszConnectionName, &nConnectionNameLength)); 670 DWORD nBitrate = 0; 671 __C(pWmStreamConfig->GetBitrate(&nBitrate)); 672 DWORD nBufferWindow = 0; 673 __C(pWmStreamConfig->GetBufferWindow(&nBufferWindow)); 674 sText.Append(_T("IWMStreamConfig:\r\n")); 675 sText.AppendFormat(_T(" ") _T("StreamType: %ls") _T("\r\n"), _FilterGraphHelper::FormatMajorType(StreamType)); 676 sText.AppendFormat(_T(" ") _T("StreamNumber: %d") _T("\r\n"), nStreamNumber); 677 if(wcslen(pszStreamName)) 678 sText.AppendFormat(_T(" ") _T("StreamName: %ls") _T("\r\n"), (LPCWSTR) pszStreamName); 679 if(wcslen(pszConnectionName)) 680 sText.AppendFormat(_T(" ") _T("ConnectionName: %ls") _T("\r\n"), (LPCWSTR) pszConnectionName); 681 sText.AppendFormat(_T(" ") _T("Bitrate: %d") _T("\r\n"), nBitrate); 682 sText.AppendFormat(_T(" ") _T("BufferWindow: %d") _T("\r\n"), nBufferWindow); 683 sText.Append(_T("\r\n")); 684 } 685 _ATLCATCHALL() 686 { 687 _Z_EXCEPTION(); 688 } 689 #pragma endregion 690 #pragma region IWMStreamConfig2 691 const CComQIPtr<IWMStreamConfig2> pWmStreamConfig2 = m_pCodecFormatData->m_pWmStreamConfig; 692 if(pWmStreamConfig2) 693 _ATLTRY 694 { 695 WMT_TRANSPORT_TYPE TransportType; 696 __C(pWmStreamConfig2->GetTransportType(&TransportType)); 697 WORD nDataUnitExtensionCount = 0; 698 pWmStreamConfig2->GetDataUnitExtensionCount(&nDataUnitExtensionCount); 699 for(WORD nDataUnitExtensionIndex = 0; nDataUnitExtensionIndex < nDataUnitExtensionCount; nDataUnitExtensionIndex++) 700 { 701 GUID Identifier = GUID_NULL; 702 WORD nSize = 0; 703 DWORD nInformationSize = 0; 704 __C(pWmStreamConfig2->GetDataUnitExtension(nDataUnitExtensionIndex, &Identifier, &nSize, NULL, &nInformationSize)); 705 } 706 sText.Append(_T("IWMStreamConfig2:\r\n")); 707 sText.AppendFormat(_T(" ") _T("TransportType: %d") _T("\r\n"), TransportType); 708 if(nDataUnitExtensionCount) 709 sText.AppendFormat(_T(" ") _T("DataUnitExtensionCount: %d") _T("\r\n"), nDataUnitExtensionCount); 710 sText.Append(_T("\r\n")); 711 } 712 _ATLCATCHALL() 713 { 714 _Z_EXCEPTION(); 715 } 716 #pragma endregion 717 #pragma region IWMStreamConfig3 718 const CComQIPtr<IWMStreamConfig3> pWmStreamConfig3 = m_pCodecFormatData->m_pWmStreamConfig; 719 if(pWmStreamConfig3) 720 _ATLTRY 721 { 722 WORD nLanguageStringLength = 0; 723 pWmStreamConfig3->GetLanguage(NULL, &nLanguageStringLength); 724 CTempBufferT<WCHAR> pszLanguageString(nLanguageStringLength + 1); 725 __C(pWmStreamConfig3->GetLanguage(pszLanguageString, &nLanguageStringLength)); 726 if(wcslen(pszLanguageString)) 727 { 728 sText.Append(_T("IWMStreamConfig3:\r\n")); 729 if(wcslen(pszLanguageString)) 730 sText.AppendFormat(_T(" ") _T("Language: %ls") _T("\r\n"), (LPCWSTR) pszLanguageString); 731 sText.Append(_T("\r\n")); 732 } 733 } 734 _ATLCATCHALL() 735 { 736 _Z_EXCEPTION(); 737 } 738 #pragma endregion 739 #pragma region IWMVideoMediaProps 740 const CComQIPtr<IWMVideoMediaProps> pWmVideoMediaProps = m_pCodecFormatData->m_pWmStreamConfig; 741 if(pWmVideoMediaProps) 742 _ATLTRY 743 { 744 LONGLONG nMaximalKeyFrameIntervalTime = 0; 745 __C(pWmVideoMediaProps->GetMaxKeyFrameSpacing(&nMaximalKeyFrameIntervalTime)); 746 DWORD nQuality = 0; 747 __C(pWmVideoMediaProps->GetQuality(&nQuality)); 748 sText.Append(_T("IWMVideoMediaProps:\r\n")); 749 sText.AppendFormat(_T(" ") _T("MaxKeyFrameSpacing: %s") _T("\r\n"), _FilterGraphHelper::FormatReferenceTime(nMaximalKeyFrameIntervalTime)); 750 sText.AppendFormat(_T(" ") _T("Quality: %d") _T("\r\n"), nQuality); 751 sText.Append(_T("\r\n")); 752 } 753 _ATLCATCHALL() 754 { 755 _Z_EXCEPTION(); 756 } 757 #pragma endregion 599 758 } 600 759 sText.Trim(_T("\t\n\r .")); … … 1026 1185 LRESULT OnCopyButtonClicked(UINT, INT, HWND) 1027 1186 { 1028 CStringW sText(GetSubmissionText()); 1029 __E(OpenClipboard()); 1030 _ATLTRY 1031 { 1032 __E(EmptyClipboard()); 1033 CGlobalMemoryHandle TextHandle; 1034 TextHandle.Alloc((sText.GetLength() + 1) * sizeof (WCHAR), GMEM_MOVEABLE | GMEM_SHARE); 1035 wcscpy_s(CGlobalMemoryHandle::CLockT<WCHAR>(TextHandle), sText.GetLength() + 1, sText); 1036 __E(SetClipboardData(CF_UNICODETEXT, TextHandle)); 1037 TextHandle.Detach(); 1038 MessageBeep(MB_OK); 1039 } 1040 _ATLCATCHALL() 1041 { 1042 _W(CloseClipboard()); 1043 _ATLRETHROW; 1044 } 1045 _W(CloseClipboard()); 1187 SetClipboardText(m_hWnd, GetSubmissionText()); 1188 MessageBeep(MB_OK); 1046 1189 return 0; 1047 1190 } … … 1049 1192 { 1050 1193 CWaitCursor WaitCursor; 1194 const CString sFileDescription = _VersionInfoHelper::GetString(_VersionInfoHelper::GetModulePath(), _T("FileDescription")); 1051 1195 CWinHttpPostData PostData; 1052 PostData.AddValue(_T("subj"), _T("Alax.Info Windows Media Codec List"));1196 PostData.AddValue(_T("subj"), sFileDescription); 1053 1197 CStringA sTextA = Utf8StringFromString(GetSubmissionText()); 1054 1198 PostData.AddValue(_T("body"), _Base64Helper::Encode<CString>((const BYTE*) (LPCSTR) sTextA, sTextA.GetLength(), _Base64Helper::FLAG_NOPAD | _Base64Helper::FLAG_NOCRLF)); … … 1065 1209 DWORD nStatusCode = 0; 1066 1210 __E(Request.QueryNumberHeader(WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, nStatusCode)); 1067 __D(nStatusCode == HTTP_STATUS_OK, MAKE_HRESULT(SEVERITY_ERROR, FACILITY_HTTP, nStatusCode));1211 __D(nStatusCode / 100 == HTTP_STATUS_OK / 100, MAKE_HRESULT(SEVERITY_ERROR, FACILITY_HTTP, nStatusCode)); 1068 1212 AtlMessageBoxEx(m_hWnd, _T("Submission complete, thank you!"), IDS_INFORMATION, MB_ICONINFORMATION | MB_OK); 1069 1213 return 0;
Note: See TracChangeset
for help on using the changeset viewer.