aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_filter.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-02-13 12:18:27 +0100
committerAnton Khirnov <anton@khirnov.net>2024-02-21 10:27:20 +0100
commit6315f78e0c0d847532f221cc696956888410d094 (patch)
tree1b446468bd81fd85eaa13deaf0c21391ed257837 /fftools/ffmpeg_filter.c
parentbd3c1c194bd2252ada4cfd025b14ae091a30b3b5 (diff)
downloadffmpeg-6315f78e0c0d847532f221cc696956888410d094.tar.gz
fftools/ffmpeg_filter: pass sub2video canvas size through InputFilterOptions
Rather than read them directly from InputStream. This is a step towards avoiding the assumption that filtergraph inputs are always fed by demuxers.
Diffstat (limited to 'fftools/ffmpeg_filter.c')
-rw-r--r--fftools/ffmpeg_filter.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 0f57035104..d182f3ab2e 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -689,6 +689,16 @@ static int ifilter_bind_ist(InputFilter *ifilter, InputStream *ist)
ifp->sub2video.frame = av_frame_alloc();
if (!ifp->sub2video.frame)
return AVERROR(ENOMEM);
+
+ ifp->width = ifp->opts.sub2video_width;
+ ifp->height = ifp->opts.sub2video_height;
+
+ /* rectangles are AV_PIX_FMT_PAL8, but we have no guarantee that the
+ palettes for all rectangles are identical or compatible */
+ ifp->format = AV_PIX_FMT_RGB32;
+
+ av_log(fgp, AV_LOG_VERBOSE, "sub2video: using %dx%d canvas\n",
+ ifp->width, ifp->height);
}
return 0;
@@ -1829,17 +1839,6 @@ int ifilter_parameters_from_dec(InputFilter *ifilter, const AVCodecContext *dec)
ret = av_channel_layout_copy(&ifp->fallback.ch_layout, &dec->ch_layout);
if (ret < 0)
return ret;
- } else {
- // for subtitles (i.e. sub2video) we set the actual parameters,
- // rather than just fallback
- ifp->width = ifp->ist->sub2video.w;
- ifp->height = ifp->ist->sub2video.h;
-
- /* rectangles are AV_PIX_FMT_PAL8, but we have no guarantee that the
- palettes for all rectangles are identical or compatible */
- ifp->format = AV_PIX_FMT_RGB32;
-
- av_log(NULL, AV_LOG_VERBOSE, "sub2video: using %dx%d canvas\n", ifp->width, ifp->height);
}
return 0;