From patchwork Wed May 25 22:52:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 35932 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6914:b0:82:6b11:2509 with SMTP id q20csp84611pzj; Wed, 25 May 2022 15:52:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjZpoWU/FxXbLuvvJ9pBu95wpQZgQWIm15mqRdBlUeTeq1EZKNWBj5Too9NrcIL95QIy79 X-Received: by 2002:a17:907:7b9e:b0:6fe:d8df:d1e7 with SMTP id ne30-20020a1709077b9e00b006fed8dfd1e7mr16923359ejc.225.1653519159441; Wed, 25 May 2022 15:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653519159; cv=none; d=google.com; s=arc-20160816; b=qhkrGQ+eZaTpB84WJf4VRvfp3v7MCIuAR8OjNlj6pu/gH0JqN86gWshxbe54EqkWgQ WGn+ssru7hzLPd646yqf2kr9dyIOfI3dsPSboSUbTI8FbcHxofK/E/ERBRkBOcUqqPGe gwV2Sv+1irkuTCeojOU2jVLXsY8zxs39Nqd/IOatD6pi7zdjCTicuGmggL4s9VI+nIwI JmyOv62PW7h/YvPDt9Bso+zRj0/NtWGFN6NBpDLjFZIgHMyp+pmW2IK18wE7ddTM399L 3OpPa0nt0aon5GiuDdJ/EaU3Wl/2w7fg9ri2Ycy8yHgFG1cg8jWjP4srZuPY2GMeVoK4 gt1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=SnKOeYL+MpJVWTXlc/Z29rGSQSzJoUwaDVW1rzC6g1s=; b=XrXArAkIqsptzLgUrLR8UQ889E1Q9y1dOqhcflYoDfKo855so3fozvBDyQixQEejoM ToS/mvZYQX9JgSF/jvLPnedgC3pO8herMa8zXWZXXDhTPmenODuU3vncf22D6TWqnbcq cUztVklaR49OvFCzQxJIDv1qzVRfEWTEDpkjs6FROpdocJ3l5fwmDXKhWh5tiCtB2wA+ tDZuqm8q4G73EaGuTiue7wvUURn4OyILX+4sdotItIVl/RHgzpYojLu09MJ5DkMc3dbr pwWoCcETEKtiQNPD2mY/muXlan9CH7E5QD+2nT5J9q2FLI+lJq5ciBiHZwNdAQOJTQxK 7nSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=F12JLn7u; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b7-20020a056402278700b0042b42c7f655si6319971ede.33.2022.05.25.15.52.38; Wed, 25 May 2022 15:52:39 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=F12JLn7u; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AFB5868B584; Thu, 26 May 2022 01:52:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1DCCA68B3AD for ; Thu, 26 May 2022 01:52:29 +0300 (EEST) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-f2cd424b9cso283014fac.7 for ; Wed, 25 May 2022 15:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=vVrxf51UuwGgO4ehnslzGjrde/+8VCLGi1d9J0l3xzs=; b=F12JLn7ujc0XTtzmuNZHmq/JUHmADyPaxW5G1E56niI7Jv/7Anf3Y4zJVTP2gtaDfl aE1xQBg6N77BLFiSjtQzsciA/IVEEdOq2TR9IR+RsbQcVCyLBYNJPZbXJE4xPMnnMo38 Gf2OoMSZPWIkaqwf+F2k+btlJxLNB00fmzb//0nSLDsw9xFmuJVi/X+K/LD3nIa9nBfD iv4rVXQkp37rwmvQK868lIdeLhLyyyK4cv3MIpWWMmYekUaisghdktsmxHwKwiZiN90f A/THB0ns87qB/mGrC5R+5zAgNx854Pi0VgGLJxpn6w6+CuwONwa5akkWt/30NytaqYPl 9B+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=vVrxf51UuwGgO4ehnslzGjrde/+8VCLGi1d9J0l3xzs=; b=W8GFmdSADF4QtB0HLIXf5nYjn0Odh2LeHVEfjyuEhk7jjsvycZk31vQws6pzPi6RdE dDd7ig2s+rpGsiIOHedhpt08xhC9Ra0LqvVMQTzuaGrZ5DWoLuvbewrTNYCWcqQek2qn Gj6mNtnpCHK0oDzbEbM55isg29ESFKezoBq4kWq6TEOqkfdR8KDGiIg0A6OXAOMJPxUP sIjPbrbuJarl2iNcsxbeQ69peHFo6XhhfPD1O+U+Zk5LTWkS2N3ZAseC4RltY5SKagza 85TVzZkXRWXaG+Y+oo5IAlChCD2KNrFnSvpnwTvgbV+hI9nKvqHOD9BM/18fbHzFI7Vb 2PAw== X-Gm-Message-State: AOAM530AxfVGFK4LYAetrWfMu3GNPt0MfaUTLFZPGSz6hsfWcS4X3go7 Oe8akFW3wRz0jNpL5iuitzf5uQuaBc0= X-Received: by 2002:a05:6870:a9a9:b0:e9:c463:51a6 with SMTP id ep41-20020a056870a9a900b000e9c46351a6mr7002285oab.101.1653519146792; Wed, 25 May 2022 15:52:26 -0700 (PDT) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id la7-20020a056871410700b000ee2bb503d0sm6420oab.50.2022.05.25.15.52.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 May 2022 15:52:26 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 25 May 2022 19:52:00 -0300 Message-Id: <20220525225200.65113-1-jamrial@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/remove_extradata_bsf: add a list of supported codec ids 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: egKKwnJLKcOL There's no point allowing the use of this filter for codecs where it will silently do nothing. Signed-off-by: James Almer --- libavcodec/remove_extradata_bsf.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libavcodec/remove_extradata_bsf.c b/libavcodec/remove_extradata_bsf.c index 66b7d00bd8..584213e40f 100644 --- a/libavcodec/remove_extradata_bsf.c +++ b/libavcodec/remove_extradata_bsf.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/avassert.h" #include "libavutil/log.h" #include "libavutil/opt.h" @@ -217,7 +218,7 @@ static int remove_extradata(AVBSFContext *ctx, AVPacket *pkt) i = vc1_split(pkt->data, pkt->size); break; default: - i = 0; + av_assert0(0); } pkt->data += i; @@ -238,6 +239,20 @@ static const AVOption options[] = { { NULL }, }; +static const enum AVCodecID codec_ids[] = { + AV_CODEC_ID_AV1, + AV_CODEC_ID_AVS2, + AV_CODEC_ID_AVS3, + AV_CODEC_ID_CAVS, + AV_CODEC_ID_H264, + AV_CODEC_ID_HEVC, + AV_CODEC_ID_MPEG1VIDEO, + AV_CODEC_ID_MPEG2VIDEO, + AV_CODEC_ID_MPEG4, + AV_CODEC_ID_VC1, + AV_CODEC_ID_NONE, +}; + static const AVClass remove_extradata_class = { .class_name = "remove_extradata", .item_name = av_default_item_name, @@ -247,6 +262,7 @@ static const AVClass remove_extradata_class = { const FFBitStreamFilter ff_remove_extradata_bsf = { .p.name = "remove_extra", + .p.codec_ids = codec_ids, .p.priv_class = &remove_extradata_class, .priv_data_size = sizeof(RemoveExtradataContext), .filter = remove_extradata,