FFmpeg
Macros | Functions | Variables
qsv.c File Reference
#include <mfx/mfxvideo.h>
#include <mfx/mfxplugin.h>
#include <mfx/mfxjpeg.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/avstring.h"
#include "libavutil/common.h"
#include "libavutil/error.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_qsv.h"
#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "qsv_internal.h"

Go to the source code of this file.

Macros

#define MAP(c, p, v)   { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, MFX_PROFILE_ ## v }
 

Functions

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)
 
int ff_qsv_map_error (mfxStatus mfx_err, const char **desc)
 Convert a libmfx error code into an ffmpeg error code. More...
 
int ff_qsv_print_error (void *log_ctx, mfxStatus err, const char *error_string)
 
int ff_qsv_print_warning (void *log_ctx, mfxStatus err, const char *warning_string)
 
static enum AVPixelFormat qsv_map_fourcc (uint32_t fourcc)
 
int ff_qsv_map_pixfmt (enum AVPixelFormat format, uint32_t *fourcc)
 
int ff_qsv_find_surface_idx (QSVFramesContext *ctx, QSVFrame *frame)
 
enum AVPictureType ff_qsv_map_pictype (int mfx_pic_type)
 
static int qsv_load_plugins (mfxSession session, const char *load_plugins, void *logctx)
 
int ff_qsv_init_internal_session (AVCodecContext *avctx, mfxSession *session, const char *load_plugins)
 
static void mids_buf_free (void *opaque, uint8_t *data)
 
static AVBufferRefqsv_create_mids (AVBufferRef *hw_frames_ref)
 
static int qsv_setup_mids (mfxFrameAllocResponse *resp, AVBufferRef *hw_frames_ref, AVBufferRef *mids_buf)
 
static mfxStatus qsv_frame_alloc (mfxHDL pthis, mfxFrameAllocRequest *req, mfxFrameAllocResponse *resp)
 
static mfxStatus qsv_frame_free (mfxHDL pthis, mfxFrameAllocResponse *resp)
 
