[libav-commits] lavf: reorder AVInput/OutputFormat fields.

Anton Khirnov git at libav.org
Tue Jan 31 07:37:40 CET 2012


Module: libav
Branch: master
Commit: 183eaa9a2525de485fe2e0e9e39671665ffc6df2

Author:    Anton Khirnov <anton at khirnov.net>
Committer: Anton Khirnov <anton at khirnov.net>
Date:      Fri Jan 27 12:29:37 2012 +0100

lavf: reorder AVInput/OutputFormat fields.

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

This breaks ABI.

---

 libavformat/avformat.h |  110 ++++++++++++++++++++++++++---------------------
 1 files changed, 61 insertions(+), 49 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index a78c1e3..09b78a9 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -309,13 +309,39 @@ typedef struct AVOutputFormat {
     const char *long_name;
     const char *mime_type;
     const char *extensions; /**< comma-separated filename extensions */
+    /* output support */
+    enum CodecID audio_codec;    /**< default audio codec */
+    enum CodecID video_codec;    /**< default video codec */
+    enum CodecID subtitle_codec; /**< default subtitle codec */
+    /**
+     * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
+     * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
+     * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH
+     */
+    int flags;
+
+    /**
+     * List of supported codec_id-codec_tag pairs, ordered by "better
+     * choice first". The arrays are all terminated by CODEC_ID_NONE.
+     */
+    const struct AVCodecTag * const *codec_tag;
+
+
+    const AVClass *priv_class; ///< AVClass for the private context
+
+    /*****************************************************************
+     * No fields below this line are part of the public API. They
+     * may not be used outside of libavformat and can be changed and
+     * removed at will.
+     * New public fields should be added right above.
+     *****************************************************************
+     */
+    struct AVOutputFormat *next;
     /**
      * size of private data so that it can be allocated in the wrapper
      */
     int priv_data_size;
-    /* output support */
-    enum CodecID audio_codec; /**< default audio codec */
-    enum CodecID video_codec; /**< default video codec */
+
     int (*write_header)(struct AVFormatContext *);
     /**
      * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags,
@@ -327,27 +353,10 @@ typedef struct AVOutputFormat {
     int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
     int (*write_trailer)(struct AVFormatContext *);
     /**
-     * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
-     * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
-     * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH
-     */
-    int flags;
-    /**
      * Currently only used to set pixel format if not YUV420P.
      */
     int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
                              AVPacket *in, int flush);
-
-    /**
-     * List of supported codec_id-codec_tag pairs, ordered by "better
-     * choice first". The arrays are all terminated by CODEC_ID_NONE.
-     */
-    const struct AVCodecTag * const *codec_tag;
-
-    enum CodecID subtitle_codec; /**< default subtitle codec */
-
-    const AVClass *priv_class; ///< AVClass for the private context
-
     /**
      * Test if the given codec can be stored in this container.
      *
@@ -355,9 +364,6 @@ typedef struct AVOutputFormat {
      *         A negative number if unknown.
      */
     int (*query_codec)(enum CodecID id, int std_compliance);
-
-    /* private fields */
-    struct AVOutputFormat *next;
 } AVOutputFormat;
 /**
  * @}
@@ -382,6 +388,38 @@ typedef struct AVInputFormat {
     const char *long_name;
 
     /**
+     * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
+     * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
+     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
+     */
+    int flags;
+
+    /**
+     * If extensions are defined, then no probe is done. You should
+     * usually not use extension format guessing because it is not
+     * reliable enough
+     */
+    const char *extensions;
+
+    const struct AVCodecTag * const *codec_tag;
+
+    const AVClass *priv_class; ///< AVClass for the private context
+
+    /*****************************************************************
+     * No fields below this line are part of the public API. They
+     * may not be used outside of libavformat and can be changed and
+     * removed at will.
+     * New public fields should be added right above.
+     *****************************************************************
+     */
+    struct AVInputFormat *next;
+
+    /**
+     * General purpose read-only value that the format can use.
+     */
+    int value;
+
+    /**
      * Size of private data so that it can be allocated in the wrapper.
      */
     int priv_data_size;
@@ -437,25 +475,6 @@ typedef struct AVInputFormat {
                               int64_t *pos, int64_t pos_limit);
 
     /**
-     * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
-     * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
-     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
-     */
-    int flags;
-
-    /**
-     * If extensions are defined, then no probe is done. You should
-     * usually not use extension format guessing because it is not
-     * reliable enough
-     */
-    const char *extensions;
-
-    /**
-     * General purpose read-only value that the format can use.
-     */
-    int value;
-
-    /**
      * Start/resume playing - only meaningful if using a network-based format
      * (RTSP).
      */
@@ -467,8 +486,6 @@ typedef struct AVInputFormat {
      */
     int (*read_pause)(struct AVFormatContext *);
 
-    const struct AVCodecTag * const *codec_tag;
-
     /**
      * Seek to timestamp ts.
      * Seeking will be done so that the point from which all active streams
@@ -476,11 +493,6 @@ typedef struct AVInputFormat {
      * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
      */
     int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
-
-    const AVClass *priv_class; ///< AVClass for the private context
-
-    /* private fields */
-    struct AVInputFormat *next;
 } AVInputFormat;
 /**
  * @}



More information about the libav-commits mailing list