[FFmpeg-devel] [PATCH] avcodec: Add padding after the remaining AVFrames

Michael Niedermayer michaelni at gmx.at
Tue Mar 18 00:48:41 CET 2014


This limits ABI issues in case libavcodec is linked to a libavutil with larger AVFrame
Which can happen if they are shiped in seperate binary packages and libavutil is upgraded

A cleaner alternative would be to replace them by pointers but this would likely cause
a small speedloss

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/h264.h      |    1 +
 libavcodec/mpegvideo.h |    1 +
 libavcodec/utils.c     |    1 +
 3 files changed, 3 insertions(+)

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 7f738d5..7262239 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -289,6 +289,7 @@ typedef struct MMCO {
 
 typedef struct H264Picture {
     struct AVFrame f;
+    uint8_t avframe_padding[1024]; // hack to allow linking to a avutil with larger AVFrame
     ThreadFrame tf;
 
     AVBufferRef *qscale_table_buf;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index ef5092e..bc4a1d2 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -93,6 +93,7 @@ struct MpegEncContext;
  */
 typedef struct Picture{
     struct AVFrame f;
+    uint8_t avframe_padding[1024]; // hack to allow linking to a avutil with larger AVFrame
     ThreadFrame tf;
 
     AVBufferRef *qscale_table_buf;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b6c357a..3e7b154 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -807,6 +807,7 @@ int avcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame)
 typedef struct CompatReleaseBufPriv {
     AVCodecContext avctx;
     AVFrame frame;
+    uint8_t avframe_padding[1024]; // hack to allow linking to a avutil with larger AVFrame
 } CompatReleaseBufPriv;
 
 static void compat_free_buffer(void *opaque, uint8_t *data)
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list