[FFmpeg-cvslog] avfilter: Temporary hack to fix format negotiation for hw formats

Mark Thompson git at videolan.org
Thu Jan 4 23:48:52 EET 2024


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Wed Jan  3 20:40:19 2024 +0000| [8b76bae8961c3045fa73aa2da47345c70a93d599] | committer: Mark Thompson

avfilter: Temporary hack to fix format negotiation for hw formats

hw_frames_ctx on the input link is only set when the input link is
configured, which hasn't happened yet.  This temporarily hacks around
the problem (in a way no worse than before the format negotiation
changes) until a proper fix can be applied.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b76bae8961c3045fa73aa2da47345c70a93d599
---

 libavfilter/avfiltergraph.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 727eff81ee..96aa137e6d 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -667,8 +667,12 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref)
     if (link->type == AVMEDIA_TYPE_VIDEO) {
         enum AVPixelFormat swfmt = link->format;
         if (av_pix_fmt_desc_get(swfmt)->flags & AV_PIX_FMT_FLAG_HWACCEL) {
-            av_assert1(link->hw_frames_ctx);
-            swfmt = ((AVHWFramesContext *) link->hw_frames_ctx->data)->sw_format;
+            // FIXME: this is a hack - we'd like to use the sw_format of
+            // link->hw_frames_ctx here, but it is not yet available.
+            // To make this work properly we will need to either reorder
+            // things so that it is available here or somehow negotiate
+            // sw_format separately.
+            swfmt = AV_PIX_FMT_YUV420P;
         }
 
         if (!ff_fmt_is_regular_yuv(swfmt)) {



More information about the ffmpeg-cvslog mailing list