duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

qsv.h (3844B)


      1 /*
      2  * Intel MediaSDK QSV public API
      3  *
      4  * This file is part of FFmpeg.
      5  *
      6  * FFmpeg is free software; you can redistribute it and/or
      7  * modify it under the terms of the GNU Lesser General Public
      8  * License as published by the Free Software Foundation; either
      9  * version 2.1 of the License, or (at your option) any later version.
     10  *
     11  * FFmpeg is distributed in the hope that it will be useful,
     12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14  * Lesser General Public License for more details.
     15  *
     16  * You should have received a copy of the GNU Lesser General Public
     17  * License along with FFmpeg; if not, write to the Free Software
     18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
     19  */
     20 
     21 #ifndef AVCODEC_QSV_H
     22 #define AVCODEC_QSV_H
     23 
     24 #include <mfxvideo.h>
     25 
     26 #include "libavutil/buffer.h"
     27 
     28 /**
     29  * This struct is used for communicating QSV parameters between libavcodec and
     30  * the caller. It is managed by the caller and must be assigned to
     31  * AVCodecContext.hwaccel_context.
     32  * - decoding: hwaccel_context must be set on return from the get_format()
     33  *             callback
     34  * - encoding: hwaccel_context must be set before avcodec_open2()
     35  */
     36 typedef struct AVQSVContext {
     37     /**
     38      * If non-NULL, the session to use for encoding or decoding.
     39      * Otherwise, libavcodec will try to create an internal session.
     40      */
     41     mfxSession session;
     42 
     43     /**
     44      * The IO pattern to use.
     45      */
     46     int iopattern;
     47 
     48     /**
     49      * Extra buffers to pass to encoder or decoder initialization.
     50      */
     51     mfxExtBuffer **ext_buffers;
     52     int         nb_ext_buffers;
     53 
     54     /**
     55      * Encoding only. If this field is set to non-zero by the caller, libavcodec
     56      * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to
     57      * the encoder initialization. This only makes sense if iopattern is also
     58      * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY.
     59      *
     60      * The number of allocated opaque surfaces will be the sum of the number
     61      * required by the encoder and the user-provided value nb_opaque_surfaces.
     62      * The array of the opaque surfaces will be exported to the caller through
     63      * the opaque_surfaces field.
     64      *
     65      * The caller must set this field to zero for oneVPL (MFX_VERSION >= 2.0)
     66      */
     67     int opaque_alloc;
     68 
     69     /**
     70      * Encoding only, and only if opaque_alloc is set to non-zero. Before
     71      * calling avcodec_open2(), the caller should set this field to the number
     72      * of extra opaque surfaces to allocate beyond what is required by the
     73      * encoder.
     74      *
     75      * On return from avcodec_open2(), this field will be set by libavcodec to
     76      * the total number of allocated opaque surfaces.
     77      */
     78     int nb_opaque_surfaces;
     79 
     80     /**
     81      * Encoding only, and only if opaque_alloc is set to non-zero. On return
     82      * from avcodec_open2(), this field will be used by libavcodec to export the
     83      * array of the allocated opaque surfaces to the caller, so they can be
     84      * passed to other parts of the pipeline.
     85      *
     86      * The buffer reference exported here is owned and managed by libavcodec,
     87      * the callers should make their own reference with av_buffer_ref() and free
     88      * it with av_buffer_unref() when it is no longer needed.
     89      *
     90      * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1.
     91      */
     92     AVBufferRef *opaque_surfaces;
     93 
     94     /**
     95      * Encoding only, and only if opaque_alloc is set to non-zero. On return
     96      * from avcodec_open2(), this field will be set to the surface type used in
     97      * the opaque allocation request.
     98      */
     99     int opaque_alloc_type;
    100 } AVQSVContext;
    101 
    102 /**
    103  * Allocate a new context.
    104  *
    105  * It must be freed by the caller with av_free().
    106  */
    107 AVQSVContext *av_qsv_alloc_context(void);
    108 
    109 #endif /* AVCODEC_QSV_H */