| Line | Branch | Exec | Source |
|---|---|---|---|
| 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 | |||
| 19 | #ifndef AVCODEC_VAAPI_DECODE_H | ||
| 20 | #define AVCODEC_VAAPI_DECODE_H | ||
| 21 | |||
| 22 | #include <va/va.h> | ||
| 23 | |||
| 24 | #include "libavutil/frame.h" | ||
| 25 | #include "libavutil/hwcontext.h" | ||
| 26 | #include "libavutil/hwcontext_vaapi.h" | ||
| 27 | #include "libavutil/refstruct.h" | ||
| 28 | |||
| 29 | #include "avcodec.h" | ||
| 30 | |||
| 31 | ✗ | static inline VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic) | |
| 32 | { | ||
| 33 | ✗ | return (uintptr_t)pic->data[3]; | |
| 34 | } | ||
| 35 | |||
| 36 | typedef struct VAAPIDecodePicture { | ||
| 37 | VASurfaceID output_surface; | ||
| 38 | |||
| 39 | int nb_param_buffers; | ||
| 40 | VABufferID *param_buffers; | ||
| 41 | int nb_param_buffers_allocated; | ||
| 42 | |||
| 43 | int nb_slices; | ||
| 44 | VABufferID *slice_buffers; | ||
| 45 | int nb_slice_buffers_allocated; | ||
| 46 | } VAAPIDecodePicture; | ||
| 47 | |||
| 48 | typedef struct VAAPIDecodeContext { | ||
| 49 | VAConfigID va_config; | ||
| 50 | VAContextID va_context; | ||
| 51 | |||
| 52 | AVHWDeviceContext *device; | ||
| 53 | AVVAAPIDeviceContext *hwctx; | ||
| 54 | |||
| 55 | AVHWFramesContext *frames; | ||
| 56 | AVVAAPIFramesContext *hwfc; | ||
| 57 | |||
| 58 | enum AVPixelFormat surface_format; | ||
| 59 | int surface_count; | ||
| 60 | |||
| 61 | VASurfaceAttrib pixel_format_attribute; | ||
| 62 | } VAAPIDecodeContext; | ||
| 63 | |||
| 64 | |||
| 65 | int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, | ||
| 66 | VAAPIDecodePicture *pic, | ||
| 67 | int type, | ||
| 68 | const void *data, | ||
| 69 | size_t size); | ||
| 70 | |||
| 71 | int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, | ||
| 72 | VAAPIDecodePicture *pic, | ||
| 73 | const void *params_data, | ||
| 74 | int nb_params, | ||
| 75 | size_t params_size, | ||
| 76 | const void *slice_data, | ||
| 77 | size_t slice_size); | ||
| 78 | |||
| 79 | int ff_vaapi_decode_issue(AVCodecContext *avctx, | ||
| 80 | VAAPIDecodePicture *pic); | ||
| 81 | int ff_vaapi_decode_cancel(AVCodecContext *avctx, | ||
| 82 | VAAPIDecodePicture *pic); | ||
| 83 | void ff_vaapi_decode_free_frame_priv(AVRefStructOpaque hwctx, void *data); | ||
| 84 | |||
| 85 | int ff_vaapi_decode_init(AVCodecContext *avctx); | ||
| 86 | int ff_vaapi_decode_uninit(AVCodecContext *avctx); | ||
| 87 | |||
| 88 | int ff_vaapi_common_frame_params(AVCodecContext *avctx, | ||
| 89 | AVBufferRef *hw_frames_ctx); | ||
| 90 | |||
| 91 | #endif /* AVCODEC_VAAPI_DECODE_H */ | ||
| 92 |