libavcodec/decode.h
061a0c14
 /*
  * generic decoding-related code
  *
bddb2343
  * This file is part of FFmpeg.
061a0c14
  *
bddb2343
  * FFmpeg is free software; you can redistribute it and/or
061a0c14
  * 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.
  *
bddb2343
  * FFmpeg is distributed in the hope that it will be useful,
061a0c14
  * 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
bddb2343
  * License along with FFmpeg; if not, write to the Free Software
061a0c14
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef AVCODEC_DECODE_H
 #define AVCODEC_DECODE_H
 
9f1cfd88
 #include "libavutil/buffer.h"
7fa64514
 #include "libavutil/frame.h"
b46a77f1
 #include "libavutil/hwcontext.h"
359a8a3e
 
554e55bb
 #include "avcodec.h"
 
061a0c14
 /**
9f1cfd88
  * This struct stores per-frame lavc-internal data and is attached to it via
  * private_ref.
  */
 typedef struct FrameDecodeData {
7fa64514
     /**
      * The callback to perform some delayed processing on the frame right
      * before it is returned to the caller.
      *
      * @note This code is called at some unspecified point after the frame is
      * returned from the decoder's decode/receive_frame call. Therefore it cannot rely
      * on AVCodecContext being in any specific state, so it does not get to
      * access AVCodecContext directly at all. All the state it needs must be
      * stored in the post_process_opaque object.
      */
     int (*post_process)(void *logctx, AVFrame *frame);
     void *post_process_opaque;
     void (*post_process_opaque_free)(void *opaque);
81c021c6
 
     /**
      * Per-frame private data for hwaccels.
      */
     void *hwaccel_priv;
     void (*hwaccel_priv_free)(void *priv);
9f1cfd88
 } FrameDecodeData;
 
 /**
061a0c14
  * Called by decoders to get the next packet for decoding.
  *
  * @param pkt An empty packet to be filled with data.
  * @return 0 if a new reference has been successfully written to pkt
  *         AVERROR(EAGAIN) if no data is currently available
  *         AVERROR_EOF if and end of stream has been reached, so no more data
  *                     will be available
  */
 int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
 
972c71e9
 void ff_decode_bsfs_uninit(AVCodecContext *avctx);
 
b46a77f1
 /**
  * Make sure avctx.hw_frames_ctx is set. If it's not set, the function will
  * try to allocate it from hw_device_ctx. If that is not possible, an error
  * message is printed, and an error code is returned.
  */
 int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx,
                                 enum AVHWDeviceType dev_type);
 
9f1cfd88
 int ff_attach_decode_data(AVFrame *frame);
 
061a0c14
 #endif /* AVCODEC_DECODE_H */