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.

93 lines
2.9KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav 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. * Libav 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 Libav; 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_INTERNAL_H
  19. #define AVUTIL_HWCONTEXT_INTERNAL_H
  20. #include <stddef.h>
  21. #include "buffer.h"
  22. #include "hwcontext.h"
  23. #include "frame.h"
  24. #include "pixfmt.h"
  25. typedef struct HWContextType {
  26. enum AVHWDeviceType type;
  27. const char *name;
  28. /**
  29. * An array of pixel formats supported by the AVHWFramesContext instances
  30. * Terminated by AV_PIX_FMT_NONE.
  31. */
  32. const enum AVPixelFormat *pix_fmts;
  33. /**
  34. * size of the public hardware-specific context,
  35. * i.e. AVHWDeviceContext.hwctx
  36. */
  37. size_t device_hwctx_size;
  38. /**
  39. * size of the private data, i.e.
  40. * AVHWDeviceInternal.priv
  41. */
  42. size_t device_priv_size;
  43. /**
  44. * size of the public frame pool hardware-specific context,
  45. * i.e. AVHWFramesContext.hwctx
  46. */
  47. size_t frames_hwctx_size;
  48. /**
  49. * size of the private data, i.e.
  50. * AVHWFramesInternal.priv
  51. */
  52. size_t frames_priv_size;
  53. int (*device_init)(AVHWDeviceContext *ctx);
  54. void (*device_uninit)(AVHWDeviceContext *ctx);
  55. int (*frames_init)(AVHWFramesContext *ctx);
  56. void (*frames_uninit)(AVHWFramesContext *ctx);
  57. int (*frames_get_buffer)(AVHWFramesContext *ctx, AVFrame *frame);
  58. int (*transfer_get_formats)(AVHWFramesContext *ctx,
  59. enum AVHWFrameTransferDirection dir,
  60. enum AVPixelFormat **formats);
  61. int (*transfer_data_to)(AVHWFramesContext *ctx, AVFrame *dst,
  62. const AVFrame *src);
  63. int (*transfer_data_from)(AVHWFramesContext *ctx, AVFrame *dst,
  64. const AVFrame *src);
  65. } HWContextType;
  66. struct AVHWDeviceInternal {
  67. const HWContextType *hw_type;
  68. void *priv;
  69. };
  70. struct AVHWFramesInternal {
  71. const HWContextType *hw_type;
  72. void *priv;
  73. AVBufferPool *pool_internal;
  74. };
  75. extern const HWContextType ff_hwcontext_type_cuda;
  76. extern const HWContextType ff_hwcontext_type_vdpau;
  77. #endif /* AVUTIL_HWCONTEXT_INTERNAL_H */