From patchwork Wed Feb 24 11:53:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25951 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8303B44B3F6 for ; Wed, 24 Feb 2021 13:53:57 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 190EB68A0FC; Wed, 24 Feb 2021 13:53:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ABE8A6807F6 for ; Wed, 24 Feb 2021 13:53:50 +0200 (EET) Received: by mail-wm1-f47.google.com with SMTP id w7so1542603wmb.5 for ; Wed, 24 Feb 2021 03:53:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KgRPvPIN2TzdCKX9Zko9STHdxP2A1jEsTHyjOFACqBY=; b=HQO92pI8MFxtzBUsX1fhiy00nMwDuombYYJOKJHQZ/RE3ewJ11M2pN/u6q7wSpFdwT mt8+yilU9ZUen8COjmA2me+ll0s+U/qr5mkSYqNOV+YnxCX3uwoQC+4wojioG+YA81qg HrtJfcmySkN5Zx/Somno1Ny1jurs/pf5LCMePKT+yJ3W2X0oIwMix+Eqqh0k22ru8pMV NnTN+Pz1u3YbE1dp+ItAPw1+l6/HKMwxJzZ5fXGJwkdx1vh06+cq6li3T0uo7OBdhXFZ AyTpIE2zYUH7SMyJffGFlqF37R/mGvMyXZIW8rkco3QsA0ZYZMiBpybxpSDpNPt7RfsW MukA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KgRPvPIN2TzdCKX9Zko9STHdxP2A1jEsTHyjOFACqBY=; b=jLpzn5eXO8okJOSGPDhzacHG0+RkYnWqx/8JGqqzn35+HcXoCSvz99OrebC1pg1OcW u9p0QXnT3llo0ZuZ8qXt9tPqaU3noGkhc8CBmQBzKchTLW+K+s2hlHZ83FxmsLFaAywl VhK08NewHn8vAsf277P1OC8XC0wUZEKzSAr6exQ4o75i/9WNHK64OP/HdfbvCHA7DMgN nh+2s/cmSYC7zhMgrkm5Gh5jfWZ56o6vLo+LM6KoeNKlA3L0TJLoV7ZaVl99wCgh+w6O AkNbTtVhYnh/9ofaruQNdmlaLjt5sGf+1yX7N72ECW9HEGckSnpMoMd6jWLYbVyF/9EB 5dWQ== X-Gm-Message-State: AOAM530zAMPPTmdAjdajjydLJHXVl1twYd/JQ2ZOqwgcOJliirEFNYY1 hlN2QUi8rs5gJ45hjgnAfWTFaAyXLsw= X-Google-Smtp-Source: ABdhPJyG9ZIozQg0PjvH1hUduTvq00w6bDeZC73K3le4AMuBNJkfEEt2I3TkluY/zmXcn/0GmpGVsQ== X-Received: by 2002:a1c:cc04:: with SMTP id h4mr3396010wmb.142.1614167629849; Wed, 24 Feb 2021 03:53:49 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.53.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:53:49 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:27 +0100 Message-Id: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/15] avformat/movenc: Remove always true check X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavformat/movenc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 545b0885ae..cdfcbd3d76 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6395,7 +6395,6 @@ static int mov_init(AVFormatContext *s) /* Default mode == MP4 */ mov->mode = MODE_MP4; - if (s->oformat) { if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; @@ -6403,7 +6402,6 @@ static int mov_init(AVFormatContext *s) else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD; else if (!strcmp("ismv",s->oformat->name)) mov->mode = MODE_ISM; else if (!strcmp("f4v", s->oformat->name)) mov->mode = MODE_F4V; - } if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV; From patchwork Wed Feb 24 11:53:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25953 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A1F1F44B5C7 for ; Wed, 24 Feb 2021 13:54:22 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8E39668A326; Wed, 24 Feb 2021 13:54:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A5EA5689FD9 for ; Wed, 24 Feb 2021 13:54:20 +0200 (EET) Received: by mail-wr1-f52.google.com with SMTP id v15so1618236wrx.4 for ; Wed, 24 Feb 2021 03:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0OgaKIOwBR4BrluEl/wcPTGEaWbSsF9NlktOvmhry3Y=; b=aJCWhFM8xMsO7PRGC4QUECVxAQJnsOcCN062VnrEkpRn8VFYGkU+l0VDgdG+9l8TR5 CdTQHlsXP3CWsOWxCHTntO28ZyLZaPkkGaVYHqhcVDDK0ShIw3WJngC7ZVcKnIiav9rC CZtwfLJBfdVyZdArsYvAKEHBz7Bpx1/ogeUyRWOxma/ozKs3Y+B+Tz7gziIY4Z0Z+OeT o5nc1ijWKEigaOjoK/A0cwfAUZzKl1k3+xW4FRAMKz11Tlywd9rLAAWFYFZ2sXS5ag1q tiB6C82s3rHiF6mDT9y/sVG6j6Y1ttsqMGQx+Z1RiYojk1dUx9sPIZ73yDGjVuVmz98m EhSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0OgaKIOwBR4BrluEl/wcPTGEaWbSsF9NlktOvmhry3Y=; b=ZlJ2Ge2KikakLLK5Z1CA64AvwrJTADD1fBrL5nyvxQ4r9ujuMOtWbJUVL7R0a9vZuH y9qGVdTQIftwuxL4j8F9u3Q0FveHdAMVX/dQ52PshoH14kOUzS61e06p2rOAV2J+kimR tdBJq/5dPbtS8rg4+BFu0bPh8cAZxN+FUgNYpBAhghSRCQr/Xf6hdqZrx0nVb/QNQp/+ 5XFEdza2Bsrao3TrtxTB9rUsGV4rkGm6sVHCuvP6OYM5kx+1KRPW49HuZhbFpz1wvKWt WEQtuSmmC4LJQQiYoTj584VA+2ycd4Oepnld6f8+vqFi6gwWDHZp97g0Bf6dAgpJX2tp neag== X-Gm-Message-State: AOAM5328IyRDxc+MbIQkCzhu3s6zbQJP1zO6SoPVNld114ZYX2W5dtL8 BoZFdlJsmYN+iOlqs+cgr3S0j0J/b+s= X-Google-Smtp-Source: ABdhPJwtFhA7aSD5EzqprhLBB8TMDL3RBIEPvYIhW+rlEk00vQJZnYbJMEpIf0yUVEZnlkW3cewxPQ== X-Received: by 2002:a5d:474a:: with SMTP id o10mr12294167wrs.176.1614167659830; Wed, 24 Feb 2021 03:54:19 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:19 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:28 +0100 Message-Id: <20210224115341.794293-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/15] avformat/movenc: Don't check for disabled muxers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- Given that the name of every possible muxer here has a strlen of three or four one could even replace the strcmp by AV_RN32(s->oformat->name) == AV_RN32(#muxer). libavformat/movenc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index cdfcbd3d76..cf0e35dd33 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6395,13 +6395,15 @@ static int mov_init(AVFormatContext *s) /* Default mode == MP4 */ mov->mode = MODE_MP4; - if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; - else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; - else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; - else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; - else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD; - else if (!strcmp("ismv",s->oformat->name)) mov->mode = MODE_ISM; - else if (!strcmp("f4v", s->oformat->name)) mov->mode = MODE_F4V; +#define IS_MODE(muxer, config) (CONFIG_ ## config ## _MUXER && !strcmp(#muxer, s->oformat->name)) + if (IS_MODE(3gp, TGP)) mov->mode = MODE_3GP; + else if (IS_MODE(3g2, TG2)) mov->mode = MODE_3GP|MODE_3G2; + else if (IS_MODE(mov, MOV)) mov->mode = MODE_MOV; + else if (IS_MODE(psp, PSP)) mov->mode = MODE_PSP; + else if (IS_MODE(ipod, IPOD)) mov->mode = MODE_IPOD; + else if (IS_MODE(ismv, ISMV)) mov->mode = MODE_ISM; + else if (IS_MODE(f4v, F4V)) mov->mode = MODE_F4V; +#undef IS_MODE if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV; From patchwork Wed Feb 24 11:53:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25954 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 5D46E44B5C7 for ; Wed, 24 Feb 2021 13:54:24 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4285E68A32E; Wed, 24 Feb 2021 13:54:24 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 507E86806EB for ; Wed, 24 Feb 2021 13:54:21 +0200 (EET) Received: by mail-wr1-f53.google.com with SMTP id n4so1631521wrx.1 for ; Wed, 24 Feb 2021 03:54:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4DsW72wOCPY7IZxVhW58ti1y9CaidAW5k1z36dMxBmU=; b=Aqm8SJRj47OJVE2VLjB91bUnh2ZFDkLdAG24CsRvG0bI5eIXwDro7fa3d7mM6hUnWP XrFKuT5tfKZ2S7O6tbHoiD0IAWiory7mt9Yb3w5XdgkZ7w5/U3kHPC6WtdgU0/2o92nT ou3Mjf+pKAyY91I/yHNwf/GRC/aRNdRNRk9WzzdrHy7N9XK+5XEcBJzGgPEQHtGAKiRI wC73D79Zgh9dHkbbExClidjJ+TDTJ545X7aDmFwxczATZIwMQPP68ZFF860x/MjCMrQK 4xGWDh8236yeSQ1jh77Dgq3o/ykb0Ql1Jk+cOEU57AqvZzhxfzB/m3PIWeIU+FSgPKZU Vr/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4DsW72wOCPY7IZxVhW58ti1y9CaidAW5k1z36dMxBmU=; b=ANzwahkToZ77fmfuYl4OswGk/tmoVxBQUM3qpnp53kF/KPWRXExRBi+bpBDOnfoQIK hlDwmMvsJEt0dlZEVmOWwdqzGMeLta87c5frA4TYVRKLozQuqv/uh73BZ7lua4bGXqgj OIgsELbdBG2O2QZeqP5BrVYBu3DABqqfbJPmQ3WHiafNvpPWEJGH22tYC1KnXoMtGxQ1 HthONo9gvU2sKZpRVlkH4hAI6s3FPZdPTbPDaQaXCKFosEhDrHV6iYhi6s6sB/7wPgpo fXtYpuEsgAQFQKPpwJu4C55wWSCscVV1npqmpRWJM/EIWaVqWUxAWTsA4V0KN/pn6LMF /ZAA== X-Gm-Message-State: AOAM533iqNm2YE3PhkM3M63NyAnmLPZjeGnkzbwb+8SIHUyG7CzvztPx XjlnjFNHBXo71uwNjSQS1tMCOEFMlGA= X-Google-Smtp-Source: ABdhPJy1F+FtkT7K3u9DTmDst1PQpbTMDD766LyYR7de+36PrnmKjIh6ONKNaWcQAUOfMN0ISX78tQ== X-Received: by 2002:adf:b313:: with SMTP id j19mr7862795wrd.188.1614167660501; Wed, 24 Feb 2021 03:54:20 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:20 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:29 +0100 Message-Id: <20210224115341.794293-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/15] fftools/ffmpeg, ffplay: Don't set refcounted_frames X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It only affects the old and deprecated avcodec_decode_(video2|audio4) API which is no longer used here. Signed-off-by: Andreas Rheinhardt --- I am surprised that no one found this before me. Is it because there was no -Wdeprecated-declarations warning? fftools/ffmpeg.c | 1 - fftools/ffplay.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index add5a3e505..abf35150bd 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2957,7 +2957,6 @@ static int init_input_stream(int ist_index, char *error, int error_len) ist->dec_ctx->thread_safe_callbacks = 1; #endif - av_opt_set_int(ist->dec_ctx, "refcounted_frames", 1, 0); if (ist->dec_ctx->codec_id == AV_CODEC_ID_DVB_SUBTITLE && (ist->decoding_needed & DECODING_FOR_OST)) { av_dict_set(&ist->decoder_opts, "compute_edt", "1", AV_DICT_DONT_OVERWRITE); diff --git a/fftools/ffplay.c b/fftools/ffplay.c index b9a30cdb11..ac0885b84e 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -2628,8 +2628,6 @@ static int stream_component_open(VideoState *is, int stream_index) av_dict_set(&opts, "threads", "auto", 0); if (stream_lowres) av_dict_set_int(&opts, "lowres", stream_lowres, 0); - if (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO) - av_dict_set(&opts, "refcounted_frames", "1", 0); if ((ret = avcodec_open2(avctx, codec, &opts)) < 0) { goto fail; } From patchwork Wed Feb 24 11:53:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25955 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 879D944B5C7 for ; Wed, 24 Feb 2021 13:54:27 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7096968A82B; Wed, 24 Feb 2021 13:54:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0772768A2BB for ; Wed, 24 Feb 2021 13:54:21 +0200 (EET) Received: by mail-wr1-f41.google.com with SMTP id w11so1596105wrr.10 for ; Wed, 24 Feb 2021 03:54:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jgEmW8bn9wUXdiOLXRxiCJVbisCwTRA8Cz5c2TxPDBU=; b=QuYTXJmUGWiUGc9f2pP7YNP6DZNH2FnwfAMmg4QTFmFBYTGO6qz20vsvdZBJFjf3Tm dt5+wLrpX7EW+FyTW0KWYgvIPNKudPtn3wykHE2JlV07JhDTBRFCbzBmXU1hSJ3o+CgZ VxPRs6LBDoYsDbHRWGjertnjEi2WWozsx2SS7RH1SHIta143EciElJeuNPM+GsvUXSAH SO/8yFc3Ks8Dk7Dba9cw/SRc5cv9fcxOu9iIn4ShIUtgwtFGHX5oO0jaMqQ/q5rQpIaN tJZaSKaLJaEilCdREpxwBG1LphwamF4M2cOh+91D1Vnr8w/Xm6YUCJpZ+X9Xnp+eEqOY W+7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jgEmW8bn9wUXdiOLXRxiCJVbisCwTRA8Cz5c2TxPDBU=; b=gnK9+Cyc1g+AnYWOvrh/L8xZqDeFHkmJ1LIn5ep0FSU/xx50h89L4B89ceC1MRtGyq iOvSMAGWyq5W27czLNDgI/wyyfjuOIuF4fWMAudHilf6kEYktxM9oXxBBAlV3MrCTnkv zQDiIXV/MPSXCJKy+hrZVm5ilXmbZANRxX85q0xR3yTwT9k+FBmfG6fHLzQiZLxEbqSO AKYp+B3od2P4gXzOQQA3AU/fZ/hAFe9rZ9s5ZOtsGTBPyufrZSIxnt6yrqxFvUBNjyzH ph5Jp5pWxTI49C805j2sOJL+QkYrCl+0VhsQ2Uz9nm8CZ9sjnyO66PfLRsWBSr5+Zoyu Z81w== X-Gm-Message-State: AOAM533O4l0JEn/xjYiDgIMY3ILCkj8ZadvBItg/hChojt0ED4RHj5pt 6nB24vIZmhtO6DcdKrW554E/yBA0BMA= X-Google-Smtp-Source: ABdhPJy1YveviTe+Mf8wlHyTZswxsLKssiN2CfwYiWLPTeYfonRx25gFFZm7tUlTgYrkXCSI+KirBg== X-Received: by 2002:a5d:6585:: with SMTP id q5mr19174414wru.270.1614167661191; Wed, 24 Feb 2021 03:54:21 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:20 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:30 +0100 Message-Id: <20210224115341.794293-4-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 04/15] avformat/movenc: Only check for timecodes if they are used X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavformat/movenc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index cf0e35dd33..8ac5c317b4 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6387,7 +6387,6 @@ static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track, static int mov_init(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; - AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 0); int i, ret; mov->fc = s; @@ -6505,6 +6504,9 @@ static int mov_init(AVFormatContext *s) if ( mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4) || mov->write_tmcd == 1) { + AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode", + NULL, 0); + /* +1 tmcd track for each video stream with a timecode */ for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; @@ -6725,7 +6727,6 @@ static int mov_write_header(AVFormatContext *s) { AVIOContext *pb = s->pb; MOVMuxContext *mov = s->priv_data; - AVDictionaryEntry *t, *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 0); int i, ret, hint_track = 0, tmcd_track = 0, nb_tracks = s->nb_streams; if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) @@ -6824,6 +6825,8 @@ static int mov_write_header(AVFormatContext *s) } if (mov->nb_meta_tmcd) { + const AVDictionaryEntry *t, *global_tcr = av_dict_get(s->metadata, + "timecode", NULL, 0); /* Initialize the tmcd tracks */ for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; From patchwork Wed Feb 24 11:53:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25956 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D24E344B5C7 for ; Wed, 24 Feb 2021 13:54:28 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B5CAA68A0F0; Wed, 24 Feb 2021 13:54:28 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CBC0968A3B7 for ; Wed, 24 Feb 2021 13:54:22 +0200 (EET) Received: by mail-wr1-f43.google.com with SMTP id v15so1618353wrx.4 for ; Wed, 24 Feb 2021 03:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IEN4T1ew7fvfz4FBlyywD1TtnXmZVskuRpkDQeEQnMg=; b=dwfOD6AdlJcruW/DQmf0hlezqHp2s1zHdnWxv4uYEke9mqYwkG6CV0UOtBjYcBYcVn KGlXxCIG2CPTmAkkC+ImhF4XqDfK8+99BDd+uEbMuSwwQy5lgTKi5GYj9WZQPtDAzxNC JAaSY2nm29LQM0VGNP14+54vg57PV876SOYfzmwc+PNX4EwrNKQIFtNJH+tLu5xd9HyN nPzY8dQDoXE2YxiKrIIGGm8zEkaWsC39HgCoH9sPyGDyEF+iC+SeRc4ie3Hlahl91cQU cJrFE77swSWASzhiZAVTgoLjye1H/JP0VQhnSfbZbjVj0+ltDd89sQ3KcHLz9THDINPB a5Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IEN4T1ew7fvfz4FBlyywD1TtnXmZVskuRpkDQeEQnMg=; b=ORlDGySdNYMmpWLLHyWF/feyGbxRdaFFw0ikW89HMHEnv67PM7p9naajKxfk+rnbYK 4RJ75vchieQiNtMlrx3T4QJ8KakQWE/G65T8k7U1KJImIBUJuU1Zg4mVy5q3aehmyYs4 r/ND2Cjcf738sxrMyzoj+0wuPQjkEpoOxgb8hTPQCH1rw1/2NuLAXkuXLOWK04s/b2D0 XOvKZtV6Y/DQpo2Docf2FE1ZNe5/JdVlg1vgrpm/Y0W2gB8yDZsTwnjz9PVxGousfA+Q ETxYcKPhIYyFD4wQH6AQCilMzZh97hGgT+1PiDYKwXekyFJSVsVLCcbhdR6k3Ie8LVvN uJzA== X-Gm-Message-State: AOAM530MUtyCXX4BvC6pZltVa4ADKv5xrgbLtyXVAFgBnqp72szL5kae lLMuNWfvsp9zPkWQqx2VREmhFt9BryI= X-Google-Smtp-Source: ABdhPJypc/Hc8ZGEc9o85xN7dSVgTE4aguJ8yK9fPgbuLVP002hFsyKBpi1j/YGBZREVKLMa6fmzkg== X-Received: by 2002:a5d:4ec6:: with SMTP id s6mr14420807wrv.416.1614167661893; Wed, 24 Feb 2021 03:54:21 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:21 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:31 +0100 Message-Id: <20210224115341.794293-5-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/15] avformat/pcm(dec|enc): Don't include disabled (de)muxers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Also make the macro used for the demuxers spec-compliant. The earlier macro was not, because the ... argument of a variadic macro must not be left out. GCC and Clang warn about this when using -pedantic. Signed-off-by: Andreas Rheinhardt --- libavformat/pcmdec.c | 102 ++++++++++++++++--------------------------- libavformat/pcmenc.c | 95 +++++++++++++--------------------------- 2 files changed, 68 insertions(+), 129 deletions(-) diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c index 9895af03a4..e65b535665 100644 --- a/libavformat/pcmdec.c +++ b/libavformat/pcmdec.c @@ -104,7 +104,8 @@ static const AVOption pcm_options[] = { { NULL }, }; -#define PCMDEF(name_, long_name_, ext, codec, ...) \ +#define PCMDEF_0(name_, long_name_, ext, codec, ...) +#define PCMDEF_1(name_, long_name_, ext, codec, ...) \ static const AVClass name_ ## _demuxer_class = { \ .class_name = #name_ " demuxer", \ .item_name = av_default_item_name, \ @@ -124,70 +125,40 @@ AVInputFormat ff_pcm_ ## name_ ## _demuxer = { \ .priv_class = &name_ ## _demuxer_class, \ __VA_ARGS__ \ }; - -PCMDEF(f64be, "PCM 64-bit floating-point big-endian", - NULL, AV_CODEC_ID_PCM_F64BE) - -PCMDEF(f64le, "PCM 64-bit floating-point little-endian", - NULL, AV_CODEC_ID_PCM_F64LE) - -PCMDEF(f32be, "PCM 32-bit floating-point big-endian", - NULL, AV_CODEC_ID_PCM_F32BE) - -PCMDEF(f32le, "PCM 32-bit floating-point little-endian", - NULL, AV_CODEC_ID_PCM_F32LE) - -PCMDEF(s32be, "PCM signed 32-bit big-endian", - NULL, AV_CODEC_ID_PCM_S32BE) - -PCMDEF(s32le, "PCM signed 32-bit little-endian", - NULL, AV_CODEC_ID_PCM_S32LE) - -PCMDEF(s24be, "PCM signed 24-bit big-endian", - NULL, AV_CODEC_ID_PCM_S24BE) - -PCMDEF(s24le, "PCM signed 24-bit little-endian", - NULL, AV_CODEC_ID_PCM_S24LE) - -PCMDEF(s16be, "PCM signed 16-bit big-endian", - AV_NE("sw", NULL), AV_CODEC_ID_PCM_S16BE, .mime_type = "audio/L16") - -PCMDEF(s16le, "PCM signed 16-bit little-endian", - AV_NE(NULL, "sw"), AV_CODEC_ID_PCM_S16LE) - -PCMDEF(s8, "PCM signed 8-bit", - "sb", AV_CODEC_ID_PCM_S8) - -PCMDEF(u32be, "PCM unsigned 32-bit big-endian", - NULL, AV_CODEC_ID_PCM_U32BE) - -PCMDEF(u32le, "PCM unsigned 32-bit little-endian", - NULL, AV_CODEC_ID_PCM_U32LE) - -PCMDEF(u24be, "PCM unsigned 24-bit big-endian", - NULL, AV_CODEC_ID_PCM_U24BE) - -PCMDEF(u24le, "PCM unsigned 24-bit little-endian", - NULL, AV_CODEC_ID_PCM_U24LE) - -PCMDEF(u16be, "PCM unsigned 16-bit big-endian", - AV_NE("uw", NULL), AV_CODEC_ID_PCM_U16BE) - -PCMDEF(u16le, "PCM unsigned 16-bit little-endian", - AV_NE(NULL, "uw"), AV_CODEC_ID_PCM_U16LE) - -PCMDEF(u8, "PCM unsigned 8-bit", - "ub", AV_CODEC_ID_PCM_U8) - -PCMDEF(alaw, "PCM A-law", - "al", AV_CODEC_ID_PCM_ALAW) - -PCMDEF(mulaw, "PCM mu-law", - "ul", AV_CODEC_ID_PCM_MULAW) - -PCMDEF(vidc, "PCM Archimedes VIDC", - NULL, AV_CODEC_ID_PCM_VIDC) - +#define PCMDEF_2(name, long_name, ext, codec, enabled, ...) \ + PCMDEF_ ## enabled(name, long_name, ext, codec, __VA_ARGS__) +#define PCMDEF_3(name, long_name, ext, codec, config, ...) \ + PCMDEF_2(name, long_name, ext, codec, config, __VA_ARGS__) +#define PCMDEF_EXT(name, long_name, ext, uppercase, ...) \ + PCMDEF_3(name, long_name, ext, AV_CODEC_ID_PCM_ ## uppercase, \ + CONFIG_PCM_ ## uppercase ## _DEMUXER, __VA_ARGS__) +#define PCMDEF(name, long_name, ext, uppercase) \ + PCMDEF_EXT(name, long_name, ext, uppercase, ) + +PCMDEF(f64be, "PCM 64-bit floating-point big-endian", NULL, F64BE) +PCMDEF(f64le, "PCM 64-bit floating-point little-endian", NULL, F64LE) +PCMDEF(f32be, "PCM 32-bit floating-point big-endian", NULL, F32BE) +PCMDEF(f32le, "PCM 32-bit floating-point little-endian", NULL, F32LE) +PCMDEF(s32be, "PCM signed 32-bit big-endian", NULL, S32BE) +PCMDEF(s32le, "PCM signed 32-bit little-endian", NULL, S32LE) +PCMDEF(s24be, "PCM signed 24-bit big-endian", NULL, S24BE) +PCMDEF(s24le, "PCM signed 24-bit little-endian", NULL, S24LE) +PCMDEF_EXT(s16be, "PCM signed 16-bit big-endian", + AV_NE("sw", NULL), S16BE, .mime_type = "audio/L16") +PCMDEF(s16le, "PCM signed 16-bit little-endian", AV_NE(NULL, "sw"), S16LE) +PCMDEF(s8, "PCM signed 8-bit", "sb", S8) +PCMDEF(u32be, "PCM unsigned 32-bit big-endian", NULL, U32BE) +PCMDEF(u32le, "PCM unsigned 32-bit little-endian", NULL, U32LE) +PCMDEF(u24be, "PCM unsigned 24-bit big-endian", NULL, U24BE) +PCMDEF(u24le, "PCM unsigned 24-bit little-endian", NULL, U24LE) +PCMDEF(u16be, "PCM unsigned 16-bit big-endian", AV_NE("uw", NULL), U16BE) +PCMDEF(u16le, "PCM unsigned 16-bit little-endian", AV_NE(NULL, "uw"), U16LE) +PCMDEF(u8, "PCM unsigned 8-bit", "ub", U8) +PCMDEF(alaw, "PCM A-law", "al", ALAW) +PCMDEF(mulaw, "PCM mu-law", "ul", MULAW) +PCMDEF(vidc, "PCM Archimedes VIDC", NULL, VIDC) + +#if CONFIG_SLN_DEMUXER static const AVOption sln_options[] = { { "sample_rate", "", offsetof(PCMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 8000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { "channels", "", offsetof(PCMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, @@ -213,3 +184,4 @@ AVInputFormat ff_sln_demuxer = { .raw_codec_id = AV_CODEC_ID_PCM_S16LE, .priv_class = &sln_demuxer_class, }; +#endif diff --git a/libavformat/pcmenc.c b/libavformat/pcmenc.c index 1760b3bef7..050b9c4aa0 100644 --- a/libavformat/pcmenc.c +++ b/libavformat/pcmenc.c @@ -22,7 +22,8 @@ #include "avformat.h" #include "rawenc.h" -#define PCMDEF(name_, long_name_, ext, codec) \ +#define PCMDEF_0(name_, long_name_, ext, codec) +#define PCMDEF_1(name_, long_name_, ext, codec) \ AVOutputFormat ff_pcm_ ## name_ ## _muxer = { \ .name = #name_, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ @@ -32,66 +33,32 @@ AVOutputFormat ff_pcm_ ## name_ ## _muxer = { \ .write_packet = ff_raw_write_packet, \ .flags = AVFMT_NOTIMESTAMPS, \ }; - -PCMDEF(f64be, "PCM 64-bit floating-point big-endian", - NULL, AV_CODEC_ID_PCM_F64BE) - -PCMDEF(f64le, "PCM 64-bit floating-point little-endian", - NULL, AV_CODEC_ID_PCM_F64LE) - -PCMDEF(f32be, "PCM 32-bit floating-point big-endian", - NULL, AV_CODEC_ID_PCM_F32BE) - -PCMDEF(f32le, "PCM 32-bit floating-point little-endian", - NULL, AV_CODEC_ID_PCM_F32LE) - -PCMDEF(s32be, "PCM signed 32-bit big-endian", - NULL, AV_CODEC_ID_PCM_S32BE) - -PCMDEF(s32le, "PCM signed 32-bit little-endian", - NULL, AV_CODEC_ID_PCM_S32LE) - -PCMDEF(s24be, "PCM signed 24-bit big-endian", - NULL, AV_CODEC_ID_PCM_S24BE) - -PCMDEF(s24le, "PCM signed 24-bit little-endian", - NULL, AV_CODEC_ID_PCM_S24LE) - -PCMDEF(s16be, "PCM signed 16-bit big-endian", - AV_NE("sw", NULL), AV_CODEC_ID_PCM_S16BE) - -PCMDEF(s16le, "PCM signed 16-bit little-endian", - AV_NE(NULL, "sw"), AV_CODEC_ID_PCM_S16LE) - -PCMDEF(s8, "PCM signed 8-bit", - "sb", AV_CODEC_ID_PCM_S8) - -PCMDEF(u32be, "PCM unsigned 32-bit big-endian", - NULL, AV_CODEC_ID_PCM_U32BE) - -PCMDEF(u32le, "PCM unsigned 32-bit little-endian", - NULL, AV_CODEC_ID_PCM_U32LE) - -PCMDEF(u24be, "PCM unsigned 24-bit big-endian", - NULL, AV_CODEC_ID_PCM_U24BE) - -PCMDEF(u24le, "PCM unsigned 24-bit little-endian", - NULL, AV_CODEC_ID_PCM_U24LE) - -PCMDEF(u16be, "PCM unsigned 16-bit big-endian", - AV_NE("uw", NULL), AV_CODEC_ID_PCM_U16BE) - -PCMDEF(u16le, "PCM unsigned 16-bit little-endian", - AV_NE(NULL, "uw"), AV_CODEC_ID_PCM_U16LE) - -PCMDEF(u8, "PCM unsigned 8-bit", - "ub", AV_CODEC_ID_PCM_U8) - -PCMDEF(alaw, "PCM A-law", - "al", AV_CODEC_ID_PCM_ALAW) - -PCMDEF(mulaw, "PCM mu-law", - "ul", AV_CODEC_ID_PCM_MULAW) - -PCMDEF(vidc, "PCM Archimedes VIDC", - NULL, AV_CODEC_ID_PCM_VIDC) +#define PCMDEF_2(name, long_name, ext, codec, enabled) \ + PCMDEF_ ## enabled(name, long_name, ext, codec) +#define PCMDEF_3(name, long_name, ext, codec, config) \ + PCMDEF_2(name, long_name, ext, codec, config) +#define PCMDEF(name, long_name, ext, uppercase) \ + PCMDEF_3(name, long_name, ext, AV_CODEC_ID_PCM_ ## uppercase, \ + CONFIG_PCM_ ## uppercase ## _MUXER) + +PCMDEF(f64be, "PCM 64-bit floating-point big-endian", NULL, F64BE) +PCMDEF(f64le, "PCM 64-bit floating-point little-endian", NULL, F64LE) +PCMDEF(f32be, "PCM 32-bit floating-point big-endian", NULL, F32BE) +PCMDEF(f32le, "PCM 32-bit floating-point little-endian", NULL, F32LE) +PCMDEF(s32be, "PCM signed 32-bit big-endian", NULL, S32BE) +PCMDEF(s32le, "PCM signed 32-bit little-endian", NULL, S32LE) +PCMDEF(s24be, "PCM signed 24-bit big-endian", NULL, S24BE) +PCMDEF(s24le, "PCM signed 24-bit little-endian", NULL, S24LE) +PCMDEF(s16be, "PCM signed 16-bit big-endian", AV_NE("sw", NULL), S16BE) +PCMDEF(s16le, "PCM signed 16-bit little-endian", AV_NE(NULL, "sw"), S16LE) +PCMDEF(s8, "PCM signed 8-bit", "sb", S8) +PCMDEF(u32be, "PCM unsigned 32-bit big-endian", NULL, U32BE) +PCMDEF(u32le, "PCM unsigned 32-bit little-endian", NULL, U32LE) +PCMDEF(u24be, "PCM unsigned 24-bit big-endian", NULL, U24BE) +PCMDEF(u24le, "PCM unsigned 24-bit little-endian", NULL, U24LE) +PCMDEF(u16be, "PCM unsigned 16-bit big-endian", AV_NE("uw", NULL), U16BE) +PCMDEF(u16le, "PCM unsigned 16-bit little-endian", AV_NE(NULL, "uw"), U16LE) +PCMDEF(u8, "PCM unsigned 8-bit", "ub", U8) +PCMDEF(alaw, "PCM A-law", "al", ALAW) +PCMDEF(mulaw, "PCM mu-law", "ul", MULAW) +PCMDEF(vidc, "PCM Archimedes VIDC", NULL, VIDC) From patchwork Wed Feb 24 11:53:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25957 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B39F744B5C7 for ; Wed, 24 Feb 2021 13:54:29 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9FA2268A957; Wed, 24 Feb 2021 13:54:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9298568A27A for ; Wed, 24 Feb 2021 13:54:23 +0200 (EET) Received: by mail-wr1-f50.google.com with SMTP id d11so1606149wrj.7 for ; Wed, 24 Feb 2021 03:54:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8lKxVRQaoC1TasHVpxQCZAyQdBvPqIjhfPBcT5vl2og=; b=JkBvOeF4n9DTwYGN1qGslaDu+yDDTT+i/NF6Xdto0AEoXEzd4ZNPazDNQbQeiXzG4e DWE22m0qtyBP301LW3UtrE2mccoWm4UYkK379bOYIzbEIH7a6zQafBS4yqUQpFawBEaa 2JOTa6b3rpRXZXaRPe4wCT2MjUGMJgEQHgHBA0GCevrYP0ogWlBlF0Qg2D8/V02Tylu0 RK3fZqPWbDcB3K4HES30fi7Atzz4FeG9uRd8PHVivEguBmjXw8WddqocPIn+NAN7sxpD 9OygbMt3hW5eegD2IHSHivaIHM9VJlZeAJoKlPeAaxi/ZU8LS+oKMGeUnCiTXCDsvIH/ lSiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8lKxVRQaoC1TasHVpxQCZAyQdBvPqIjhfPBcT5vl2og=; b=B7JXPLgfbsY0IiIIXtDFFmbAwoGmh741f60Z1TP66SHvdnamszNFmYYdZBfc2ar0Kv 9px6ohy67REDEzHcBFTK4hrmIscKxtVRgNV+8+7DBoROBJHgiYakGqdOBhmFdnsxxd7+ 0rT2KOqPysZIP2zHn0YDh2BGyg+EMPJCbt7EvLctIvIbymoD8lCvyft6FB5Ppb8YEamf sHkwYBYq1Chum2a+zJFElAKQdGSZni+mq+6KabfPRL7c4CeMjRX59ZurlfS38r7DMpRL quoWC9/BPddIP2eSneiTaAu820FF/DI7u0s/5q7kqD2Cl47DIzW+NuykpEubBswvHXPA 9k9w== X-Gm-Message-State: AOAM531YYJnXTBF8umhZjYKHBvAPG8St8IW3FLKYjzZUfHv44HWMGmeK a+ZApBFeeDBqGkvQfQMXMLAxfIQGeQc= X-Google-Smtp-Source: ABdhPJyzf7x8agyXj5gs85retQGt5zTkR/aflCv54rpQeJiOdpMfSLpRtfj/+ymE6RU1zq795giMaQ== X-Received: by 2002:adf:b611:: with SMTP id f17mr30485445wre.8.1614167662821; Wed, 24 Feb 2021 03:54:22 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:22 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:32 +0100 Message-Id: <20210224115341.794293-6-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/15] avformat/pcmdec: Fix NULL + 1 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It is undefined behaviour. Signed-off-by: Andreas Rheinhardt --- libavformat/pcmdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c index e65b535665..395d9ecf92 100644 --- a/libavformat/pcmdec.c +++ b/libavformat/pcmdec.c @@ -57,8 +57,9 @@ static int pcm_read_header(AVFormatContext *s) len = strlen(mime_type); while (options < mime_type + len) { options = strstr(options, ";"); - if (!options++) + if (!options) break; + options++; if (!rate) sscanf(options, " rate=%d", &rate); if (!channels) From patchwork Wed Feb 24 11:53:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25958 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id CEBFF44B5C7 for ; Wed, 24 Feb 2021 13:54:30 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AC90A68A980; Wed, 24 Feb 2021 13:54:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 51A2068A5A8 for ; Wed, 24 Feb 2021 13:54:24 +0200 (EET) Received: by mail-wr1-f48.google.com with SMTP id l12so1623233wry.2 for ; Wed, 24 Feb 2021 03:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gmRxbF5D9YWO1s3YhrZLrYoYDYUXUcuJbeYxvGDk36U=; b=QH2ORr20IwJ4npIsytGHH8sCxRbAsaRopVUREhp5I/QyKYB3iXPSS8Eq69WYyTXVgI G07Uk5R9PAbYd1MGiZ+9xwm34ZnRwpzjjbyYIIKIJM8q9P84Wy8vB0SEPZZdSps9HcjI vl09bDbA2d37Rrs1ctZvym6frDNYu0z8RkLvmio1x2uY83fXDvluORAh7YxRFta/nmpv o6TSJJr7Z4iAemCDDj3T4spjRjkhm0JhUybT4PtVyb98ZvL7hXrq9NTdASTDLEbPFrSo yOd9QEm/hnKuRxHb410Q1YYxZ3pmVqj+m5QcXQUHdobN27PJOYTRXoqbjUmadlDe0tda oqEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gmRxbF5D9YWO1s3YhrZLrYoYDYUXUcuJbeYxvGDk36U=; b=rGY2NeKLrpV62PwVMorfloSoddT/QGvJVJhaHpPXwB7zbBKK4us6cNIvLxlMf148Wz KRWKa4qoB0jJRRL5C5oD+BCYHptu/JdO+HG1h888BBjmVD3OuwlZnninGJ3Xa4cht5ty is3R3DhuCnKjsX4RvS72xTyWVnB8JmfDjgyp2/9tcFVt9EJ80KV7r+UgHvOi61aRbRfz PupD+WBp5xlHjenEs45qFXiWn8s4jY2N/CHU2EgmfCbRfbcl9xjIxSWYX3jdaGFWHl80 VMW67rcjOCgOlKKxuhYZbYZ0Ed6Th/fDbGb8q0hcFSDjamcqSQxGKIq9ZPZq0NCJpAUf g3+w== X-Gm-Message-State: AOAM530ZvAknHsZWaemX84PI0Pj81VsM23w9c6mPpXDznbC9HB23p1cE g7QNgW+jyunN7n1tjL3Gq2x75i4Kf4M= X-Google-Smtp-Source: ABdhPJzgGU+adBqxKt7AoU8I6OB+GKbnZw/8vn/WuSJSaFpS0iq7w+1c4Lr43I56JGTCymveC1/Hgw== X-Received: by 2002:a5d:5441:: with SMTP id w1mr31101412wrv.366.1614167663477; Wed, 24 Feb 2021 03:54:23 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:23 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:33 +0100 Message-Id: <20210224115341.794293-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/15] avformat/pcmdec: Simplify parsing MIME type X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavformat/pcmdec.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c index 395d9ecf92..cd3e7b2e8f 100644 --- a/libavformat/pcmdec.c +++ b/libavformat/pcmdec.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/avstring.h" #include "avformat.h" #include "internal.h" #include "pcm.h" @@ -51,14 +52,9 @@ static int pcm_read_header(AVFormatContext *s) av_opt_get(s->pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type); if (mime_type && s->iformat->mime_type) { int rate = 0, channels = 0, little_endian = 0; - size_t len = strlen(s->iformat->mime_type); - if (!av_strncasecmp(s->iformat->mime_type, mime_type, len)) { /* audio/L16 */ - uint8_t *options = mime_type + len; - len = strlen(mime_type); - while (options < mime_type + len) { - options = strstr(options, ";"); - if (!options) - break; + const char *options; + if (av_stristart(mime_type, s->iformat->mime_type, &options)) { /* audio/L16 */ + while (options = strchr(options, ';')) { options++; if (!rate) sscanf(options, " rate=%d", &rate); From patchwork Wed Feb 24 11:53:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25959 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id F0AB844B5C7 for ; Wed, 24 Feb 2021 13:54:31 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D1FBE68A9BB; Wed, 24 Feb 2021 13:54:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A50B68A78A for ; Wed, 24 Feb 2021 13:54:24 +0200 (EET) Received: by mail-wr1-f45.google.com with SMTP id u14so1624397wri.3 for ; Wed, 24 Feb 2021 03:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lSALQ0RYubNUfw/2z3kTto+uA/3i++0+/oD8fSTH7yA=; b=dkpb61OCq1GXXY+USuwWs8wuPPSO88gNuS7DGh7ETtFsy5cmT8eebZxTnvkPlf0zmt 3KW6ttykrOhuDvYamDXpIC8Jjgw/G2bX1ixap485YcdMsupUFM5P6gAEG4W9ZtoRy1H6 MoSTfPfg6bbTKOZr7Kq6FWdjvn+Z0Iu0Kn2BIQuwJadyhOK0CEEyQ6His2LTfu4XU4Km aQnhgA2BYudnJVxmBqCzPUOjXlC3K4yPr4UNVDRpINQ0S+WRuDN9cff2efCwaML3xexq Bcn1utc+1vg+hR7ejofbEJMR6QRSyh/4157vGnlqaA+HOcIRTYkRWeWXHjJ9jMJy4r9k mTmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lSALQ0RYubNUfw/2z3kTto+uA/3i++0+/oD8fSTH7yA=; b=DRLdhGmadBw//36w/9sLbtFIRsdneUdSL4TPaA8QKGr91jXtJT3hg+35R9k/qNPG1u 3Ar4OfgatXhEIjKOlRMO6nDVNmDEgOMtdtip72hR8YblYky4mmLudithONPmqft0XRX7 /w1EzEquxa1r93t3SO7mydEfDLhhsCGmceXaCh9UHZqA9x01YecL8wcQEIBmyvkYmctE tkIA6UzrEylKC5UvgCDsoM8l8uJGAh6bkbS/C+J64DMm4SQtNGLrzvr3pKrEyEeUfmNY hp59YXN8KqUCUp37/EybMTweC56CkxKqeSfBurY56ENApBBeRDOum356xRr+Y8a1ZSRF bd9g== X-Gm-Message-State: AOAM533CMHTNo6nMA5C2gHOBfvfAAgfYVKhfMUywcHO7py4H5glci8Gz wQpK6gGW/McDroefl+2r9RCQawmvPy4= X-Google-Smtp-Source: ABdhPJwjYEmuvSDi5T2ZgQxtmbxH0hRBUFfbNE7uEJhsjX6QeGnIxth3n9KtfS7FlzXcWhdg04Tnqw== X-Received: by 2002:adf:ce8a:: with SMTP id r10mr1586714wrn.17.1614167664201; Wed, 24 Feb 2021 03:54:24 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:23 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:34 +0100 Message-Id: <20210224115341.794293-8-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/15] avformat/pcmdec: Beautify pcm_read_header X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavformat/pcmdec.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c index cd3e7b2e8f..9b552936ac 100644 --- a/libavformat/pcmdec.c +++ b/libavformat/pcmdec.c @@ -36,18 +36,19 @@ typedef struct PCMAudioDemuxerContext { static int pcm_read_header(AVFormatContext *s) { PCMAudioDemuxerContext *s1 = s->priv_data; + AVCodecParameters *par; AVStream *st; uint8_t *mime_type = NULL; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); + par = st->codecpar; - - st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; - st->codecpar->codec_id = s->iformat->raw_codec_id; - st->codecpar->sample_rate = s1->sample_rate; - st->codecpar->channels = s1->channels; + par->codec_type = AVMEDIA_TYPE_AUDIO; + par->codec_id = s->iformat->raw_codec_id; + par->sample_rate = s1->sample_rate; + par->channels = s1->channels; av_opt_get(s->pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type); if (mime_type && s->iformat->mime_type) { @@ -61,7 +62,7 @@ static int pcm_read_header(AVFormatContext *s) if (!channels) sscanf(options, " channels=%d", &channels); if (!little_endian) { - char val[14]; /* sizeof("little-endian") == 14 */ + char val[sizeof("little-endian")]; if (sscanf(options, " endianness=%13s", val) == 1) { little_endian = strcmp(val, "little-endian") == 0; } @@ -74,24 +75,22 @@ static int pcm_read_header(AVFormatContext *s) av_freep(&mime_type); return AVERROR_INVALIDDATA; } - st->codecpar->sample_rate = rate; + par->sample_rate = rate; if (channels > 0) - st->codecpar->channels = channels; + par->channels = channels; if (little_endian) - st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; + par->codec_id = AV_CODEC_ID_PCM_S16LE; } } av_freep(&mime_type); - st->codecpar->bits_per_coded_sample = - av_get_bits_per_sample(st->codecpar->codec_id); + par->bits_per_coded_sample = av_get_bits_per_sample(par->codec_id); - av_assert0(st->codecpar->bits_per_coded_sample > 0); + av_assert0(par->bits_per_coded_sample > 0); - st->codecpar->block_align = - st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8; + par->block_align = par->bits_per_coded_sample * par->channels / 8; - avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); + avpriv_set_pts_info(st, 64, 1, par->sample_rate); return 0; } From patchwork Wed Feb 24 11:53:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25960 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 323D144B5C7 for ; Wed, 24 Feb 2021 13:54:33 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 13B3368A8F0; Wed, 24 Feb 2021 13:54:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 89A9D68A192 for ; Wed, 24 Feb 2021 13:54:25 +0200 (EET) Received: by mail-wr1-f45.google.com with SMTP id u14so1624440wri.3 for ; Wed, 24 Feb 2021 03:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=83WBI2r+wqAawMrkyIl4Xsc3T7bN8YleWIkpajbxN7k=; b=QFiPjp5g7V4TKPX25HNFAUGoQHpoFNLMqdHFi3qmBt7EGjCicXDSDWPoz6MqGlFFzG ga5CN91D61IveqtO2XK3YmyA+d02orjri9KlcAtKqV09wWWwbMaNBvYul/UzEwN3ZocK OFR8aRyw7lp3tRx+9luo7tRsz+w4jvfkwRhKssElwOyloGKn34nVTZkCLRDhIynyymVz /HYWWuglvaTkrsQ+1A1PJYzVgpLOtio4IMaJLAIIPaiUlS/3g0Oz13fADPtEDBq+Kofu oesOlpngYgVaX2H2uQgWYn45eIeLLygVpJykcL/SZfCJSUmSPLNN7Py/sliRPSPArVS3 LztA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=83WBI2r+wqAawMrkyIl4Xsc3T7bN8YleWIkpajbxN7k=; b=h1h/zssSFxxpWNG9fBy4dz0qF3URd8XhVhZJ8R3JJzn2Qr+g9CgO20DBNotOCKwsrR dPLn5cp4kfO2xz2ro4tfFyJZzRaHMhgI5Lj1HGE+47S9/xCScumkngHyGHK91zSwFrZC qITwCzR71orOIrrviPdp1Mbmfu8JRPNZlbQ/iUp3E3EEUgaB/2L6IEjcL6NjoNoEiAN+ yQ+8+ptM2sXdpaDjRb3tNn8r55glLnb2ptxI3MlnJcvt88AVLnxOSMNWgVfYMmiaFBQ8 sT0g6lsN1EqP5LPEuJBFyA+5l28mNZ3SjjkReqoufhmi/+EDTnG4raOarpri3pxItk8s Ma6w== X-Gm-Message-State: AOAM5322yXDHq41IlLpZS7AwoF+4eaIXUjvSdOQ+9i9LaeXvttkaUBOF SL6+vnKf0CcqsT9dAn9OMLnpIg/QwJY= X-Google-Smtp-Source: ABdhPJwO+4PYHPqotJG8TfWb2iVj9iA9rq17ZY8laHSprAeqVO3idFfw89GmyD0s2TWaKYVwVVcjUA== X-Received: by 2002:a5d:620d:: with SMTP id y13mr31082185wru.88.1614167664920; Wed, 24 Feb 2021 03:54:24 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:24 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:35 +0100 Message-Id: <20210224115341.794293-9-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/15] avutil/pixdesc: Use av_strstart where appropriate X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It makes the intent clearer and allows to avoid calculating the strlen separately. Signed-off-by: Andreas Rheinhardt --- libavutil/pixdesc.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 8274713226..2a919461a5 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2702,11 +2702,13 @@ static int get_color_type(const AVPixFmtDescriptor *desc) { if(desc->nb_components == 1 || desc->nb_components == 2) return FF_COLOR_GRAY; - if(desc->name && !strncmp(desc->name, "yuvj", 4)) - return FF_COLOR_YUV_JPEG; + if (desc->name) { + if (av_strstart(desc->name, "yuvj", NULL)) + return FF_COLOR_YUV_JPEG; - if(desc->name && !strncmp(desc->name, "xyz", 3)) - return FF_COLOR_XYZ; + if (av_strstart(desc->name, "xyz", NULL)) + return FF_COLOR_XYZ; + } if(desc->flags & AV_PIX_FMT_FLAG_RGB) return FF_COLOR_RGB; @@ -2907,8 +2909,7 @@ int av_color_range_from_name(const char *name) int i; for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) { - size_t len = strlen(color_range_names[i]); - if (!strncmp(color_range_names[i], name, len)) + if (av_strstart(name, color_range_names[i], NULL)) return i; } @@ -2926,13 +2927,10 @@ int av_color_primaries_from_name(const char *name) int i; for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) { - size_t len; - if (!color_primaries_names[i]) continue; - len = strlen(color_primaries_names[i]); - if (!strncmp(color_primaries_names[i], name, len)) + if (av_strstart(name, color_primaries_names[i], NULL)) return i; } @@ -2950,13 +2948,10 @@ int av_color_transfer_from_name(const char *name) int i; for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) { - size_t len; - if (!color_transfer_names[i]) continue; - len = strlen(color_transfer_names[i]); - if (!strncmp(color_transfer_names[i], name, len)) + if (av_strstart(name, color_transfer_names[i], NULL)) return i; } @@ -2974,13 +2969,10 @@ int av_color_space_from_name(const char *name) int i; for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) { - size_t len; - if (!color_space_names[i]) continue; - len = strlen(color_space_names[i]); - if (!strncmp(color_space_names[i], name, len)) + if (av_strstart(name, color_space_names[i], NULL)) return i; } @@ -2998,13 +2990,10 @@ int av_chroma_location_from_name(const char *name) int i; for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) { - size_t len; - if (!chroma_location_names[i]) continue; - len = strlen(chroma_location_names[i]); - if (!strncmp(chroma_location_names[i], name, len)) + if (av_strstart(name, chroma_location_names[i], NULL)) return i; } From patchwork Wed Feb 24 11:53:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25961 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6B67044B5C7 for ; Wed, 24 Feb 2021 13:54:34 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4D97968A9C8; Wed, 24 Feb 2021 13:54:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4188568A994 for ; Wed, 24 Feb 2021 13:54:26 +0200 (EET) Received: by mail-wr1-f43.google.com with SMTP id u14so1624478wri.3 for ; Wed, 24 Feb 2021 03:54:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CXvg1gTY7WmO7tjpMiOJ5LyuOWL+Iuxa0OMY/nWdZ+Y=; b=dLQ45oUpS8qIKYUyn7UiY3fvhbOi/IPElLb51BsVAueLpWC/1P09kW8I4axFPB8cuq s9ubrd8F0SOwA1oSEJgECSzXpTfvsDmwg/S/lCcMfWM1n2rF8YpCTN/kcQDbHwtswTPG FKF62Zr1nKpCqMsZjAd9Icer51O+9arIiHU1Fuiugf5M9nBbMRIfRsQDRN2p/BUbT7AA SQsSwRzWbvrV+/jUtTRiG0Zn4QA3VOwmbCLuDLAUsxozT8Wz4Axj5ideQJ2SmtxmYXeK B6j6T0LSUHUmAOQn14oZKpN1d6iwWQB5b2fo7uQBkA/Yr/yjKgQinCTabJy4OeFcySVo zwLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CXvg1gTY7WmO7tjpMiOJ5LyuOWL+Iuxa0OMY/nWdZ+Y=; b=UV40M+vfRc291tA+k1a74Jh+5TX2xnJLNUaCMdunPE2BSIOv7DaNla20ukmnkuA3Hz u1K29fMQLpkHR1KDaI7+hHLavkZEXCXcUbDP8aB30dUzd0SlKjyvwzpUxRO6FqGb9im/ rUI50c56a1Q8gQq4aQ45gOIqfX+VA0jxaNmbAnYt07XFhd5yHPUxpC9gIVX66wR/25oH olhtpNu+17rPNZTju9ypYaNsls/IMHThGp2HrN8uibjboxoA8CSQJc29ycwtfrh5Atmd bM/cfwJcwASgHdLQZSuqxkqj6+Ji9K5jDGrU76sSXIGe4EevY2HolzcIS6kihp1c6yIZ eNAA== X-Gm-Message-State: AOAM533k0OQr9xIIhgbAdEFhpRvdBnzMNXQm13Lf6i+m1a0a+0OJo9gJ QDkpjK9qUgLjE9DA/es0xaSYNhyNs+0= X-Google-Smtp-Source: ABdhPJx0W/iJz7BaHcn8EEvQTqrdMmWMj1FQYA2HCsmTOKuloqd0uh+9/W0ixGaCxjg3m48yLObmeA== X-Received: by 2002:a5d:4e10:: with SMTP id p16mr31268189wrt.360.1614167665628; Wed, 24 Feb 2021 03:54:25 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:25 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:36 +0100 Message-Id: <20210224115341.794293-10-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/15] avutil/stereo3d: Use av_strstart instead of strncmp X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt --- libavutil/stereo3d.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c index 6edcdb1796..279fcc1ff3 100644 --- a/libavutil/stereo3d.c +++ b/libavutil/stereo3d.c @@ -18,9 +18,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include +#include "avstring.h" #include "common.h" #include "mem.h" #include "stereo3d.h" @@ -67,8 +67,7 @@ int av_stereo3d_from_name(const char *name) int i; for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_type_names); i++) { - size_t len = strlen(stereo3d_type_names[i]); - if (!strncmp(stereo3d_type_names[i], name, len)) + if (av_strstart(name, stereo3d_type_names[i], NULL)) return i; } From patchwork Wed Feb 24 11:53:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25962 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id ACAED44B5C7 for ; Wed, 24 Feb 2021 13:54:35 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 90D9368AA25; Wed, 24 Feb 2021 13:54:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0262B68A9E8 for ; Wed, 24 Feb 2021 13:54:27 +0200 (EET) Received: by mail-wr1-f49.google.com with SMTP id 7so1628166wrz.0 for ; Wed, 24 Feb 2021 03:54:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BIZyio3bL3Hl78hRQQ6GHB651tKPC66Nbvx1oXFi76U=; b=uDmEPa95E52cVOkNuCQcCKPAYJ7Kuks/t9GkZDdbXkIenMqLXZ11AtdoBmI4HaKOeq k7saItFvkl+VBzsX0IN6LxEgel+GvW18srQUFMTlEuGn0ZOwgb1sSzogbRbICtF3fekC ZPHoJtqqN+Ck3jP0kQyT89dG8TgWraB6f6xCQ2M+33C7I9I/LV4Vt2+nHrtoxU36kKjy D6zY0CaO1XRUQXKemnSyQIn5ew2PXieH5KOTMKdi925wRpejVXTb46iqWTqyuc6vV8UF BDuuR+qczkawI5Rc/NMzDx+oKfONBnUcvqQalqcnzsYgsmUoywfD7OBgYnmKpq6srpv5 07Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BIZyio3bL3Hl78hRQQ6GHB651tKPC66Nbvx1oXFi76U=; b=OcAm8MeHsnSlW4zFsudfvLACNOHhJ1CfjNoPdJ59bv6SbwqaiTz5BvAloYifLB0BWs 1hPbtgpgIoXlL+ugPtGDb+7DTLZSJ42cSaMrdl3fNCBnVX5nKBloIZQEq3PYwf7eKCPj Z/4anY4Y6l1/FBn4TRdeqmZVZvX6gQN1qpaVXzyO9CopaifAAdpueOHgCigkuewoXKI6 JCZIw/CuatkztcIXgvi5odHzsHkptbHVcXPDF/3y+CllB5xuGw7n1zwtDXuWDfn3mmu0 WEgyh/VPTZe6fF1JBxxOT4JhVINbjvBsJQLQ5PyUDESfaD+iMAcjjLUhPPBPk/WhuoFb urEg== X-Gm-Message-State: AOAM530ymph3fE1yLsvPal/UVIm6In8jjoOxZHJbEjY2qM63SQ8b26RJ 4I/Xk6aa+JknQTHtNqthOoXY6S3bPBU= X-Google-Smtp-Source: ABdhPJytGV9+5MR/WyY4X171kUDGOpkOCcBcjAw1u2SG9YJcZuS0EgV9UyknfBdipJv4w5uquSiphw== X-Received: by 2002:a5d:5043:: with SMTP id h3mr2412055wrt.120.1614167666355; Wed, 24 Feb 2021 03:54:26 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:26 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:37 +0100 Message-Id: <20210224115341.794293-11-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/15] avutil/spherical: Use av_strstart instead of strncmp X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt --- libavutil/spherical.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/spherical.c b/libavutil/spherical.c index 4a7f3e49ca..ed66344a2f 100644 --- a/libavutil/spherical.c +++ b/libavutil/spherical.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "avstring.h" #include "mem.h" #include "spherical.h" @@ -70,8 +71,7 @@ int av_spherical_from_name(const char *name) int i; for (i = 0; i < FF_ARRAY_ELEMS(spherical_projection_names); i++) { - size_t len = strlen(spherical_projection_names[i]); - if (!strncmp(spherical_projection_names[i], name, len)) + if (av_strstart(name, spherical_projection_names[i], NULL)) return i; } From patchwork Wed Feb 24 11:53:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25963 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id BB7A544B5C7 for ; Wed, 24 Feb 2021 13:54:36 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A6B7368AA24; Wed, 24 Feb 2021 13:54:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BC3976807F6 for ; Wed, 24 Feb 2021 13:54:27 +0200 (EET) Received: by mail-wr1-f43.google.com with SMTP id v1so1609783wrd.6 for ; Wed, 24 Feb 2021 03:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=52Q2gWGxLsPn63DQNyGcUWLl3/ONZ5fpXKBmAjW31no=; b=ZLPAaAh9x6YzYuGL4iY7V/EySw/vzL26RnVwuXNFzQlro/wIeF3MM2Evgy6tDSBESz 38b8V1+Xvp+zCT3IPfkgQbNMcw/yBt9AHaP+3n6+d373iArH2YX/2W+dYsBEfJwl9xJs MTrRECVtLs8Inh5nKQEYTGKR+NMAt8dF+R+Q5+avhZQtWZQjaC2fubvmXcJQC2RYBHtx hlIVQf2KBfJNiweFdkFqmeVpdBEcviW8G9zszqpRzeHM9JlbL04DxtNt11T8XFNH33HF bV2eYaZaZGxibJkqziFsO3ZyT3W9Jl3uOM4GREA6y1C2yDOGq91MJD57CytHncZpvtF/ inRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=52Q2gWGxLsPn63DQNyGcUWLl3/ONZ5fpXKBmAjW31no=; b=D1FnZdVM8ZsooH5MFPIm3KLXpPHgWwHrxbzTZ+13uqPLWHufYMcyzkYBvGIy1LlQmL xDu7FBik1yGsymuS7Efjdr7Z1myyJ4cxZL3H+JDH5+cd3We0y55UlvfA/FZmX8aRFTHY tqGe4dYBTG+TH85X3Ce+/loTi8dkW1/M1Xrdu9X12uCVS24Zu+cajWE9Z63voVZFJk/r vlBcS8ZUw+CQMKc5C8n/WcuPoNutjDucl8RQ/Qpbivw/Hwc4TdW1eU7fN0tzhYzGvgW9 y0ybqZg+XCGOop/RZ7eLb/rjWt0eFu6pfTaQxCnWXR85ET1N1n7cy7AQx4MCQOuIV8iT fsPA== X-Gm-Message-State: AOAM531BWHTmpV9FD8IzoDgE+e46IPYVAU00V5tOXUYS73wu2dcQK5hU 7kq9NAL2KsE5tiSFW/aXVMjPCWWhUvE= X-Google-Smtp-Source: ABdhPJz/UqL42/aXORXV+lEkgA0y3lVnherHgXLyp5geIgrY7s/fCSdI+KUFqoC9MuEBKUvBOAkZbQ== X-Received: by 2002:a5d:4ec6:: with SMTP id s6mr14421154wrv.416.1614167667093; Wed, 24 Feb 2021 03:54:27 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:26 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:38 +0100 Message-Id: <20210224115341.794293-12-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/15] fftools/cmdutils: Use av_strstart instead of strncmp X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It makes the intent clearer and avoids searching for a delimiter in advance. Signed-off-by: Andreas Rheinhardt --- fftools/cmdutils.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 4eb68d2201..fe253d10a4 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -215,11 +215,9 @@ void show_help_children(const AVClass *class, int flags) static const OptionDef *find_option(const OptionDef *po, const char *name) { - const char *p = strchr(name, ':'); - int len = p ? p - name : strlen(name); - while (po->name) { - if (!strncmp(name, po->name, len) && strlen(po->name) == len) + const char *end; + if (av_strstart(name, po->name, &end) && (!*end || *end == ':')) break; po++; } From patchwork Wed Feb 24 11:53:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25964 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A287B44B5C7 for ; Wed, 24 Feb 2021 13:54:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8483B68AA64; Wed, 24 Feb 2021 13:54:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 96FA168A9EA for ; Wed, 24 Feb 2021 13:54:28 +0200 (EET) Received: by mail-wr1-f48.google.com with SMTP id n4so1631824wrx.1 for ; Wed, 24 Feb 2021 03:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BByPkMyD8gVpBjo/kBMcBMqAnYflHoa4EMz59diuVrY=; b=gz2yoXbkMHQ0KoKEZ/eu8zY9bwiIRG4FK9WE9c2KhgNCVvizgYB+TLFi9kMvcotKPH HUFwHjsh82iJShbhZJ8PKy8vnwiZQTElB77BXUdmLrttyP6ypPzsWuyYRc7RhQTfzSb4 GL9k8ftc8m1V2F6bVuArsmIjW08zkFBBtOaxP75BB5p0dW9vJ+V9vxCuRev1Htnc4DXS gQfiCMCjGz5Dv4qdgSmiUdfDXtbhAoXyYgiLnffXotN41Xg8KHrKwhI9f5LPxhYzNTmH r3LbKI5htrXBSJwwiPUXLE70fHBSK7aWd5xR1tkDB8IEabf/hvEJjIBBJW+DEBL7e9Uf otIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BByPkMyD8gVpBjo/kBMcBMqAnYflHoa4EMz59diuVrY=; b=aXwg9j+13dTtJFmOdA0+S/K+iN/nkmCGqkKK2EVmpu+jplfCEW8EPuqKqgvXi5Uc/+ GapzPzhGBEJrmZzgHr1NsyepLhnp4ZYESQ8SyG61/dXIMRR4wcpaNzJZj500WIF2KUUd gn7MvwclVJrO14FxQBzy3Lc0Kr06qVl5THWqFsC6kqhd9Hj0Jdo+wAzGiOhFCfn/VNyb vcwMshtkYfrL4ggvXgtYmKziqbuPb4SBPuF6JErt6qFUH4c7sKHDu91vcFCT2W8ab6DG 7Un1jdEGlxuP5HdCbkjkyeZKbeCMiCWwrls03eTaOT2RYN4+8NiwWyFvg0HbOBqeF6bt ES/g== X-Gm-Message-State: AOAM533aUmZjiuXwlMLIZqS1lAYZx5+oO99L5wssJDvgLx4dg2AyA3wY uZC+FLCuPaot2GKX/cToY2TiZ99SEv8= X-Google-Smtp-Source: ABdhPJwNLZdrgW7L5mVCZvwd/y7qF6EMwHdxhdeBj0rjE4ypTXiWX2TVUiaYg/ZK4ELWu8mRQB5GTQ== X-Received: by 2002:a5d:6643:: with SMTP id f3mr10138291wrw.182.1614167667933; Wed, 24 Feb 2021 03:54:27 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:27 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:39 +0100 Message-Id: <20210224115341.794293-13-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 13/15] avformat/avio: Use av_strstart instead of strncmp X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It makes the intent clearer and avoids calculating the length in advance. Signed-off-by: Andreas Rheinhardt --- libavformat/avio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index fbe07e44bc..8011482e76 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -114,11 +114,10 @@ static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up, goto fail; } if (up->priv_data_class) { - int proto_len= strlen(up->name); - char *start = strchr(uc->filename, ','); + char *start; *(const AVClass **)uc->priv_data = up->priv_data_class; av_opt_set_defaults(uc->priv_data); - if(!strncmp(up->name, uc->filename, proto_len) && uc->filename + proto_len == start){ + if (av_strstart(uc->filename, up->name, (const char**)&start) && *start == ',') { int ret= 0; char *p= start; char sep= *++p; From patchwork Wed Feb 24 11:53:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25965 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3ECFC44B5C7 for ; Wed, 24 Feb 2021 13:54:41 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2667868A78A; Wed, 24 Feb 2021 13:54:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 75F4C68AA3E for ; Wed, 24 Feb 2021 13:54:29 +0200 (EET) Received: by mail-wm1-f54.google.com with SMTP id i9so1247248wml.0 for ; Wed, 24 Feb 2021 03:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=70FuqK+MGIWPEpAFb5bhS+NdKtQzUNskhxVJ2pV1k+s=; b=UkKgNQFsV4OmEkZ3ZkM4cUfBT2QxqyM0wW9IzBa5tSwSu9v0nwrORDX8b2LKnbfY1i REjOcen+HMq+/bhIkOVIfn6ie5zC7bTNoVBoHWZZZ2Hm6J3CPSXDQET1rodQvZxH8xbn qgW2vP0OH6eNdwP4obG7BwWHAf/yVFeDy6aiu7REgyud+uXzZjDO8lJPG6/0mV2Lic5Q 06TD3rwFq2XdikfMyyaAKZVLxpDPJQzj+EQc5DA09n5GsdrV/cQ1kXiArRuIZGeJbqZU wProAi8fzjtrFq4Oz2p4BGNjAUb7UQQ1b6z7IVUWMiwCDk066Dt9qvoDjslQoY70an3d PNoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=70FuqK+MGIWPEpAFb5bhS+NdKtQzUNskhxVJ2pV1k+s=; b=RT50HLWPrHhbXi6Yef2j6Uie0kVBeHRlUivvTfLjDRe1C/RHXT8OMuD8+Bq739U5gr JSX8YE+lQ/yU+XsAhP4WkQm8LHRo0N7ARqWqrPcjXLl6R25i2U2OYxcwCF4AkL6kTl/n BDdXJMSmNsRTNF62RW4B/kcFB7pUyPCA1SxvOg4ZLIinTuHv6zHzOovE3NxkYT8zfWKn 8hiSk5jTNk2oop6lp1uy2Zzkfzon8XZYItFLwWaA9SJYV14koGkzS9siG3wqN/4k9vFt qWpDax9kQXd7Z29JnAR/sT8xn/SA+9OF2T/Fops/KrIuW+H00mq1EVzu2plwPDGnkpnp h0tg== X-Gm-Message-State: AOAM5324yFVIoMsz/r9+ccQf+T9UxnU9XNHf8yiirnmBmDmGapZEIhwP x680w0ACTXGsfWTwGga9VriCkQgm2U4= X-Google-Smtp-Source: ABdhPJwaA/zAtVaNlOd9xNViAwnDD/8/hs1xCGfe3QYfvE5uzI5868P0ri/d5P7sKqW4Pj7r3SyM5g== X-Received: by 2002:a1c:e409:: with SMTP id b9mr258733wmh.173.1614167668731; Wed, 24 Feb 2021 03:54:28 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:28 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:40 +0100 Message-Id: <20210224115341.794293-14-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/15] avformat/matroskadec: Use av_strstart instead of strncmp X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 1f96b49fc4..c03cd8bd09 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2470,8 +2470,7 @@ static int matroska_parse_tracks(AVFormatContext *s) encodings[0].compression.settings.size); for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) { - if (!strncmp(ff_mkv_codec_tags[j].str, track->codec_id, - strlen(ff_mkv_codec_tags[j].str))) { + if (av_strstart(track->codec_id, ff_mkv_codec_tags[j].str, NULL)) { codec_id = ff_mkv_codec_tags[j].id; break; } @@ -2986,8 +2985,7 @@ static int matroska_read_header(AVFormatContext *s) st->codecpar->codec_id = AV_CODEC_ID_NONE; for (i = 0; mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++) { - if (!strncmp(mkv_image_mime_tags[i].str, attachments[j].mime, - strlen(mkv_image_mime_tags[i].str))) { + if (av_strstart(attachments[j].mime, mkv_image_mime_tags[i].str, NULL)) { st->codecpar->codec_id = mkv_image_mime_tags[i].id; break; } @@ -3016,8 +3014,7 @@ static int matroska_read_header(AVFormatContext *s) attachments[j].bin.size); for (i = 0; mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++) { - if (!strncmp(mkv_mime_tags[i].str, attachments[j].mime, - strlen(mkv_mime_tags[i].str))) { + if (av_strstart(attachments[j].mime, mkv_mime_tags[i].str, NULL)) { st->codecpar->codec_id = mkv_mime_tags[i].id; break; } From patchwork Wed Feb 24 11:53:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25966 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 635BD44B5C7 for ; Wed, 24 Feb 2021 13:54:42 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4C89568A9EE; Wed, 24 Feb 2021 13:54:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3274268A8F3 for ; Wed, 24 Feb 2021 13:54:30 +0200 (EET) Received: by mail-wr1-f42.google.com with SMTP id l12so1623501wry.2 for ; Wed, 24 Feb 2021 03:54:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QSZz9XzgteAnG4XyjE+084hOK3Q9YNN40zf/9VJJ+l0=; b=dxt5mmejPx5uZL7J6QgOAuv3Sqnq8jIVYm+sPWOTA5K/MzW3VRfzC2AHVUjPwoy0tR HEic8H0UeVzMGgMTzSwpasr0wvB0pfblYT6L099MreJzuBVX/s3JfIxdD7jHKbHPYZsx W+zq/JFbX14bvc6HB/qtdxRL61cfYtJaXgF8KBWbt8EkK3eLRObqyNzbctY+8psRnFR1 EVQMXfGin1acHKtgVrExyJitmxpCcwBgew7ukDE6ATQkBdFX6A/scRoOHbn46LKurX5k Mm/MQsjBZtT0Feswk2f5DSXTbifO37rTlWbbc+MKYOfafWkGkKpRJRIT0zLglQhXGNFP wmaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QSZz9XzgteAnG4XyjE+084hOK3Q9YNN40zf/9VJJ+l0=; b=s9f137rLNBmLh9t8N3h0cjlHFbnXvh7zvBy/pAPoQU4BLBkCFkdgXi33itSIzevDDM ErrmsVg/DL17QSghyxEeGAs0KQ+ToGbBjZUYQQ7wo64XhGiCjhD9fK+SbrjVwCjsU8iK Ab1+/fySWyoYAmAr2hH4or6vJcTr1i3g4pGOXY9R88TwVbQoPhuzPC4fij04mUHgUlwU b3d5zBlD3vwF6sC6f6H2Ae7NTiQihufMtbZYKnzqXx2BOqwJnk3iSZrrnu6jSkPgndj4 jV59hEtfviCkIT0omoKalezVu3APugGQlYSkItVpZIBtO/Ywl6pBbUknaQyKjMA3VE8/ /oFg== X-Gm-Message-State: AOAM530le8+9X9A2wDDyC74oIgCzPxXUSmnJ9X/ykQl8/5FdCXfLQ8cL sF4dEbF3HvzmJb9K5ljXcfRguDM3574= X-Google-Smtp-Source: ABdhPJxwOiX98W44vrV6pF2FYKznlMuUkj+LbtA8bbqvfGLzfVx31O208V3sITwMTWttIoUl5SVu1g== X-Received: by 2002:a5d:5441:: with SMTP id w1mr31101820wrv.366.1614167669508; Wed, 24 Feb 2021 03:54:29 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:29 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:41 +0100 Message-Id: <20210224115341.794293-15-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 15/15] avformt/webmdashenc: Use av_strstart instead of strncmp X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt --- libavformat/webmdashenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c index 04f8cbe39d..332d0466e1 100644 --- a/libavformat/webmdashenc.c +++ b/libavformat/webmdashenc.c @@ -133,7 +133,7 @@ static int subsegment_alignment(AVFormatContext *s, const AdaptationSet *as) for (i = 1; i < as->nb_streams; i++) { AVDictionaryEntry *ts = av_dict_get(s->streams[as->streams[i]]->metadata, CUE_TIMESTAMPS, NULL, 0); - if (!ts || strncmp(gold->value, ts->value, strlen(gold->value))) return 0; + if (!ts || !av_strstart(ts->value, gold->value, NULL)) return 0; } return 1; } @@ -152,7 +152,7 @@ static int bitstream_switching(AVFormatContext *s, const AdaptationSet *as) TRACK_NUMBER, NULL, 0); AVCodecParameters *par = st->codecpar; if (!track_num || - strncmp(gold_track_num->value, track_num->value, strlen(gold_track_num->value)) || + !av_strstart(track_num->value, gold_track_num->value, NULL) || gold_par->codec_id != par->codec_id || gold_par->extradata_size != par->extradata_size || memcmp(gold_par->extradata, par->extradata, par->extradata_size)) {