Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.0 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dpvautil.cpp
  6. * Content: Source file for ACM utils
  7. *
  8. * History:
  9. * Date By Reason
  10. * =========== =========== ====================
  11. * 10/27/99 rodtoll created
  12. * 12/16/99 rodtoll Bug #123250 - Insert proper names/descriptions for codecs
  13. * Codec names now based on resource entries for format and
  14. * names are constructed using ACM names + bitrate.
  15. * 04/21/2000 rodtoll Bug #32889 - Does not run on Win2k on non-admin account
  16. * 06/28/2000 rodtoll Prefix Bug #38034
  17. * 02/25/2002 rodtoll WINBUG #552283: Reduce attack surface / dead code removal
  18. * Removed ability to load arbitrary ACM codecs. Removed dead
  19. * dead code associated with it.
  20. *
  21. ***************************************************************************/
  22. #include "dpvacmpch.h"
  23. // Check to see if ACM's PCM converter is available
  24. #undef DPF_MODNAME
  25. #define DPF_MODNAME "IsPCMConverterAvailable"
  26. HRESULT IsPCMConverterAvailable()
  27. {
  28. MMRESULT mmr;
  29. HACMSTREAM has = NULL;
  30. HACMDRIVERID acDriverID = NULL;
  31. HRESULT hr;
  32. CWaveFormat wfxOuterFormat, wfxInnerFormat;
  33. hr = wfxOuterFormat.InitializePCM( 22050, FALSE, 8 );
  34. if( FAILED( hr ) )
  35. {
  36. DPFX(DPFPREP, DVF_ERRORLEVEL, "Error building outer format PCM hr=0x%x", hr );
  37. return hr;
  38. }
  39. hr = wfxInnerFormat.InitializePCM( 8000, FALSE, 16 );
  40. if( FAILED( hr ) )
  41. {
  42. DPFX(DPFPREP, DVF_ERRORLEVEL, "Error building inner format PCM hr=0x%x", hr );
  43. return hr;
  44. }
  45. // Attempt to open
  46. mmr = acmStreamOpen( &has, NULL, wfxOuterFormat.GetFormat(), wfxInnerFormat.GetFormat(), NULL, 0, 0, ACM_STREAMOPENF_NONREALTIME );
  47. if( mmr != 0 )
  48. {
  49. DPFX(DPFPREP, DVF_ERRORLEVEL, "Compression type driver disabled or not installed. mmr=0x%x", mmr );
  50. return DVERR_COMPRESSIONNOTSUPPORTED;
  51. }
  52. acmStreamClose( has, 0 );
  53. return DV_OK;
  54. }