libavcodec/qsvdec.h
4e08c821
 /*
  * Intel MediaSDK QSV utility functions
  *
  * copyright (c) 2013 Luca Barbato
  *
841e9f43
  * This file is part of FFmpeg.
4e08c821
  *
841e9f43
  * FFmpeg is free software; you can redistribute it and/or
4e08c821
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
841e9f43
  * FFmpeg is distributed in the hope that it will be useful,
4e08c821
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
841e9f43
  * License along with FFmpeg; if not, write to the Free Software
4e08c821
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
b04d009b
 #ifndef AVCODEC_QSVDEC_H
 #define AVCODEC_QSVDEC_H
4e08c821
 
 #include <stdint.h>
 #include <sys/types.h>
 
 #include <mfx/mfxvideo.h>
 
f5c4d38c
 #include "libavutil/fifo.h"
4e08c821
 #include "libavutil/frame.h"
 #include "libavutil/pixfmt.h"
 
 #include "avcodec.h"
72b7441a
 #include "qsv_internal.h"
4e08c821
 
 typedef struct QSVContext {
     // the session used for decoding
     mfxSession session;
 
     // the session we allocated internally, in case the caller did not provide
     // one
ce91bab7
     QSVSession internal_qs;
4e08c821
 
     /**
      * a linked list of frames currently being used by QSV
      */
     QSVFrame *work_frames;
 
f5c4d38c
     AVFifoBuffer *async_fifo;
c90dbc67
     AVFifoBuffer *input_fifo;
f5c4d38c
 
cc167f7e
     // we should to buffer input packets at some cases
     // else it is not possible to handle dynamic stream changes correctly
     // this fifo uses for input packets buffering
     AVFifoBuffer *pkt_fifo;
 
d50ab820
     // this flag indicates that header parsed,
     // decoder instance created and ready to general decoding
     int engine_ready;
 
cc167f7e
     // we can not just re-init decoder if different sequence header arrived
     // we should to deliver all buffered frames but we can not decode new packets
     // this time. So when reinit_pending is non-zero we flushing decoder and
     // accumulate new arrived packets into pkt_fifo
     int reinit_pending;
 
4e08c821
     // options set by the caller
     int async_depth;
     int iopattern;
 
41d47ea8
     char *load_plugins;
 
4e08c821
     mfxExtBuffer **ext_buffers;
     int         nb_ext_buffers;
 } QSVContext;
 
 int ff_qsv_map_pixfmt(enum AVPixelFormat format);
 
 int ff_qsv_decode(AVCodecContext *s, QSVContext *q,
                   AVFrame *frame, int *got_frame,
                   AVPacket *avpkt);
 
3f8e2e99
 void ff_qsv_decode_reset(AVCodecContext *avctx, QSVContext *q);
 
9ba27c23
 int ff_qsv_decode_close(QSVContext *q);
4e08c821
 
b04d009b
 #endif /* AVCODEC_QSVDEC_H */