icinfo.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright 1999 Marcus Meissner
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  17. */
  18. #include <stdio.h>
  19. #include <string.h>
  20. #include "windows.h"
  21. #include "mmsystem.h"
  22. #include "vfw.h"
  23. static int WINAPIV mywprintf(const WCHAR *format, ...)
  24. {
  25. static char output_bufA[65536];
  26. static WCHAR output_bufW[sizeof(output_bufA)];
  27. va_list parms;
  28. DWORD nOut;
  29. BOOL res = FALSE;
  30. HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
  31. va_start(parms, format);
  32. vswprintf(output_bufW, ARRAY_SIZE(output_bufW), format, parms);
  33. va_end(parms);
  34. /* Try to write as unicode whenever we think it's a console */
  35. if (((DWORD_PTR)hout & 3) == 3)
  36. {
  37. res = WriteConsoleW(hout, output_bufW, lstrlenW(output_bufW), &nOut, NULL);
  38. }
  39. else
  40. {
  41. DWORD convertedChars;
  42. /* Convert to OEM, then output */
  43. convertedChars = WideCharToMultiByte(GetConsoleOutputCP(), 0, output_bufW, -1,
  44. output_bufA, sizeof(output_bufA),
  45. NULL, NULL);
  46. res = WriteFile(hout, output_bufA, convertedChars, &nOut, FALSE);
  47. }
  48. return res ? nOut : 0;
  49. }
  50. int __cdecl wmain(int argc, WCHAR* argv[])
  51. {
  52. int i, n=0,doabout=0,doconfigure=0;
  53. for (i = 1; i < argc; i++) {
  54. if (!lstrcmpW(argv[i], L"-about"))
  55. doabout = 1;
  56. else if (!lstrcmpW(argv[i], L"-configure"))
  57. doconfigure = 1;
  58. else {
  59. mywprintf(L"Unknown option: %s\n", argv[i]);
  60. return -1;
  61. }
  62. }
  63. mywprintf(L"%s", L"Currently installed Video Compressors:\n");
  64. while (1) {
  65. ICINFO ii;
  66. HIC hic;
  67. ii.dwSize = sizeof(ii);
  68. if (!ICInfo(ICTYPE_VIDEO,n++,&ii))
  69. break;
  70. if (!(hic=ICOpen(ii.fccType,ii.fccHandler,ICMODE_QUERY)))
  71. continue;
  72. if (!ICGetInfo(hic,&ii,sizeof(ii))) {
  73. ICClose(hic);
  74. continue;
  75. }
  76. mywprintf(L"%c%c%c%c.%c%c%c%c: %s\n",
  77. LOBYTE(ii.fccType),LOBYTE(ii.fccType>>8),LOBYTE(ii.fccType>>16),LOBYTE(ii.fccType>>24),
  78. LOBYTE(ii.fccHandler),LOBYTE(ii.fccHandler>>8),LOBYTE(ii.fccHandler>>16),LOBYTE(ii.fccHandler>>24),
  79. ii.szName);
  80. mywprintf(L"\tdwFlags: 0x%08x (",ii.dwFlags);
  81. if (ii.dwFlags & VIDCF_QUALITY) mywprintf(L"%s ", L"VIDCF_QUALITY");
  82. if (ii.dwFlags & VIDCF_CRUNCH) mywprintf(L"%s ", L"VIDCF_CRUNCH");
  83. if (ii.dwFlags & VIDCF_TEMPORAL) mywprintf(L"%s ", L"VIDCF_TEMPORAL");
  84. if (ii.dwFlags & VIDCF_COMPRESSFRAMES) mywprintf(L"%s ", L"VIDCF_COMPRESSFRAMES");
  85. if (ii.dwFlags & VIDCF_DRAW) mywprintf(L"%s ", L"VIDCF_DRAW");
  86. if (ii.dwFlags & VIDCF_FASTTEMPORALC) mywprintf(L"%s ", L"VIDCF_FASTTEMPORALC");
  87. if (ii.dwFlags & VIDCF_FASTTEMPORALD) mywprintf(L"%s ", L"VIDCF_FASTTEMPORALD");
  88. if (ii.dwFlags & VIDCF_QUALITYTIME) mywprintf(L"%s ", L"VIDCF_QUALITYTIME");
  89. mywprintf(L"%s", L")\n");
  90. mywprintf(L"\tdwVersion: 0x%08x\n", ii.dwVersion);
  91. mywprintf(L"\tdwVersionICM: 0x%08x\n", ii.dwVersionICM);
  92. mywprintf(L"\tszDescription: %s\n", ii.szDescription);
  93. if (doabout) ICAbout(hic,0);
  94. if (doconfigure && ICQueryConfigure(hic))
  95. ICConfigure(hic,0);
  96. ICClose(hic);
  97. }
  98. return 0;
  99. }