]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/decode.h
avcodec: rename the AV1 profiles
[ffmpeg] / libavcodec / decode.h
index 61b53b2445030e402b22345c6a0a91efce2379bf..37b2e45c6391d221d9529ec380e289eff6a77c19 100644 (file)
@@ -22,6 +22,8 @@
 #define AVCODEC_DECODE_H
 
 #include "libavutil/buffer.h"
+#include "libavutil/frame.h"
+#include "libavutil/hwcontext.h"
 
 #include "avcodec.h"
 
@@ -34,6 +36,26 @@ typedef struct FrameDecodeData {
      * The original user-set opaque_ref.
      */
     AVBufferRef *user_opaque_ref;
+
+    /**
+     * 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);
+
+    /**
+     * Per-frame private data for hwaccels.
+     */
+    void *hwaccel_priv;
+    void (*hwaccel_priv_free)(void *priv);
 } FrameDecodeData;
 
 /**
@@ -49,4 +71,12 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
 
 void ff_decode_bsfs_uninit(AVCodecContext *avctx);
 
+/**
+ * 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);
+
 #endif /* AVCODEC_DECODE_H */