From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 0EF1F47FE1 for ; Tue, 7 Nov 2023 22:23:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DD05168CC49; Wed, 8 Nov 2023 00:23:24 +0200 (EET) Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0FA2B68CAE8 for ; Wed, 8 Nov 2023 00:23:19 +0200 (EET) Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-53e08e439c7so10720667a12.0 for ; Tue, 07 Nov 2023 14:23:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699395798; x=1700000598; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=f2L4GBvjYc/zQLHL3GABXGCqAzQ0CIes1yZkX1fWlco=; b=mfog/r6P9V+ok6S5lDKjAIJHYN+yBnyqPpsgfR8xC4gfYFDsJz9xWrXbT71K7kR0Vh AsOcjtck3dINjXz0uoLINLYaxz5TwbNusfl3sY6I0rGNlJAFpOaNcSqpVQPyFFJJfC89 t6uQbrHW0L5QrpxcGaWGEE2LNfeKkXpYRfB9GsG+CbuuCkSy6Ls4SefR1CRWACLelf6N 4Gacs/o1pBReGO1X4J6CT/UEXWO78TPLdzFK8R9Iub/fNHg2vw1ofOVrJ1/ztnaAhLCP 4Fbx/Uo1VKPINmwB57jEIV461SyQ3aU8FbdwNE1hzDl6UHxOLW+pGHTMHU+Drto28CcX e+gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699395798; x=1700000598; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f2L4GBvjYc/zQLHL3GABXGCqAzQ0CIes1yZkX1fWlco=; b=PDmR/Vswn4xC01dNU4VxT8AkoUW4z11kefilHYE77ml38sF12yCrt9OJoeLBWb6wQV 2boe4beJs/tmmH1htZM1Em02dAiIl9i7VBNp71Gww8VmZNM9keQWHd9JDxGaibrm4qLl fX8+lghvo5gwkN72WxKokCU5lN3AhwFp/RJM1pD/IK+CthRT6YzMZSdete+0lrne5CVB Hth3VUsm4IIcEopzBxwGqh1r3sRWRNI87CN6pk3U2dMe+JP0NsoQ4003ciJZqdcFLqKn 3x9mf4QIBICyRKVE3a+8EAd6cnazYTclsvrJquozWVhNN70WRMVhGsDRtKvpbsS00a+o +lDA== X-Gm-Message-State: AOJu0YzkkrE3n2Q7qbHnPFElH7Ip4AIBq8YSlzjdVyzHKsrQxKjXBqxp 3GGT491T9fTRlLQvT3KAkIi9z7D5Zlc= X-Google-Smtp-Source: AGHT+IGURn64jOl9ROJIIwEOfDtDeYM3b35jSAGhR/ThhtVoLT2ccLKIWR8LjCz75EGqkyFXrhPOVg== X-Received: by 2002:a50:d658:0:b0:53d:a0c9:dbd4 with SMTP id c24-20020a50d658000000b0053da0c9dbd4mr21975edj.21.1699395798101; Tue, 07 Nov 2023 14:23:18 -0800 (PST) Received: from MBP-von-Marvin.citadel.scalie.me (84-112-104-25.cable.dynamic.surfer.at. [84.112.104.25]) by smtp.gmail.com with ESMTPSA id s5-20020aa7d785000000b0053da3a9847csm5767178edq.42.2023.11.07.14.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 14:23:17 -0800 (PST) From: Marvin Scholz To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 Nov 2023 23:21:17 +0100 Message-Id: <20231107222118.35545-1-epirat07@gmail.com> X-Mailer: git-send-email 2.39.3 (Apple Git-145) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avfilter/vf_tpad: fix check for drawing initialization X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marvin Scholz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: The check if drawing needs to be initialized and supported formats should be drawable ones was flawed, as pad_stop/pad_start is only populated from stop_duration/start_duration after these checks. To fix that, check the _duration variants as well and for better readability and maintainability break the check out into its own helper. Fixes a regression from 86b252ea9dee18006910e30646ad1067f2d1323f Fix #10621 --- libavfilter/vf_tpad.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c index 7990403e81..1efe4ec479 100644 --- a/libavfilter/vf_tpad.c +++ b/libavfilter/vf_tpad.c @@ -70,11 +70,17 @@ static const AVOption tpad_options[] = { AVFILTER_DEFINE_CLASS(tpad); +static int needs_drawing(const TPadContext *s) { + return ( + (s->stop_mode == MODE_ADD && (s->pad_stop != 0 || s->stop_duration != 0)) || + (s->start_mode == MODE_ADD && (s->pad_start != 0 || s->start_duration != 0)) + ); +} + static int query_formats(AVFilterContext *ctx) { TPadContext *s = ctx->priv; - if ((s->stop_mode == MODE_ADD && s->pad_stop != 0) || - (s->start_mode == MODE_ADD && s->pad_start != 0)) + if (needs_drawing(s)) return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); return ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_VIDEO)); @@ -196,8 +202,7 @@ static int config_input(AVFilterLink *inlink) AVFilterContext *ctx = inlink->dst; TPadContext *s = ctx->priv; - if ((s->stop_mode == MODE_ADD && s->pad_stop != 0) || - (s->start_mode == MODE_ADD && s->pad_start != 0)) { + if (needs_drawing(s)) { ff_draw_init(&s->draw, inlink->format, 0); ff_draw_color(&s->draw, &s->color, s->rgba_color); } -- 2.39.3 (Apple Git-145) _______________________________________________ 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".