aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_filter.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-03-22 20:01:06 +0100
committerAnton Khirnov <anton@khirnov.net>2024-03-28 08:40:01 +0100
commit106131bb1034e197335ac0a8c564e6a1df7794fa (patch)
tree2c644090172c41e6a84e08cb83ccdd6edb28ffa1 /fftools/ffmpeg_filter.c
parentb1aaa1f585d3a69bb7a0972cbec9a8c71cce5610 (diff)
downloadffmpeg-106131bb1034e197335ac0a8c564e6a1df7794fa.tar.gz
fftools/ffmpeg_filter: remove display matrix if we have applied it
Diffstat (limited to 'fftools/ffmpeg_filter.c')
-rw-r--r--fftools/ffmpeg_filter.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 171e47be9e..ee49a45c33 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -143,6 +143,7 @@ typedef struct InputFilterPriv {
AVBufferRef *hw_frames_ctx;
int displaymatrix_present;
+ int displaymatrix_applied;
int32_t displaymatrix[9];
struct {
@@ -1552,6 +1553,7 @@ static int configure_input_video_filter(FilterGraph *fg, AVFilterGraph *graph,
av_assert0(desc);
// TODO: insert hwaccel enabled filters like transpose_vaapi into the graph
+ ifp->displaymatrix_applied = 0;
if ((ifp->opts.flags & IFILTER_FLAG_AUTOROTATE) &&
!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
int32_t *displaymatrix = ifp->displaymatrix;
@@ -1585,6 +1587,8 @@ static int configure_input_video_filter(FilterGraph *fg, AVFilterGraph *graph,
}
if (ret < 0)
return ret;
+
+ ifp->displaymatrix_applied = 1;
}
snprintf(name, sizeof(name), "trim_in_%s", ifp->opts.name);
@@ -2681,6 +2685,9 @@ static int send_frame(FilterGraph *fg, FilterGraphThread *fgt,
frame->duration = av_rescale_q(frame->duration, frame->time_base, ifp->time_base);
frame->time_base = ifp->time_base;
+ if (ifp->displaymatrix_applied)
+ av_frame_remove_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
+
fd = frame_data(frame);
if (!fd)
return AVERROR(ENOMEM);