d0a63d8b |
/*
* Intel MediaSDK QSV encoder/decoder shared code
* |
b12eacb3 |
* This file is part of FFmpeg. |
d0a63d8b |
* |
b12eacb3 |
* FFmpeg is free software; you can redistribute it and/or |
d0a63d8b |
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* |
b12eacb3 |
* FFmpeg is distributed in the hope that it will be useful, |
d0a63d8b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public |
b12eacb3 |
* License along with FFmpeg; if not, write to the Free Software |
d0a63d8b |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_QSV_INTERNAL_H
#define AVCODEC_QSV_INTERNAL_H
|
72b7441a |
#include <mfx/mfxvideo.h>
#include "libavutil/frame.h"
|
9c0bc1e9 |
#include "avcodec.h"
|
d0a63d8b |
#define QSV_VERSION_MAJOR 1 |
1f26a231 |
#define QSV_VERSION_MINOR 1 |
d0a63d8b |
#define ASYNC_DEPTH_DEFAULT 4 // internal parallelism
|
0eac93da |
#define QSV_MAX_ENC_PAYLOAD 2 // # of mfxEncodeCtrl payloads supported
|
66acb76b |
#define QSV_VERSION_ATLEAST(MAJOR, MINOR) \
(MFX_VERSION_MAJOR > (MAJOR) || \
MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR))
|
cca5e4f0 |
#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR) \
(MFX_VERSION.Major > (MAJOR)) || \
(MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR))
|
00aeedd8 |
typedef struct QSVMid { |
4ab61cd9 |
AVBufferRef *hw_frames_ref; |
00aeedd8 |
mfxHDL handle; |
4ab61cd9 |
AVFrame *locked_frame;
AVFrame *hw_frame;
mfxFrameSurface1 surf; |
00aeedd8 |
} QSVMid;
|
72b7441a |
typedef struct QSVFrame {
AVFrame *frame; |
404e5147 |
mfxFrameSurface1 surface; |
0eac93da |
mfxEncodeCtrl enc_ctrl; |
52ed83fa |
mfxExtDecodedFrameInfo dec_info;
mfxExtBuffer *ext_param; |
72b7441a |
|
f5c4d38c |
int queued; |
404e5147 |
int used; |
f5c4d38c |
|
72b7441a |
struct QSVFrame *next;
} QSVFrame;
|
1f26a231 |
typedef struct QSVFramesContext {
AVBufferRef *hw_frames_ctx; |
4ab61cd9 |
void *logctx;
/* The memory ids for the external frames.
* Refcounted, since we need one reference owned by the QSVFramesContext
* (i.e. by the encoder/decoder) and another one given to the MFX session
* from the frame allocator. */
AVBufferRef *mids_buf; |
00aeedd8 |
QSVMid *mids;
int nb_mids; |
1f26a231 |
} QSVFramesContext; |
ce91bab7 |
|
d0a63d8b |
/** |
1f26a231 |
* Convert a libmfx error code into an ffmpeg error code. |
d0a63d8b |
*/ |
95414eb2 |
int ff_qsv_map_error(mfxStatus mfx_err, const char **desc);
int ff_qsv_print_error(void *log_ctx, mfxStatus err,
const char *error_string); |
d0a63d8b |
|
8e07c22e |
int ff_qsv_print_warning(void *log_ctx, mfxStatus err,
const char *warning_string);
|
d0a63d8b |
int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id); |
1f26a231 |
int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile); |
d0a63d8b |
|
536bb17e |
int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc); |
52ed83fa |
enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type); |
536bb17e |
|
1f26a231 |
int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session, |
66acb76b |
const char *load_plugins); |
1f26a231 |
|
91c3b50d |
int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession,
AVBufferRef *device_ref, const char *load_plugins);
int ff_qsv_init_session_frames(AVCodecContext *avctx, mfxSession *session,
QSVFramesContext *qsv_frames_ctx,
const char *load_plugins, int opaque); |
d0a63d8b |
|
00aeedd8 |
int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame);
|
d0a63d8b |
#endif /* AVCODEC_QSV_INTERNAL_H */ |