]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/defaults.c
Fix ALLPROGS_G so that *_g binaries get cleaned properly
[ffmpeg] / libavfilter / defaults.c
index 4a48a3aff1f1fed2ba5ebafaf8280536822bf5ac..98339b6f30886b6551f58c71fc6d4c09c1fc8ac9 100644 (file)
@@ -37,26 +37,18 @@ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
  * alloc & free cycle currently implemented. */
 AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
 {
-    char *buf = NULL;
-    int linesize[4], i, tempsize;
+    int linesize[4];
     uint8_t *data[4];
     AVFilterBufferRef *picref = NULL;
 
-    av_image_fill_linesizes(linesize, link->format, w);
-    for (i = 0; i < 4; i++)
-        linesize[i] = FFALIGN(linesize[i], 16);
-    tempsize = av_image_fill_pointers(data, link->format, h, NULL, linesize);
-    buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be
-                                    // SIMD-friendly
-    if (!buf)
+    // +2 is needed for swscaler, +16 to be SIMD-friendly
+    if (av_image_alloc(data, linesize, w, h, link->format, 16) < 0)
         return NULL;
 
-    av_image_fill_pointers(data, link->format, h, buf, linesize);
-
     picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
                                                        perms, w, h, link->format);
     if (!picref) {
-        av_free(buf);
+        av_free(data[0]);
         return NULL;
     }
 
@@ -96,7 +88,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per
     chans_nb = av_get_channel_layout_nb_channels(channel_layout);
 
     per_channel_size = size/chans_nb;
-    ref->audio->samples_nb = per_channel_size/sample_size;
+    ref->audio->nb_samples = per_channel_size/sample_size;
 
     /* Set the number of bytes to traverse to reach next sample of a particular channel:
      * For planar, this is simply the sample size.
@@ -134,7 +126,6 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per
     return ref;
 
 fail:
-    av_free(buf);
     if (ref && ref->audio)
         av_free(ref->audio);
     av_free(ref);