[gegl/video-rejuvenation: 52/83] ff-save: free avformatcontext



commit 95765652b78d8a10fcc8ac3b65d086c7c69eab7a
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Nov 9 00:49:34 2015 +0100

    ff-save: free avformatcontext

 operations/external/ff-save.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c
index ab09ae1..87723ce 100644
--- a/operations/external/ff-save.c
+++ b/operations/external/ff-save.c
@@ -567,7 +567,7 @@ alloc_picture (int pix_fmt, int width, int height)
   picture = avcodec_alloc_frame ();
   if (!picture)
     return NULL;
-  size = avpicture_get_size (pix_fmt, width, height);
+  size = avpicture_get_size (pix_fmt, width, height + 1);
   picture_buf = malloc (size);
   if (!picture_buf)
     {
@@ -794,14 +794,6 @@ tfile (GeglProperties *o)
      /*XXX: FOO p->audio_st = add_audio_stream (op, p->oc, p->fmt->audio_codec);*/
     }
 
-#if 0  /* ick - grid */
-  if (av_set_parameters (p->oc, NULL) < 0)
-    {
-      fprintf (stderr, "Invalid output format propeters\n%s", "");
-      return -1;
-    }
-#endif
-
   av_dump_format (p->oc, 0, o->path, 1);
 
   if (p->video_st)
@@ -880,15 +872,17 @@ finalize (GObject *object)
           close_audio (p, p->oc, p->audio_st);
 
         av_write_trailer (p->oc);
-
+#if 0
         for (i = 0; i < p->oc->nb_streams; i++)
           {
             av_freep (&p->oc->streams[i]);
           }
+#endif
 
-        avio_close (p->oc->pb);
-        free (p->oc);
+        avio_closep (&p->oc->pb);
+        avformat_free_context (p->oc);
       }
+
       g_free (o->user_data);
       o->user_data = NULL;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]