[gegl/video-rejuvenation: 82/83] ff-load/ff-save: use gobject instead of custom allocaiton for GeglAudioFragment



commit 6eda9caf5dc64b04118a2fe64f73c098fe1a824e
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Nov 19 21:30:21 2015 +0100

    ff-load/ff-save: use gobject instead of custom allocaiton for GeglAudioFragment

 operations/external/ff-load.c |    4 ++--
 operations/external/ff-save.c |    5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index 4133c7e..03530f5 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -229,7 +229,7 @@ decode_audio (GeglOperation *operation,
             {
                int sample_count = MIN (samples_left, GEGL_MAX_AUDIO_SAMPLES);
 
-               GeglAudioFragment *af = g_malloc0 (sizeof (GeglAudioFragment));
+               GeglAudioFragment *af = gegl_audio_fragment_new ();
           
                af->channels = MIN(p->audio_stream->codec->channels, GEGL_MAX_AUDIO_CHANNELS);
 
@@ -592,7 +592,7 @@ static void get_sample_data (Priv *p, long sample_no, float *left, float *right)
             if (sample_no > af->pos + af->samples)
             {
               p->audio_track = g_list_remove (p->audio_track, af);
-              g_free (af);
+              g_object_unref (af);
               goto again;
             }
           }
diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c
index 1d8efd4..f8db74f 100644
--- a/operations/external/ff-save.c
+++ b/operations/external/ff-save.c
@@ -149,7 +149,7 @@ static void get_sample_data (Priv *p, long sample_no, float *left, float *right)
             if (sample_no > af->pos + af->samples)
             {
               p->audio_track = g_list_remove (p->audio_track, af);
-              g_free (af);
+              g_object_unref (af);
               goto again;
             }
           }
@@ -319,7 +319,6 @@ void
 write_audio_frame (GeglProperties *o, AVFormatContext * oc, AVStream * st)
 {
   Priv *p = (Priv*)o->user_data;
-
   AVCodecContext *c;
   AVPacket  pkt = { 0 };
   av_init_packet (&pkt);
@@ -327,7 +326,7 @@ write_audio_frame (GeglProperties *o, AVFormatContext * oc, AVStream * st)
   /* first we add incoming frames audio samples */
   {
     int i;
-    GeglAudioFragment *af = g_malloc0 (sizeof (GeglAudioFragment));
+    GeglAudioFragment *af = gegl_audio_fragment_new ();
     af->channels = 2; //o->audio->channels;
     af->samples = o->audio->samples;
     for (i = 0; i < af->samples; i++)


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