2 * Intel MediaSDK QSV utility functions
4 * copyright (c) 2013 Luca Barbato
6 * This file is part of FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef AVCODEC_QSV_INTERNAL_H
24 #define AVCODEC_QSV_INTERNAL_H
27 #include <sys/types.h>
29 #include <mfx/mfxvideo.h>
31 #include "libavutil/frame.h"
32 #include "libavutil/pixfmt.h"
36 #define QSV_VERSION_MAJOR 1
37 #define QSV_VERSION_MINOR 1
39 #define ASYNC_DEPTH_DEFAULT 4 // internal parallelism
41 typedef struct QSVFrame {
43 mfxFrameSurface1 *surface;
45 mfxFrameSurface1 surface_internal;
47 struct QSVFrame *next;
50 typedef struct QSVContext {
51 // the session used for decoding
54 // the session we allocated internally, in case the caller did not provide
56 mfxSession internal_session;
59 * a linked list of frames currently being used by QSV
61 QSVFrame *work_frames;
63 // options set by the caller
67 mfxExtBuffer **ext_buffers;
72 * Convert a libmfx error code into a ffmpeg error code.
74 int ff_qsv_error(int mfx_err);
76 int ff_qsv_map_pixfmt(enum AVPixelFormat format);
78 int ff_qsv_init(AVCodecContext *s, QSVContext *q, mfxSession session);
80 int ff_qsv_decode(AVCodecContext *s, QSVContext *q,
81 AVFrame *frame, int *got_frame,
84 int ff_qsv_close(QSVContext *q);
86 #endif /* AVCODEC_QSV_INTERNAL_H */