]> git.sesse.net Git - ffmpeg/commitdiff
lavc: add stream-global packet side data
authorAnton Khirnov <anton@khirnov.net>
Wed, 22 Jul 2015 12:39:30 +0000 (14:39 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 6 Dec 2015 09:22:43 +0000 (10:22 +0100)
This is similar to what is done for AVStream.

doc/APIchanges
libavcodec/avcodec.h
libavcodec/utils.c

index 0979930aacfff930df9e76e7e7c02149c3aa0b5b..bd7323c37b7e4d04612e1880a51094e9568d1ab2 100644 (file)
@@ -14,7 +14,8 @@ libavutil:     2015-08-28
 API changes, most recent first:
 
 2015-xx-xx - xxxxxxx - lavc 57.11.0 - avcodec.h
-  Add av_packet_add_side_data().
+  xxxxxxx - Add av_packet_add_side_data().
+  xxxxxxx - Add AVCodecContext.coded_side_data.
 
 2015-xx-xx - xxxxxxx - lavc 57.9.1 - avcodec.h
   Deprecate rtp_callback without replacement, i.e. it won't be possible to
index 5ed13de81ca14261d3df87e11997aea3ae7e4998..80cf644aef5836d782bdbb443a797e1789df67c3 100644 (file)
@@ -2925,6 +2925,16 @@ typedef struct AVCodecContext {
      * - decoding: Set by libavcodec before calling get_format()
      */
     enum AVPixelFormat sw_pix_fmt;
+
+    /**
+     * Additional data associated with the entire coded stream.
+     *
+     * - decoding: unused
+     * - encoding: may be set by libavcodec after avcodec_open2().
+     */
+    AVPacketSideData *coded_side_data;
+    int            nb_coded_side_data;
+
 } AVCodecContext;
 
 /**
index ad00a9215aaa4c1452154c7b22f0b080ea5108e5..f3361a016fc131d9f32d1185af24f7a6191a4660 100644 (file)
@@ -1603,9 +1603,11 @@ void avsubtitle_free(AVSubtitle *sub)
 
 av_cold int avcodec_close(AVCodecContext *avctx)
 {
+    int i;
+
     if (avcodec_is_open(avctx)) {
         FramePool *pool = avctx->internal->pool;
-        int i;
+
         if (HAVE_THREADS && avctx->internal->thread_ctx)
             ff_thread_free(avctx);
         if (avctx->codec && avctx->codec->close)
@@ -1622,6 +1624,11 @@ av_cold int avcodec_close(AVCodecContext *avctx)
         av_freep(&avctx->internal);
     }
 
+    for (i = 0; i < avctx->nb_coded_side_data; i++)
+        av_freep(&avctx->coded_side_data[i].data);
+    av_freep(&avctx->coded_side_data);
+    avctx->nb_coded_side_data = 0;
+
     if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
         av_opt_free(avctx->priv_data);
     av_opt_free(avctx);