diff mbox series

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

Message ID 20210802131018.338-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avfilter/avfilter: use av_frame_copy() to copy frame data | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer Aug. 2, 2021, 1:10 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavfilter/avfilter.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

Comments

Paul B Mahol Aug. 3, 2021, 6:41 a.m. UTC | #1
lgtm, check if some headers are not needed after this.
Nicolas George Aug. 3, 2021, 7:59 a.m. UTC | #2
James Almer (12021-08-02):
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavfilter/avfilter.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)

imgutils.h is probably now unneeded. LGTM otherwise.

Regards,
diff mbox series

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index c04afc6639..1f33702482 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -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);