[FFmpeg-cvslog] avfilter/avfilter: use av_frame_copy() to copy frame data

James Almer git at videolan.org
Wed Aug 4 00:43:10 EEST 2021


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Aug  2 09:55:27 2021 -0300| [e0b84d10696c818e4c7bdc3314ba14cc3cedde29] | committer: James Almer

avfilter/avfilter: use av_frame_copy() to copy frame data

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e0b84d10696c818e4c7bdc3314ba14cc3cedde29
---

 libavfilter/avfilter.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index c04afc6639..87f04dfc57 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -25,8 +25,8 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
 #include "libavutil/eval.h"
+#include "libavutil/frame.h"
 #include "libavutil/hwcontext.h"
-#include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
@@ -1446,19 +1446,10 @@ int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
         return ret;
     }
 
-    switch (link->type) {
-    case AVMEDIA_TYPE_VIDEO:
-        av_image_copy(out->data, out->linesize, (const uint8_t **)frame->data, frame->linesize,
-                      frame->format, frame->width, frame->height);
-        break;
-    case AVMEDIA_TYPE_AUDIO:
-        av_samples_copy(out->extended_data, frame->extended_data,
-                        0, 0, frame->nb_samples,
-                        frame->channels,
-                        frame->format);
-        break;
-    default:
-        av_assert0(!"reached");
+    ret = av_frame_copy(out, frame);
+    if (ret < 0) {
+        av_frame_free(&out);
+        return ret;
     }
 
     av_frame_free(&frame);



More information about the ffmpeg-cvslog mailing list