Go to the documentation of this file.
27 #include <mfx/mfxvideo.h>
63 #if CONFIG_VP8_QSV_DECODER || CONFIG_VP9_QSV_DECODER
82 #if CONFIG_VP8_QSV_DECODER
84 static const char *uid_vp8dec_hw =
"f622394d8d87452f878c51f2fc9b4131";
87 s->qsv.load_plugins =
av_strdup(uid_vp8dec_hw);
88 if (!
s->qsv.load_plugins)
93 #if CONFIG_VP9_QSV_DECODER
95 static const char *uid_vp9dec_hw =
"a922394d8d87452f878c51f2fc9b4131";
98 s->qsv.load_plugins =
av_strdup(uid_vp9dec_hw);
99 if (!
s->qsv.load_plugins)
106 if (!
s->packet_fifo) {
142 while (!*got_frame) {
143 if (
s->input_ref.size <= 0) {
148 if (!
s->qsv.reinit_flag) {
162 if (
s->qsv.reinit_flag)
165 s->input_ref.size -=
ret;
166 s->input_ref.data +=
ret;
180 #define OFFSET(x) offsetof(QSVOtherContext, x)
181 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
185 {
"gpu_copy",
"A GPU-accelerated copy between video and system memory",
OFFSET(qsv.gpu_copy),
AV_OPT_TYPE_INT, { .i64 = MFX_GPUCOPY_DEFAULT }, MFX_GPUCOPY_DEFAULT, MFX_GPUCOPY_OFF,
VD,
"gpu_copy"},
192 #if CONFIG_MPEG2_QSV_DECODER
193 static const AVClass mpeg2_qsv_class = {
211 .priv_class = &mpeg2_qsv_class,
216 .wrapper_name =
"qsv",
220 #if CONFIG_VC1_QSV_DECODER
221 static const AVClass vc1_qsv_class = {
239 .priv_class = &vc1_qsv_class,
244 .wrapper_name =
"qsv",
248 #if CONFIG_VP8_QSV_DECODER
249 static const AVClass vp8_qsv_class = {
267 .priv_class = &vp8_qsv_class,
272 .wrapper_name =
"qsv",
276 #if CONFIG_MJPEG_QSV_DECODER
277 static const AVClass mjpeg_qsv_class = {
295 .priv_class = &mjpeg_qsv_class,
302 #if CONFIG_VP9_QSV_DECODER
303 static const AVClass vp9_qsv_class = {
321 .priv_class = &vp9_qsv_class,
327 .wrapper_name =
"qsv",
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
const AVCodecHWConfigInternal * ff_qsv_hw_configs[]
static void qsv_decode_flush(AVCodecContext *avctx)
int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, AVFrame *frame, int *got_frame, AVPacket *pkt)
static av_cold int qsv_decode_close(AVCodecContext *avctx)
AVPixelFormat
Pixel format.
static av_cold int init(AVCodecContext *avctx)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int(*func)(void *, void *, int))
Feed data from a user-supplied callback to an AVFifoBuffer.
void av_fifo_free(AVFifoBuffer *f)
Free an AVFifoBuffer.
This structure describes decoded (raw) audio or video data.
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
Feed data from an AVFifoBuffer to a user-supplied callback.
int ff_qsv_decode_close(QSVContext *q)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
void ff_qsv_decode_flush(AVCodecContext *avctx, QSVContext *q)
AVCodec ff_mpeg2_qsv_decoder
int av_fifo_space(const AVFifoBuffer *f)
Return the amount of space in bytes in the AVFifoBuffer, that is the amount of data you can write int...
#define ASYNC_DEPTH_DEFAULT
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static enum AVPixelFormat pix_fmts[]
static const AVOption options[]
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size)
Resize an AVFifoBuffer.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static void flush(AVCodecContext *avctx)
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static void qsv_clear_buffers(QSVOtherContext *s)
AVCodec ff_vp9_qsv_decoder
AVFifoBuffer * packet_fifo
const char * name
Name of the codec implementation.
AVCodec ff_vc1_qsv_decoder
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
main external API structure.
static av_cold int qsv_decode_init(AVCodecContext *avctx)
static int qsv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
char * av_strdup(const char *s)
Duplicate a string.
AVCodec ff_vp8_qsv_decoder
#define AV_CODEC_CAP_HYBRID
Codec is potentially backed by a hardware implementation, but not necessarily.
int av_fifo_size(const AVFifoBuffer *f)
Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from ...
AVCodec ff_mjpeg_qsv_decoder
This structure stores compressed data.
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
#define AV_CODEC_CAP_AVOID_PROBING
Decoder is not a preferred choice for probing.
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding