1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

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

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2021-08-02 09:55:27 -03:00
parent 8b83dad825
commit e0b84d1069

View File

@ -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);