]> git.sesse.net Git - ffmpeg/commitdiff
lavf: add an AVStream field for exporting stream-global side data
authorAnton Khirnov <anton@khirnov.net>
Wed, 19 Feb 2014 11:10:32 +0000 (12:10 +0100)
committerAnton Khirnov <anton@khirnov.net>
Mon, 24 Mar 2014 05:07:51 +0000 (06:07 +0100)
doc/APIchanges
libavformat/avformat.h
libavformat/utils.c
libavformat/version.h

index cfa3068c6d05f86e9e9a46697544c2849ec900fa..120ba8339d105bb09a33cad9313d87a821250d97 100644 (file)
@@ -13,6 +13,10 @@ libavutil:     2013-12-xx
 
 API changes, most recent first:
 
+2014-02-xx - xxxxxxx - lavf 55.13.0 - avformat.h
+  Add AVStream.side_data and AVStream.nb_side_data for exporting stream-global
+  side data (e.g. replaygain tags, video rotation)
+
 2014-02-xx - xxxxxxx - lavc 55.35.0 - avcodec.h
   Give the name AVPacketSideData to the previously anonymous struct used for
   AVPacket.side_data.
index ec9c2627cba3b457c66b5ca91be34f624628f99c..02ee6ba178c38efff8e0c0ea4f46ee9273d524fa 100644 (file)
@@ -755,6 +755,28 @@ typedef struct AVStream {
      */
     AVPacket attached_pic;
 
+    /**
+     * An array of side data that applies to the whole stream (i.e. the
+     * container does not allow it to change between packets).
+     *
+     * There may be no overlap between the side data in this array and side data
+     * in the packets. I.e. a given side data is either exported by the muxer
+     * (demuxing) / set by the caller (muxing) in this array, then it never
+     * appears in the packets, or the side data is exported / sent through
+     * the packets (always in the first packet where the value becomes known or
+     * changes), then it does not appear in this array.
+     *
+     * - demuxing: Set by libavformat when the stream is created.
+     * - muxing: May be set by the caller before avformat_write_header().
+     *
+     * Freed by libavformat in avformat_free_context().
+     */
+    AVPacketSideData *side_data;
+    /**
+     * The number of elements in the AVStream.side_data array.
+     */
+    int            nb_side_data;
+
     /*****************************************************************
      * All fields below this line are not part of the public API. They
      * may not be used outside of libavformat and can be changed and
index 3f400e33a75d263200dcc1d8119e5081fac42436..164cdd7a6aa65c1f804aca498922782929efed8c 100644 (file)
@@ -2595,7 +2595,7 @@ int av_read_pause(AVFormatContext *s)
 
 void avformat_free_context(AVFormatContext *s)
 {
-    int i;
+    int i, j;
     AVStream *st;
 
     av_opt_free(s);
@@ -2605,6 +2605,12 @@ void avformat_free_context(AVFormatContext *s)
     for (i = 0; i < s->nb_streams; i++) {
         /* free all data in a stream component */
         st = s->streams[i];
+
+        for (j = 0; j < st->nb_side_data; j++)
+            av_freep(&st->side_data[j].data);
+        av_freep(&st->side_data);
+        st->nb_side_data = 0;
+
         if (st->parser) {
             av_parser_close(st->parser);
         }
index 3d1e21f17b8384e14ed9ca220758dc2241342f32..ef5a148deb91741925be95d06925f77f9db6dca6 100644 (file)
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR 55
-#define LIBAVFORMAT_VERSION_MINOR 12
+#define LIBAVFORMAT_VERSION_MINOR 13
 #define LIBAVFORMAT_VERSION_MICRO  0
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \