X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fqsv_internal.h;h=6b2fbbe25252be03688ef15d1739eb9f82464851;hb=6ad61e30a16d338eab23b649365813fb150066ef;hp=394c55888314ebd39ba87713267b5ad5078157d1;hpb=b4ca32414ea28ad29b4bd387c298f5a676dace2a;p=ffmpeg diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index 394c5588831..6b2fbbe2525 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -21,6 +21,24 @@ #ifndef AVCODEC_QSV_INTERNAL_H #define AVCODEC_QSV_INTERNAL_H +#include "config.h" + +#if CONFIG_VAAPI +#define AVCODEC_QSV_LINUX_SESSION_HANDLE +#endif //CONFIG_VAAPI + +#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE +#include +#include +#if HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#include "libavutil/hwcontext_vaapi.h" +#endif + #include #include "libavutil/frame.h" @@ -39,8 +57,8 @@ MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR)) #define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR) \ - (MFX_VERSION.Major > (MAJOR)) || \ - (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)) + ((MFX_VERSION.Major > (MAJOR)) || \ + (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR))) typedef struct QSVMid { AVBufferRef *hw_frames_ref; @@ -64,6 +82,14 @@ typedef struct QSVFrame { struct QSVFrame *next; } QSVFrame; +typedef struct QSVSession { + mfxSession session; +#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE + AVBufferRef *va_device_ref; + AVHWDeviceContext *va_device_ctx; +#endif +} QSVSession; + typedef struct QSVFramesContext { AVBufferRef *hw_frames_ctx; void *logctx; @@ -77,6 +103,9 @@ typedef struct QSVFramesContext { int nb_mids; } QSVFramesContext; +int ff_qsv_print_iopattern(void *log_ctx, int mfx_iopattern, + const char *extra_string); + /** * Convert a libmfx error code into an ffmpeg error code. */ @@ -89,20 +118,27 @@ int ff_qsv_print_warning(void *log_ctx, mfxStatus err, const char *warning_string); int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id); -int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile); +int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level); + +enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc); int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc); enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type); -int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session, - const char *load_plugins); +enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct); + +int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, + const char *load_plugins, int gpu_copy); + +int ff_qsv_close_internal_session(QSVSession *qs); int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, - AVBufferRef *device_ref, const char *load_plugins); + AVBufferRef *device_ref, const char *load_plugins, + int gpu_copy); int ff_qsv_init_session_frames(AVCodecContext *avctx, mfxSession *session, QSVFramesContext *qsv_frames_ctx, - const char *load_plugins, int opaque); + const char *load_plugins, int opaque, int gpu_copy); int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame);