[FFmpeg-devel] [PATCH 3/3] lavfi: add a framework to fix alignment problems.

Nicolas George george at nsup.org
Sat May 6 12:20:06 EEST 2017


A lot of filters require aligned frame data, but do not document it.
It can result in crashes with perfectly valid uses of the API.

Signed-off-by: Nicolas George <george at nsup.org>
---
 libavfilter/avfilter.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 60662c19ac..db9c02b8c0 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -569,6 +569,15 @@ struct AVFilterLink {
      */
     AVBufferRef *hw_frames_ctx;
 
+    /**
+     * Minimum alignment of frame data required by the destination filter.
+     * All frame data pointers must have the alignment lower bits cleared,
+     * i.e. be a multiple of 1<<alignment.
+     * Frames with insufficient alignment will be realigned by the
+     * framework.
+     */
+    unsigned alignment;
+
 #ifndef FF_INTERNAL_FIELDS
 
     /**
-- 
2.11.0



More information about the ffmpeg-devel mailing list