Put all private fields at the end and mark them as such so they can be
easily changed/removed.

This breaks ABI.
---
 libavcodec/avcodec.h |   39 +++++++++++++++++++++++----------------
 1 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d8e56ca..20aa2d6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2780,31 +2780,20 @@ typedef struct AVCodec {
      * This is the primary way to find a codec from the user perspective.
      */
     const char *name;
+    /**
+     * Descriptive name for the codec, meant to be more human readable than 
name.
+     * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
+     */
+    const char *long_name;
     enum AVMediaType type;
     enum CodecID id;
-    int priv_data_size;
-    int (*init)(AVCodecContext *);
-    int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
-    int (*close)(AVCodecContext *);
-    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket 
*avpkt);
     /**
      * Codec capabilities.
      * see CODEC_CAP_*
      */
     int capabilities;
-    struct AVCodec *next;
-    /**
-     * Flush buffers.
-     * Will be called when seeking
-     */
-    void (*flush)(AVCodecContext *);
     const AVRational *supported_framerates; ///< array of supported 
framerates, or NULL if any, array is terminated by {0,0}
     const enum PixelFormat *pix_fmts;       ///< array of supported pixel 
formats, or NULL if unknown, array is terminated by -1
-    /**
-     * Descriptive name for the codec, meant to be more human readable than 
name.
-     * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
-     */
-    const char *long_name;
     const int *supported_samplerates;       ///< array of supported audio 
samplerates, or NULL if unknown, array is terminated by 0
     const enum AVSampleFormat *sample_fmts; ///< array of supported sample 
formats, or NULL if unknown, array is terminated by -1
     const uint64_t *channel_layouts;         ///< array of support channel 
layouts, or NULL if unknown. array is terminated by 0
@@ -2812,6 +2801,15 @@ typedef struct AVCodec {
     const AVClass *priv_class;              ///< AVClass for the private 
context
     const AVProfile *profiles;              ///< array of recognized profiles, 
or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
 
+    /*****************************************************************
+     * No fields below this line are part of the public API. They
+     * may not be used outside of libavcodec and can be changed and
+     * removed at will.
+     * New public fields should be added right above.
+     *****************************************************************
+     */
+    int priv_data_size;
+    struct AVCodec *next;
     /**
      * @name Frame-level threading support functions
      * @{
@@ -2854,6 +2852,15 @@ typedef struct AVCodec {
      */
     int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame 
*frame,
                    int *got_packet_ptr);
+    int (*init)(AVCodecContext *);
+    int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
+    int (*close)(AVCodecContext *);
+    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket 
*avpkt);
+    /**
+     * Flush buffers.
+     * Will be called when seeking
+     */
+    void (*flush)(AVCodecContext *);
 } AVCodec;
 
 /**
-- 
1.7.7.3

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

Reply via email to