28 #include <mfx/mfxvideo.h>
152 &dummy_data, &dummy_size,
160 mfxSession session =
NULL;
168 if (qsv_format < 0) {
170 "Only 8-bit YUV420 streams are supported.\n");
176 avctx->
pix_fmt = pix_fmts[1] = qsv_format;
235 while (!*got_frame) {
288 #define OFFSET(x) offsetof(QSVH264Context, x)
289 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
304 .long_name =
NULL_IF_CONFIG_SMALL(
"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration)"),
313 .priv_class = &
class,
int ff_qsv_decode(AVCodecContext *avctx, QSVContext *q, AVFrame *frame, int *got_frame, AVPacket *avpkt)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
AVCodec ff_h264_qsv_decoder
int coded_width
Bitstream width / height, may be different from width/height e.g.
int ff_qsv_decode_init(AVCodecContext *avctx, QSVContext *q, mfxSession session)
#define LIBAVUTIL_VERSION_INT
int64_t pos
byte position in stream, -1 if unknown
static av_cold int init(AVCodecContext *avctx)
int width
Dimensions of the decoded video intended for presentation.
int coded_width
Dimensions of the coded video.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
mfxExtBuffer ** ext_buffers
enum AVPixelFormat orig_pix_fmt
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.
static const AVOption options[]
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
AVBitStreamFilterContext * bsf
void * hwaccel_context
Hardware accelerator context.
int ff_qsv_decode_close(QSVContext *q)
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...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void av_fifo_free(AVFifoBuffer *f)
Free an AVFifoBuffer.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define PARSER_FLAG_COMPLETE_FRAMES
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
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.
void av_bitstream_filter_close(AVBitStreamFilterContext *bsf)
Release bitstream filter context.
const char * name
Name of the codec implementation.
Libavcodec external API header.
AVHWAccel ff_h264_qsv_hwaccel
#define ASYNC_DEPTH_DEFAULT
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
const char * name
Name of the hardware accelerated codec.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int64_t pts, int64_t dts, int64_t pos)
Parse a packet.
int width
picture width / height.
AVBitStreamFilterContext * av_bitstream_filter_init(const char *name)
Create and initialize a bitstream filter context given a bitstream filter name.
AVCodecContext * avctx_internal
void av_parser_close(AVCodecParserContext *s)
static void flush(AVCodecContext *avctx)
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe)
Filter bitstream.
AVCodecParserContext * av_parser_init(int codec_id)
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer...
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 ...
mfxExtBuffer ** ext_buffers
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size)
Resize an AVFifoBuffer.
main external API structure.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
AVFifoBuffer * packet_fifo
a very simple circular buffer FIFO implementation
AVCodecParserContext * parser
Describe the class of an AVClass context structure.
static int qsv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
static av_cold int qsv_decode_close(AVCodecContext *avctx)
static void qsv_decode_flush(AVCodecContext *avctx)
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
static void qsv_clear_buffers(QSVH264Context *s)
common internal api header.
common internal and external API header
int ff_qsv_map_pixfmt(enum AVPixelFormat format)
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
static av_cold int qsv_decode_init(AVCodecContext *avctx)
static int qsv_process_data(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
int format
The format of the coded data, corresponds to enum AVPixelFormat for video and for enum AVSampleFormat...
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
AVPixelFormat
Pixel format.
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...