content/media/wmf/WMF.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/wmf/WMF.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,129 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef WMF_H_
    1.11 +#define WMF_H_
    1.12 +
    1.13 +#if WINVER < _WIN32_WINNT_WIN7
    1.14 +#error \
    1.15 +You must include WMF.h before including mozilla headers, \
    1.16 +otherwise mozconfig.h will be included \
    1.17 +and that sets WINVER to WinXP, \
    1.18 +which makes Windows Media Foundation unavailable.
    1.19 +#endif
    1.20 +
    1.21 +#pragma push_macro("WINVER")
    1.22 +#undef WINVER
    1.23 +#define WINVER _WIN32_WINNT_WIN7
    1.24 +
    1.25 +#include <windows.h>
    1.26 +#include <mfapi.h>
    1.27 +#include <mfidl.h>
    1.28 +#include <mfreadwrite.h>
    1.29 +#include <mfobjects.h>
    1.30 +#include <ks.h>
    1.31 +#include <stdio.h>
    1.32 +#include <mferror.h>
    1.33 +#include <propvarutil.h>
    1.34 +#include <wmcodecdsp.h>
    1.35 +#include <d3d9.h>
    1.36 +#include <dxva2api.h>
    1.37 +#include <wmcodecdsp.h>
    1.38 +#include <codecapi.h>
    1.39 +
    1.40 +// Some SDK versions don't define the AAC decoder CLSID.
    1.41 +#ifndef CLSID_CMSAACDecMFT
    1.42 +extern "C" const CLSID CLSID_CMSAACDecMFT;
    1.43 +#define WMF_MUST_DEFINE_AAC_MFT_CLSID
    1.44 +#endif
    1.45 +
    1.46 +namespace mozilla {
    1.47 +namespace wmf {
    1.48 +
    1.49 +// Loads/Unloads all the DLLs in which the WMF functions are located.
    1.50 +// The DLLs must be loaded before any of the WMF functions below will work.
    1.51 +// All the function definitions below are wrappers which locate the
    1.52 +// corresponding WMF function in the appropriate DLL (hence why LoadDLL()
    1.53 +// must be called first...).
    1.54 +HRESULT LoadDLLs();
    1.55 +HRESULT UnloadDLLs();
    1.56 +
    1.57 +// All functions below are wrappers around the corresponding WMF function,
    1.58 +// and automatically locate and call the corresponding function in the WMF DLLs.
    1.59 +
    1.60 +HRESULT MFStartup();
    1.61 +
    1.62 +HRESULT MFShutdown();
    1.63 +
    1.64 +HRESULT MFCreateAsyncResult(IUnknown *aUunkObject,
    1.65 +                            IMFAsyncCallback *aCallback,
    1.66 +                            IUnknown *aUnkState,
    1.67 +                            IMFAsyncResult **aOutAsyncResult);
    1.68 +
    1.69 +HRESULT MFInvokeCallback(IMFAsyncResult *aAsyncResult);
    1.70 +
    1.71 +HRESULT MFCreateMediaType(IMFMediaType **aOutMFType);
    1.72 +
    1.73 +HRESULT MFCreateSourceReaderFromByteStream(IMFByteStream *aByteStream,
    1.74 +                                           IMFAttributes *aAttributes,
    1.75 +                                           IMFSourceReader **aOutSourceReader);
    1.76 +
    1.77 +HRESULT PropVariantToUInt32(REFPROPVARIANT aPropvar, ULONG *aOutUL);
    1.78 +
    1.79 +HRESULT PropVariantToInt64(REFPROPVARIANT aPropVar, LONGLONG *aOutLL);
    1.80 +
    1.81 +HRESULT MFTGetInfo(CLSID aClsidMFT,
    1.82 +                   LPWSTR *aOutName,
    1.83 +                   MFT_REGISTER_TYPE_INFO **aOutInputTypes,
    1.84 +                   UINT32 *aOutNumInputTypes,
    1.85 +                   MFT_REGISTER_TYPE_INFO **aOutOutputTypes,
    1.86 +                   UINT32 *aOutNumOutputTypes,
    1.87 +                   IMFAttributes **aOutAttributes);
    1.88 +
    1.89 +HRESULT MFGetStrideForBitmapInfoHeader(DWORD aFormat,
    1.90 +                                       DWORD aWidth,
    1.91 +                                       LONG *aOutStride);
    1.92 +
    1.93 +// Note: We shouldn't use this in production code; it's really only
    1.94 +// here so we can compare behaviour of the SourceReader using WMF's
    1.95 +// byte stream and ours when debugging.
    1.96 +HRESULT MFCreateSourceReaderFromURL(LPCWSTR aURL,
    1.97 +                                    IMFAttributes *aAttributes,
    1.98 +                                    IMFSourceReader **aSourceReader);
    1.99 +
   1.100 +HRESULT MFCreateAttributes(IMFAttributes **ppMFAttributes, UINT32 cInitialSize);
   1.101 +
   1.102 +HRESULT MFGetPluginControl(IMFPluginControl **aOutPluginControl);
   1.103 +
   1.104 +HRESULT MFTEnumEx(GUID guidCategory,
   1.105 +                  UINT32 Flags,
   1.106 +                  const MFT_REGISTER_TYPE_INFO *pInputType,
   1.107 +                  const MFT_REGISTER_TYPE_INFO *pOutputType,
   1.108 +                  IMFActivate ***pppMFTActivate,
   1.109 +                  UINT32 *pcMFTActivate);
   1.110 +
   1.111 +HRESULT MFGetService(IUnknown *punkObject,
   1.112 +                     REFGUID guidService,
   1.113 +                     REFIID riid,
   1.114 +                     LPVOID *ppvObject);
   1.115 +
   1.116 +HRESULT DXVA2CreateDirect3DDeviceManager9(UINT *pResetToken,
   1.117 +                                          IDirect3DDeviceManager9 **ppDXVAManager);
   1.118 +
   1.119 +HRESULT MFCreateSample(IMFSample **ppIMFSample);
   1.120 +
   1.121 +HRESULT MFCreateAlignedMemoryBuffer(DWORD cbMaxLength,
   1.122 +                                    DWORD fAlignmentFlags,
   1.123 +                                    IMFMediaBuffer **ppBuffer);
   1.124 +
   1.125 +} // end namespace wmf
   1.126 +} // end namespace mozilla
   1.127 +
   1.128 +
   1.129 +
   1.130 +#pragma pop_macro("WINVER")
   1.131 +
   1.132 +#endif

mercurial