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.

62 lines
1.7KB

  1. /*
  2. * HW decode acceleration through CUVID
  3. *
  4. * Copyright (c) 2016 Anton Khirnov
  5. *
  6. * This file is part of Libav.
  7. *
  8. * Libav is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * Libav is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with Libav; if not, write to the Free Software Foundation,
  20. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #ifndef AVCODEC_CUVID_H
  23. #define AVCODEC_CUVID_H
  24. #include <cuviddec.h>
  25. #include <stdint.h>
  26. #include "libavutil/buffer.h"
  27. #include "libavutil/frame.h"
  28. #include "avcodec.h"
  29. typedef struct CUVIDFrame {
  30. unsigned int idx;
  31. AVBufferRef *idx_ref;
  32. AVBufferRef *decoder_ref;
  33. } CUVIDFrame;
  34. typedef struct CUVIDContext {
  35. CUVIDPICPARAMS pic_params;
  36. AVBufferPool *decoder_pool;
  37. AVBufferRef *decoder_ref;
  38. uint8_t *bitstream;
  39. int bitstream_len;
  40. unsigned int bitstream_allocated;
  41. unsigned *slice_offsets;
  42. int nb_slices;
  43. unsigned int slice_offsets_allocated;
  44. } CUVIDContext;
  45. int ff_cuvid_decode_init(AVCodecContext *avctx, unsigned int dpb_size);
  46. int ff_cuvid_decode_uninit(AVCodecContext *avctx);
  47. int ff_cuvid_start_frame(AVCodecContext *avctx, AVFrame *frame);
  48. int ff_cuvid_end_frame(AVCodecContext *avctx);
  49. #endif /* AVCODEC_CUVID_H */