FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
qsv_internal.h
Go to the documentation of this file.
1 /*
2  * Intel MediaSDK QSV utility functions
3  *
4  * copyright (c) 2013 Luca Barbato
5  *
6  * This file is part of FFmpeg.
7  *
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.
12  *
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.
17  *
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
21  */
22 
23 #ifndef AVCODEC_QSV_INTERNAL_H
24 #define AVCODEC_QSV_INTERNAL_H
25 
26 #include <stdint.h>
27 #include <sys/types.h>
28 
29 #include <mfx/mfxvideo.h>
30 
31 #include "libavutil/frame.h"
32 #include "libavutil/pixfmt.h"
33 
34 #include "avcodec.h"
35 
36 #define QSV_VERSION_MAJOR 1
37 #define QSV_VERSION_MINOR 1
38 
39 #define ASYNC_DEPTH_DEFAULT 4 // internal parallelism
40 
41 typedef struct QSVFrame {
43  mfxFrameSurface1 *surface;
44 
45  mfxFrameSurface1 surface_internal;
46 
47  struct QSVFrame *next;
48 } QSVFrame;
49 
50 typedef struct QSVContext {
51  // the session used for decoding
52  mfxSession session;
53 
54  // the session we allocated internally, in case the caller did not provide
55  // one
56  mfxSession internal_session;
57 
58  /**
59  * a linked list of frames currently being used by QSV
60  */
62 
63  // options set by the caller
65  int iopattern;
66 
67  mfxExtBuffer **ext_buffers;
69 } QSVContext;
70 
71 /**
72  * Convert a libmfx error code into a ffmpeg error code.
73  */
74 int ff_qsv_error(int mfx_err);
75 
76 int ff_qsv_map_pixfmt(enum AVPixelFormat format);
77 
78 int ff_qsv_init(AVCodecContext *s, QSVContext *q, mfxSession session);
79 
81  AVFrame *frame, int *got_frame,
82  AVPacket *avpkt);
83 
84 int ff_qsv_close(QSVContext *q);
85 
86 #endif /* AVCODEC_QSV_INTERNAL_H */