]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/options.c
libfdk-aacdec: Reduce the default decoder delay by one frame
[ffmpeg] / libavcodec / options.c
index c28cbeb8e2c3988ce73e783638aa44ffca4986a2..e3ded738bb64e378c26e96f94174e1351b7f2475 100644 (file)
@@ -135,6 +135,21 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
     return avctx;
 }
 
+void avcodec_free_context(AVCodecContext **pavctx)
+{
+    AVCodecContext *avctx = *pavctx;
+
+    if (!avctx)
+        return;
+
+    avcodec_close(avctx);
+
+    av_freep(&avctx->extradata);
+    av_freep(&avctx->subtitle_header);
+
+    av_freep(pavctx);
+}
+
 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
 {
     const AVCodec *orig_codec = dest->codec;
@@ -162,6 +177,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
     dest->intra_matrix    = NULL;
     dest->inter_matrix    = NULL;
     dest->rc_override     = NULL;
+    dest->subtitle_header = NULL;
     if (src->rc_eq) {
         dest->rc_eq = av_strdup(src->rc_eq);
         if (!dest->rc_eq)
@@ -182,6 +198,8 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
     alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0);
     alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0);
     alloc_and_copy_or_fail(rc_override,  src->rc_override_count * sizeof(*src->rc_override), 0);
+    alloc_and_copy_or_fail(subtitle_header, src->subtitle_header_size, 0);
+    dest->subtitle_header_size = src->subtitle_header_size;
 #undef alloc_and_copy_or_fail
 
     return 0;