hwcontext_dxva2.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg 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. * FFmpeg 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 FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVUTIL_HWCONTEXT_DXVA2_H
  19. #define AVUTIL_HWCONTEXT_DXVA2_H
  20. /**
  21. * @file
  22. * An API-specific header for AV_HWDEVICE_TYPE_DXVA2.
  23. *
  24. * Only fixed-size pools are supported.
  25. *
  26. * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
  27. * with the data pointer set to a pointer to IDirect3DSurface9.
  28. */
  29. #include <d3d9.h>
  30. #include <dxva2api.h>
  31. /**
  32. * This struct is allocated as AVHWDeviceContext.hwctx
  33. */
  34. typedef struct AVDXVA2DeviceContext {
  35. IDirect3DDeviceManager9 *devmgr;
  36. } AVDXVA2DeviceContext;
  37. /**
  38. * This struct is allocated as AVHWFramesContext.hwctx
  39. */
  40. typedef struct AVDXVA2FramesContext {
  41. /**
  42. * The surface type (e.g. DXVA2_VideoProcessorRenderTarget or
  43. * DXVA2_VideoDecoderRenderTarget). Must be set by the caller.
  44. */
  45. DWORD surface_type;
  46. /**
  47. * The surface pool. When an external pool is not provided by the caller,
  48. * this will be managed (allocated and filled on init, freed on uninit) by
  49. * libavutil.
  50. */
  51. IDirect3DSurface9 **surfaces;
  52. int nb_surfaces;
  53. /**
  54. * Certain drivers require the decoder to be destroyed before the surfaces.
  55. * To allow internally managed pools to work properly in such cases, this
  56. * field is provided.
  57. *
  58. * If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on
  59. * it just before the internal surface pool is freed.
  60. *
  61. * This is for convenience only. Some code uses other methods to manage the
  62. * decoder reference.
  63. */
  64. IDirectXVideoDecoder *decoder_to_release;
  65. } AVDXVA2FramesContext;
  66. #endif /* AVUTIL_HWCONTEXT_DXVA2_H */