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.

111 lines
3.4KB

  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_VAAPI_H
  19. #define AVUTIL_HWCONTEXT_VAAPI_H
  20. #include <va/va.h>
  21. /**
  22. * @file
  23. * API-specific header for AV_HWDEVICE_TYPE_VAAPI.
  24. *
  25. * Dynamic frame pools are supported, but note that any pool used as a render
  26. * target is required to be of fixed size in order to be be usable as an
  27. * argument to vaCreateContext().
  28. *
  29. * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
  30. * with the data pointer set to a VASurfaceID.
  31. */
  32. enum {
  33. /**
  34. * The quirks field has been set by the user and should not be detected
  35. * automatically by av_hwdevice_ctx_init().
  36. */
  37. AV_VAAPI_DRIVER_QUIRK_USER_SET = (1 << 0),
  38. /**
  39. * The driver does not destroy parameter buffers when they are used by
  40. * vaRenderPicture(). Additional code will be required to destroy them
  41. * separately afterwards.
  42. */
  43. AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = (1 << 1),
  44. /**
  45. * The driver does not support the VASurfaceAttribMemoryType attribute,
  46. * so the surface allocation code will not try to use it.
  47. */
  48. AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2),
  49. };
  50. /**
  51. * VAAPI connection details.
  52. *
  53. * Allocated as AVHWDeviceContext.hwctx
  54. */
  55. typedef struct AVVAAPIDeviceContext {
  56. /**
  57. * The VADisplay handle, to be filled by the user.
  58. */
  59. VADisplay display;
  60. /**
  61. * Driver quirks to apply - this is filled by av_hwdevice_ctx_init(),
  62. * with reference to a table of known drivers, unless the
  63. * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user
  64. * may need to refer to this field when performing any later
  65. * operations using VAAPI with the same VADisplay.
  66. */
  67. unsigned int driver_quirks;
  68. } AVVAAPIDeviceContext;
  69. /**
  70. * VAAPI-specific data associated with a frame pool.
  71. *
  72. * Allocated as AVHWFramesContext.hwctx.
  73. */
  74. typedef struct AVVAAPIFramesContext {
  75. /**
  76. * Set by the user to apply surface attributes to all surfaces in
  77. * the frame pool. If null, default settings are used.
  78. */
  79. VASurfaceAttrib *attributes;
  80. int nb_attributes;
  81. /**
  82. * The surfaces IDs of all surfaces in the pool after creation.
  83. * Only valid if AVHWFramesContext.initial_pool_size was positive.
  84. * These are intended to be used as the render_targets arguments to
  85. * vaCreateContext().
  86. */
  87. VASurfaceID *surface_ids;
  88. int nb_surfaces;
  89. } AVVAAPIFramesContext;
  90. /**
  91. * VAAPI hardware pipeline configuration details.
  92. *
  93. * Allocated with av_hwdevice_hwconfig_alloc().
  94. */
  95. typedef struct AVVAAPIHWConfig {
  96. /**
  97. * ID of a VAAPI pipeline configuration.
  98. */
  99. VAConfigID config_id;
  100. } AVVAAPIHWConfig;
  101. #endif /* AVUTIL_HWCONTEXT_VAAPI_H */