Explicitly forbid reusing encoder instance (#3163)
diff --git a/include/avif/avif.h b/include/avif/avif.h
index 2d3d880..204827b 100644
--- a/include/avif/avif.h
+++ b/include/avif/avif.h
@@ -1415,6 +1415,9 @@
// to reset the internal decoder back to before the first frame. Calling either
// avifDecoderSetSource() or avifDecoderParse() will automatically Reset the decoder.
//
+// The decoder must be destroyed once there is no need for further parsing or decoding.
+// Reusing the decoder instance for another file is not recommended. Call avifDecoderCreate() instead.
+//
// avifDecoderSetSource() allows you not only to choose whether to parse tracks or
// items in a file containing both, but switch between sources without having to
// Parse again. Normally AVIF_DECODER_SOURCE_AUTO is enough for the common path.
@@ -1648,6 +1651,7 @@
//
// Usage / function call order is:
// * avifEncoderCreate()
+//
// - Still image:
// * avifEncoderAddImage() [exactly once]
// - Still image grid:
@@ -1661,12 +1665,16 @@
// - Still layered grid:
// * Set encoder->extraLayerCount correctly
// * avifEncoderAddImageGrid() ... [exactly encoder->extraLayerCount+1 times]
+//
// * avifEncoderFinish()
// * avifEncoderDestroy()
//
// The image passed to avifEncoderAddImage() or avifEncoderAddImageGrid() is encoded during the
// call (which may be slow) and can be freed after the function returns.
//
+// The encoder must be destroyed after avifEncoderFinish() is called.
+// The encoder instance cannot be reused. Call avifEncoderCreate() instead.
+//
// durationInTimescales is ignored if AVIF_ADD_IMAGE_FLAG_SINGLE is set in addImageFlags,
// or if we are encoding a layered image.
AVIF_API avifResult avifEncoderAddImage(avifEncoder * encoder, const avifImage * image, uint64_t durationInTimescales, avifAddImageFlags addImageFlags);