[FFmpeg-devel] [PATCH 2/3] lavc: add a framework to fix alignment problems.
Nicolas George
george at nsup.org
Sat May 6 12:20:05 EEST 2017
A lot of codecs require aligned frame data, but do not document it.
It can result in crashes with perfectly valid uses of the API.
TODO Implementation missing.
Design rationale:
- requiring frame data to be always aligned would be wasteful;
- alignment requirements will evolve
(the 16->32 bump is still recent);
- requiring applications to worry about alignment is not convenient.
Signed-off-by: Nicolas George <george at nsup.org>
---
libavcodec/avcodec.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 35df4f6ced..51a7e2db21 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3644,6 +3644,16 @@ typedef struct AVCodecContext {
* AVCodecContext.get_format callback)
*/
int hwaccel_flags;
+
+ /**
+ * Minimum alignment of frame data required by the codec.
+ * All frame data pointers must have the alignment lower bits cleared,
+ * i.e. be a multiple of 1<<alignment.
+ * - encoding: set by the encoder and used by the framework
+ * - decoding: unused
+ */
+ unsigned alignment;
+
} AVCodecContext;
AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
--
2.11.0
More information about the ffmpeg-devel
mailing list