Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Marvin Scholz <epirat07@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Marvin Scholz <epirat07@gmail.com>
Subject: [FFmpeg-devel] [PATCH v3 2/2] avfilter/vf_tpad: accept hardware frames in clone-only mode
Date: Mon, 22 May 2023 12:14:33 +0200
Message-ID: <20230522101433.40493-2-epirat07@gmail.com> (raw)
In-Reply-To: <20230522101433.40493-1-epirat07@gmail.com>

When no drawing is to be performed, tpad can work fine with
hardware frames, so advertise this in the query_formats
callback and ensure the drawing context is never initialised
when just cloning frames.
---
 libavfilter/vf_tpad.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c
index d0fa7df8be..c2e266cb1a 100644
--- a/libavfilter/vf_tpad.c
+++ b/libavfilter/vf_tpad.c
@@ -71,7 +71,12 @@ AVFILTER_DEFINE_CLASS(tpad);
 
 static int query_formats(AVFilterContext *ctx)
 {
-    return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
+    TPadContext *s = ctx->priv;
+    if ((s->stop_mode == MODE_ADD && s->pad_stop != 0) ||
+        (s->start_mode == MODE_ADD && s->pad_start != 0))
+        return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
+
+    return ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_VIDEO));
 }
 
 static int activate(AVFilterContext *ctx)
@@ -190,8 +195,11 @@ static int config_input(AVFilterLink *inlink)
     AVFilterContext *ctx = inlink->dst;
     TPadContext *s = ctx->priv;
 
-    ff_draw_init(&s->draw, inlink->format, 0);
-    ff_draw_color(&s->draw, &s->color, s->rgba_color);
+    if ((s->stop_mode == MODE_ADD && s->pad_stop != 0) ||
+        (s->start_mode == MODE_ADD && s->pad_start != 0)) {
+        ff_draw_init(&s->draw, inlink->format, 0);
+        ff_draw_color(&s->draw, &s->color, s->rgba_color);
+    }
 
     if (s->start_duration)
         s->pad_start = av_rescale_q(s->start_duration, inlink->frame_rate, av_inv_q(AV_TIME_BASE_Q));
-- 
2.37.0 (Apple Git-136)

_______________________________________________
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:[~2023-05-22 10:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19 10:42 [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: use enum for start/stop_mode Marvin Scholz
2023-04-19 10:42 ` [FFmpeg-devel] [PATCH 2/2] avfilter/vf_tpad: accept hardware frames in clone-only mode Marvin Scholz
2023-04-19 10:45   ` Marvin Scholz
2023-05-01 12:18 ` [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: use enum for start/stop_mode Marvin Scholz
2023-05-01 12:18   ` [FFmpeg-devel] [PATCH 2/2] avfilter/vf_tpad: accept hardware frames in clone-only mode Marvin Scholz
2023-05-05 20:02     ` Thilo Borgmann
2023-05-05 20:01   ` [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: use enum for start/stop_mode Thilo Borgmann
2023-05-22 10:14 ` [FFmpeg-devel] [PATCH v3 " Marvin Scholz
2023-05-22 10:14   ` Marvin Scholz [this message]
2023-05-22 16:37   ` Niklas Haas

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=20230522101433.40493-2-epirat07@gmail.com \
    --to=epirat07@gmail.com \
    --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