You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
fftools/ffmpeg_filter: use av_buffer_replace() to improve code
It is shorter and more efficient.
This commit is contained in:
@@ -1415,7 +1415,9 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr
|
|||||||
AVFrameSideData *sd;
|
AVFrameSideData *sd;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
av_buffer_unref(&ifp->hw_frames_ctx);
|
ret = av_buffer_replace(&ifp->hw_frames_ctx, frame->hw_frames_ctx);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ifilter->format = frame->format;
|
ifilter->format = frame->format;
|
||||||
|
|
||||||
@@ -1433,12 +1435,6 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr
|
|||||||
if (sd)
|
if (sd)
|
||||||
ifp->displaymatrix = av_memdup(sd->data, sizeof(int32_t) * 9);
|
ifp->displaymatrix = av_memdup(sd->data, sizeof(int32_t) * 9);
|
||||||
|
|
||||||
if (frame->hw_frames_ctx) {
|
|
||||||
ifp->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx);
|
|
||||||
if (!ifp->hw_frames_ctx)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user