static mfxStatus qsv_frame_lock (mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
 
static mfxStatus qsv_frame_unlock (mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
 
static mfxStatus qsv_frame_get_hdl (mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
 
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 *psession, QSVFramesContext *qsv_frames_ctx, const char *load_plugins, int opaque)
 

Variables

struct {
   enum AVCodecID   codec_id
 
   int   codec_profile
 
   int   mfx_profile
 
qsv_profile_map []
 
struct {
   mfxStatus   mfxerr
 
   int   averr
 
   const char *   desc
 
qsv_errors []
 

Macro Definition Documentation

◆ MAP

#define MAP (   c,
  p,
 
)    { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, MFX_PROFILE_ ## v }

Function Documentation

◆ ff_qsv_codec_id_to_mfx()

int ff_qsv_codec_id_to_mfx ( enum AVCodecID  codec_id)

Definition at line 43 of file qsv.c.

Referenced by init_video_param(), init_video_param_jpeg(), and qsv_decode_init().

◆ ff_qsv_profile_to_mfx()

int ff_qsv_profile_to_mfx ( enum AVCodecID  codec_id,
int  profile 
)

Definition at line 106 of file qsv.c.

Referenced by qsv_decode_init().

◆ ff_qsv_level_to_mfx()

int ff_qsv_level_to_mfx ( enum AVCodecID  codec_id,
int  level 
)

Definition at line 122 of file qsv.c.

Referenced by qsv_decode_init().

◆ ff_qsv_map_error()

int ff_qsv_map_error ( mfxStatus  mfx_err,
const char **  desc 
)

Convert a libmfx error code into an ffmpeg error code.

Definition at line 175 of file qsv.c.

Referenced by ff_qsv_print_error(), and ff_qsv_print_warning().

◆ ff_qsv_print_error()

int ff_qsv_print_error ( void *  log_ctx,
mfxStatus  err,
const char *  error_string 
)

◆ ff_qsv_print_warning()

int ff_qsv_print_warning ( void *  log_ctx,
mfxStatus  err,
const char *  warning_string 
)

Definition at line 200 of file qsv.c.

Referenced by encode_frame(), ff_qsv_enc_init(), and qsv_decode().

◆ qsv_map_fourcc()

static enum AVPixelFormat qsv_map_fourcc ( uint32_t  fourcc)
static

Definition at line 210 of file qsv.c.

Referenced by qsv_frame_alloc().

◆ ff_qsv_map_pixfmt()

int ff_qsv_map_pixfmt ( enum AVPixelFormat  format,
uint32_t *  fourcc 
)

Definition at line 220 of file qsv.c.

Referenced by ff_qsv_process_data(), init_video_param(), and init_video_param_jpeg().

◆ ff_qsv_find_surface_idx()

int ff_qsv_find_surface_idx ( QSVFramesContext ctx,
QSVFrame frame 
)

Definition at line 237 of file qsv.c.

Referenced by alloc_frame(), and submit_frame().

◆ ff_qsv_map_pictype()

enum AVPictureType ff_qsv_map_pictype ( int  mfx_pic_type)

Definition at line 248 of file qsv.c.

Referenced by qsv_decode().

◆ qsv_load_plugins()

static int qsv_load_plugins ( mfxSession  session,
const char *  load_plugins,
void *  logctx 
)
static

Definition at line 277 of file qsv.c.

Referenced by ff_qsv_init_internal_session(), and ff_qsv_init_session_device().

◆ ff_qsv_init_internal_session()

int ff_qsv_init_internal_session ( AVCodecContext avctx,
mfxSession *  session,
const char *  load_plugins 
)

Definition at line 328 of file qsv.c.

Referenced by qsv_init_session(), and qsvenc_init_session().

◆ mids_buf_free()

static void mids_buf_free ( void *  opaque,
uint8_t data 
)
static

Definition at line 371 of file qsv.c.

Referenced by qsv_create_mids().

◆ qsv_create_mids()

static AVBufferRef* qsv_create_mids ( AVBufferRef hw_frames_ref)
static

Definition at line 378 of file qsv.c.

Referenced by ff_qsv_init_session_frames(), and qsv_frame_alloc().

◆ qsv_setup_mids()

static int qsv_setup_mids ( mfxFrameAllocResponse *  resp,
AVBufferRef hw_frames_ref,
AVBufferRef mids_buf 
)
static

Definition at line 415 of file qsv.c.

Referenced by qsv_frame_alloc().

◆ qsv_frame_alloc()

static mfxStatus qsv_frame_alloc ( mfxHDL  pthis,
mfxFrameAllocRequest *  req,
mfxFrameAllocResponse *  resp 
)
static

Definition at line 451 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

◆ qsv_frame_free()

static mfxStatus qsv_frame_free ( mfxHDL  pthis,
mfxFrameAllocResponse *  resp 
)
static

Definition at line 540 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

◆ qsv_frame_lock()

static mfxStatus qsv_frame_lock ( mfxHDL  pthis,
mfxMemId  mid,
mfxFrameData *  ptr 
)
static

Definition at line 548 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

◆ qsv_frame_unlock()

static mfxStatus qsv_frame_unlock ( mfxHDL  pthis,
mfxMemId  mid,
mfxFrameData *  ptr 
)
static

Definition at line 605 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

◆ qsv_frame_get_hdl()

static mfxStatus qsv_frame_get_hdl ( mfxHDL  pthis,
mfxMemId  mid,
mfxHDL *  hdl 
)
static

Definition at line 615 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

◆ ff_qsv_init_session_device()

int ff_qsv_init_session_device ( AVCodecContext avctx,
mfxSession *  psession,
AVBufferRef device_ref,
const char *  load_plugins 
)

Definition at line 622 of file qsv.c.

Referenced by ff_qsv_init_session_frames(), qsv_init_session(), and qsvenc_init_session().

◆ ff_qsv_init_session_frames()

int ff_qsv_init_session_frames ( AVCodecContext avctx,
mfxSession *  psession,
QSVFramesContext qsv_frames_ctx,
const char *  load_plugins,
int  opaque 
)

Definition at line 692 of file qsv.c.

Referenced by qsv_init_session(), and qsvenc_init_session().

Variable Documentation

◆ codec_id

enum AVCodecID codec_id
Examples
muxing.c.

Definition at line 72 of file qsv.c.

Referenced by ac3_eac3_probe(), add_stream(), amf_init_encoder(), audio_read_header(), audio_write_header(), av_get_bits_per_sample(), av_get_exact_bits_per_sample(), av_guess_codec(), av_parser_init(), avcodec_get_type(), avcodec_profile_name(), AVCodecInitialize(), avformat_query_codec(), cbs_h2645_split_fragment(), checkasm_check_h264pred(), codec_flags(), codec_id_to_pcm_format(), device_try_init(), dshow_cycle_formats(), ff_alsa_open(), ff_cbs_init(), ff_codec_id_to_pulse_format(), ff_fmt_ff2v4l(), ff_fmt_v4l2ff(), ff_get_qtpalette(), ff_h2645_packet_split(), ff_h264_pred_init(), ff_h264_pred_init_aarch64(), ff_h264_pred_init_arm(), ff_h264_pred_init_mips(), ff_mp4_read_dec_config_descr(), ff_mpa_decode_header(), ff_qsv_codec_id_to_mfx(), ff_qsv_level_to_mfx(), ff_qsv_profile_to_mfx(), ff_spdif_read_packet(), ff_vbv_update(), ffat_create_decoder(), film_write_packet(), filter_codec_opts(), find_decoder(), find_probe_decoder(), flv_same_audio_codec(), get_audio_codec_id(), get_codec_name(), get_compliance_unofficial_pix_fmts(), h264_pred_init_neon(), is_pcm(), list_formats(), mkv_query_codec(), mkv_write_track(), mov_get_lpcm_flags(), mov_pcm_be_gt16(), mov_pcm_le_gt16(), mov_read_extradata(), mpegaudio_parse(), mpegps_read_packet(), open_output_file(), PRED4x4(), pulse_read_header(), pulse_read_packet(), samples_per_packet(), select_segment_type(), unsupported_codec(), v4l2_read_header(), validate_codec_tag(), webm_dash_manifest_write_header(), and webm_query_codec().

◆ codec_profile

int codec_profile

Definition at line 73 of file qsv.c.

Referenced by ff_qsv_profile_to_mfx().

◆ mfx_profile

int mfx_profile

Definition at line 74 of file qsv.c.

◆ qsv_profile_map

const { ... } qsv_profile_map[]
Initial value:
= {
#define MAP(c, p, v)
MAP(MPEG2VIDEO, MPEG2_SIMPLE, MPEG2_SIMPLE ),
MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2_MAIN ),
MAP(MPEG2VIDEO, MPEG2_HIGH, MPEG2_HIGH ),
MAP(H264, H264_BASELINE, AVC_BASELINE ),
MAP(H264, H264_CONSTRAINED_BASELINE, AVC_BASELINE),
MAP(H264, H264_MAIN, AVC_MAIN ),
MAP(H264, H264_HIGH, AVC_HIGH ),
MAP(H264, H264_HIGH_422, AVC_HIGH_422 ),
MAP(VC1, VC1_SIMPLE, VC1_SIMPLE ),
MAP(VC1, VC1_MAIN, VC1_MAIN ),
MAP(VC1, VC1_COMPLEX, VC1_ADVANCED ),
MAP(VC1, VC1_ADVANCED, VC1_ADVANCED ),
}

Referenced by ff_qsv_profile_to_mfx().

◆ mfxerr

mfxStatus mfxerr

Definition at line 136 of file qsv.c.

Referenced by ff_qsv_map_error().

◆ averr

int averr

Definition at line 137 of file qsv.c.

◆ desc

const char* desc

◆ qsv_errors

const { ... } qsv_errors[]

Referenced by ff_qsv_map_error().

MAP
#define MAP(c, p, v)