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 BFB0948C9B for ; Wed, 24 Jan 2024 08:17:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DBD8168D124; Wed, 24 Jan 2024 10:17:29 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 38E2F68D0D3 for ; Wed, 24 Jan 2024 10:17:21 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=l6m0slcH; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id D63601114 for ; Wed, 24 Jan 2024 09:17:20 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id Y85SwvoMa8uj for ; Wed, 24 Jan 2024 09:17:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1706084239; bh=VshNXXgeRk5VCzukyt09+xWtxowY5yqLDlYuxJhOqX4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=l6m0slcH//IhOwBkByOtfnBS+gMNWiAkBUEV+X1rEpj9Koy8N9BDaem2+rmMnMgTw /dFjX4l36AohTpcUoQB8+dcJjH513/InDzIYjexZZqYWVeQ58ju5tekQrpOiR81Lt6 yTjmbUB8tvvieZhJ8vmqpO2pd4nIvmOmYeGIPyJQikLIyn0Bf4ZJ/D9VESN3NvoZ29 SIGbVXEhbLin3o/WciTcO/kSnymOX/3QZQl0YX/5zLkWzET1pGKS/W2YE/C1cRgCPI n7lV17quItXZzN+g+Ha6BpMvUB5i51ad8YqdSjcOtY1vQ/IwUtWVVg6TWjhl9cKepe BhI7hnFVVKLTA== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 6F3B219BC for ; Wed, 24 Jan 2024 09:17:19 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 3B2EB3A0582 for ; Wed, 24 Jan 2024 09:17:19 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jan 2024 09:16:33 +0100 Message-ID: <20240124081702.4759-3-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240124081702.4759-1-anton@khirnov.net> References: <20240124081702.4759-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/31] fftools/ffmpeg_filter: consolidate decoder/filter type checks 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 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: Also perform them earlier. --- fftools/ffmpeg_filter.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 82ee4fae7d..4b660002ed 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -663,6 +663,13 @@ static int ifilter_bind_ist(InputFilter *ifilter, InputStream *ist) av_assert0(!ifp->ist); + if (ifp->type != ist->par->codec_type && + !(ifp->type == AVMEDIA_TYPE_VIDEO && ist->par->codec_type == AVMEDIA_TYPE_SUBTITLE)) { + av_log(fgp, AV_LOG_ERROR, "Tried to connect %s stream to %s filtergraph input\n", + av_get_media_type_string(ist->par->codec_type), av_get_media_type_string(ifp->type)); + return AVERROR(EINVAL); + } + ifp->ist = ist; ifp->type_src = ist->st->codecpar->codec_type; @@ -1476,12 +1483,6 @@ static int configure_input_video_filter(FilterGraph *fg, AVFilterGraph *graph, if (!par) return AVERROR(ENOMEM); - if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { - av_log(fg, AV_LOG_ERROR, "Cannot connect video filter to audio input\n"); - ret = AVERROR(EINVAL); - goto fail; - } - if (!fr.num) fr = ist->framerate_guessed; @@ -1598,11 +1599,6 @@ static int configure_input_audio_filter(FilterGraph *fg, AVFilterGraph *graph, int ret, pad_idx = 0; int64_t tsoffset = 0; - if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_AUDIO) { - av_log(fg, AV_LOG_ERROR, "Cannot connect audio filter to non audio input\n"); - return AVERROR(EINVAL); - } - ifp->time_base = (AVRational){ 1, ifp->sample_rate }; av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC); -- 2.42.0 _______________________________________________ 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".