Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Mark Thompson <sw@jkqxz.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avfilter: Temporary hack to fix format negotiation for hw formats
Date: Wed, 3 Jan 2024 20:46:04 +0000
Message-ID: <084180be-b440-4071-b118-c6b26a71c483@jkqxz.net> (raw)

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.
---
Suggested full fix is to carry sw_format through the format negotiation separately so that we don't need hw_frames_ctx to be set (which also has other benefits like hwdownload being able to set its output format).

This hack is needed until that is ready because all hw formats are broken right now.


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

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 727eff81ee..bc503f6ebe 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -667,8 +667,11 @@ 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 to work around hw_frames_ctx not yet
+            // being available to return the real sw_format.  Once that is
+            // fixed, this should instead be:
+            // swfmt = ((AVHWFramesContext *) link->hw_frames_ctx->data)->sw_format;
+            swfmt = AV_PIX_FMT_YUV420P;
          }

          if (!ff_fmt_is_regular_yuv(swfmt)) {
-- 
2.39.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2024-01-03 20:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 20:46 Mark Thompson [this message]
2024-01-04  4:01 ` Xiang, Haihao
2024-01-04 21:54 ` Mark Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=084180be-b440-4071-b118-c6b26a71c483@jkqxz.net \
    --to=sw@jkqxz.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git