This adds a way for the user to control the size of the hardware frame
output pool allocated internally by lavc.  This is useful if they want
to hold onto a large number of output frames at the same time (for
example, when feeding the frames into an encoder with a large delay).
---
+ version bump


 doc/APIchanges             |  3 +++
 libavcodec/avcodec.h       | 13 +++++++++++++
 libavcodec/options_table.h |  1 +
 3 files changed, 17 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 9367a5fc4..835b39bea 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2017-03-xx - xxxxxxx - lavc 57.xx.0 - avcodec.h
+  Add AVCodecContext.extra_hw_frames.
+
 2017-02-10 - xxxxxxx - lavu 55.33.0 - spherical.h
   Add AV_SPHERICAL_EQUIRECTANGULAR_TILE, av_spherical_tile_bounds(),
   and projection-specific properties (bound_left, bound_top, bound_right,
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 62a4fab8f..ba0b4ca51 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3186,6 +3186,19 @@ typedef struct AVCodecContext {
      * contexts used must be created on the same device.
      */
     AVBufferRef *hw_device_ctx;
+
+    /**
+     * Video decoding only.  Sets the number of extra hardware frames which
+     * the decoder will allocate for use by the caller.
+     *
+     * Some hardware decoders require all frames that they will use for
+     * output to be defined in advance before decoding starts.  For such
+     * decoders, the hardware frame pool must therefore be of a fixed size.
+     * The extra frames set here are on top of any number that the decoder
+     * needs internally in order to operate normally (for example, frames
+     * used as reference pictures).
+     */
+    int extra_hw_frames;
 } AVCodecContext;
 
 /**
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 3ac53fb74..78e9a3ef7 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -532,6 +532,7 @@ static const AVOption avcodec_options[] = {
 {"side_data_only_packets", NULL, OFFSET(side_data_only_packets), 
AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, A|V|E },
 #endif
 {"apply_cropping", NULL, OFFSET(apply_cropping), AV_OPT_TYPE_INT, { .i64 = 1 
}, 0, 1, V | D },
+{"extra_hw_frames", "Number of extra hardware frames to allocate for the 
user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V|D 
},
 {NULL},
 };
 
-- 
2.11.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to