19 #include <mfx/mfxvideo.h>
74 mfxFrameSurface1 *surfaces;
93 qsv->
opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
124 "-hwaccel qsv should only be used for one-to-one QSV transcoding "
125 "with no filters.\n");
138 hwctx_dec->
iopattern = MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
153 static const struct {
157 {
"auto", MFX_IMPL_AUTO },
158 {
"sw", MFX_IMPL_SOFTWARE },
159 {
"hw", MFX_IMPL_HARDWARE },
160 {
"auto_any", MFX_IMPL_AUTO_ANY },
161 {
"hw_any", MFX_IMPL_HARDWARE_ANY },
162 {
"hw2", MFX_IMPL_HARDWARE2 },
163 {
"hw3", MFX_IMPL_HARDWARE3 },
164 {
"hw4", MFX_IMPL_HARDWARE4 },
167 mfxIMPL impl = MFX_IMPL_AUTO_ANY;
173 impl = impl_map[i].impl;
197 mfxVersion ver = { { 3, 1 } };
236 err = MFXInit(impl, &ver, &qsv->
session);
237 if (err != MFX_ERR_NONE) {
250 hwctx->
iopattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY;
static enum AVPixelFormat pix_fmt
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static void qsv_uninit(AVCodecContext *s)
static int init_opaque_surf(QSVContext *qsv)
memory handling functions
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int nb_opaque_surfaces
Encoding only, and only if opaque_alloc is set to non-zero.
void * hwaccel_context
Hardware accelerator context.
mfxExtBuffer * ext_buffers[1]
int qsv_transcode_init(OutputStream *ost)
int opaque_alloc
Encoding only.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AV_LOG_VERBOSE
Detailed information.
mfxFrameSurface1 ** surface_ptrs
int opaque_alloc_type
Encoding only, and only if opaque_alloc is set to non-zero.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static mfxIMPL choose_implementation(const InputStream *ist)
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
AVBufferRef * av_buffer_create(uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
int iopattern
The IO pattern to use.
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
int qsv_init(AVCodecContext *s)
#define FF_ARRAY_ELEMS(a)
static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
mfxExtBuffer ** ext_buffers
Extra buffers to pass to encoder or decoder initialization.
main external API structure.
uint8_t * data
The data buffer.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
AVBufferRef * opaque_surfaces
Encoding only, and only if opaque_alloc is set to non-zero.
OutputStream ** output_streams
AVQSVContext * av_qsv_alloc_context(void)
Allocate a new context.
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
This struct is used for communicating QSV parameters between libavcodec and the caller.
static void buffer_release(void *opaque, uint8_t *data)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
A reference to a data buffer.
AVBufferRef * opaque_surfaces_buf
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
AVDictionary * encoder_opts
static void * av_mallocz_array(size_t nmemb, size_t size)
mfxExtOpaqueSurfaceAlloc opaque_alloc
AVPixelFormat
Pixel format.
mfxSession session
If non-NULL, the session to use for encoding or decoding.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
void * opaque
Private data of the user, can be used to carry app specific stuff.
InputStream ** input_streams