From patchwork Thu Dec 2 20:24: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: 31893 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp565536iog; Thu, 2 Dec 2021 12:25:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZC08td8r+ain2dGKuFoL2CFv3ibbRaUl4oSRa3DSWpzAxBHVm/Ux4jdCyKD5/Pi46hEmW X-Received: by 2002:a05:6402:b23:: with SMTP id bo3mr20149640edb.366.1638476711202; Thu, 02 Dec 2021 12:25:11 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s13si1254832edd.232.2021.12.02.12.25.10; Thu, 02 Dec 2021 12:25:11 -0800 (PST) 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=@outlook.com header.s=selector1 header.b=s9LYW2t2; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3E40868AD39; Thu, 2 Dec 2021 22:25:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (unknown [40.92.89.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6A47F68AB6A for ; Thu, 2 Dec 2021 22:25:00 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oEuXaKEpxePcWz9x2Qz+wcvt1ep1NNid9MASfCAan2KIWNWnz/XAZmtEYREbUD6pBmxHg9WSQoaeTQ+7vyk8XnNZb6PbL6RwwWyPw0c/qhfdlxveF4FCPDLu4JJlriu5RD5DXJyLj87y2CXJToN7qFSak7UBexPeYJI7HHfhnOabgS1hSmh5vvjS0R5H1e7NDWLXOv7cLYoVEVe6HdxtrLoJ5FNCDwqesRGW1ZgveicRnm0nnI99lD4nm+bHy+RebWahs8lWPmcJaagEirbhmyih6eUO5qpN/qONwm6Pi6aiwL3jxPUvNRlRZrRvYaQToWekb/L63SDgrSHOBZhtLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hIOyUvW4RAN4i3eM5AfzVIUeEQm0HwQM/EK1AiO3GrQ=; b=Gv70AZeeYZdtWCLmaeCyBSAap++aM0KeWeb5iFwRh8uB4uuNotzQFshCRCY270bQdK8CkZITU3izUKnsPPj3JiUnih1dx0+28tJofI4L8vXdD+SQcK7lbp8xz5h8eM49TgsqBAUTVCUdQoRcSIygcMfMxm2mhCeZ5+D5pL0O9PI7mjAXTvMBoo2e7v8jlcxlkcmGVRKLLFDaMikq3lu/+usFhz/AOONrreEE8EOvLKIv6UR36rIFZLVGjgkpeG0xHbSCmjC5BNM01GDyX6KBQMfAv7Yx+p38ZX52lWYh/c3tY59fCgf8xcryV95DIDtWAkpHvFtg9QEOht4U4ss/pQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hIOyUvW4RAN4i3eM5AfzVIUeEQm0HwQM/EK1AiO3GrQ=; b=s9LYW2t2ZwchMCz0b+tBqiimAX4VUm3YE2U5/+W81NCoHV2jyg9u1kKOueoWRCa5d928gH8ryJ/Qbeq2VHhnoy0sfLWt4AfPk0U1xs9CTUHU0Sv9Bs+Ae9H+6opyMO9eY+q/ckOEl7cSc7Rj2zt3dWpZ3hPXZAQ2smjCL2RxzrGdILJgAjaFkiJYYVJzk/xoodTxyK5Ypsqldq9Y8NLTzqliEklkLU+cPONyDHykAla0qrohQSulxQBgPEElLeKk4R7Snbo2JD2JvyRTH9jbfXA25C2xtl3jM4YAB41MTPft//haIfJykLe8be1vQglZcoNBrANGoSO/yqpubJ5VCw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4101.eurprd03.prod.outlook.com (2603:10a6:20b:21::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Thu, 2 Dec 2021 20:24:59 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%4]) with mapi id 15.20.4755.016; Thu, 2 Dec 2021 20:24:59 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 2 Dec 2021 21:24:34 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [YaEA+yAY10s8p3JJ7OoVW7tQI8GLXpUi] X-ClientProxiedBy: AM7PR03CA0025.eurprd03.prod.outlook.com (2603:10a6:20b:130::35) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211202202438.1114860-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.248.74) by AM7PR03CA0025.eurprd03.prod.outlook.com (2603:10a6:20b:130::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22 via Frontend Transport; Thu, 2 Dec 2021 20:24:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eeb71a57-33ed-46b7-c943-08d9b5d1cfc1 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiTPBnr/PBTQGLNrfAOwIli/BFuhGrGcvZzvZe67RpPV55i6zZZ8MQJc4MIqkb56iMmIBVdnIl2iaxnjC/CXpmrARWUCRbAmAeZVlbbA+NaocWC/BF9pNBcNnevAHCW/cu622WeQariYUJhmV4/eChjSlb6J3kwEfvrUgpvfUt2USp5ejxey4/dcJ4+AqO6Llv7y1HFcfwZLg/mrhXmgK4LsgKtD+IQ0kn7WCJcgo9qEK9MosPZwUZ/b+Ue/cd2jeb2mMK8a7wW2cVn56AwSiu3kVZ2X3NSCQR6BTnL8y5rAj3EwTHxayVPMxsC2l9Fpul71K9FrArtBFRBO4EXswPS+dtZUkFLk87KPF4ciS2KdDMo6WrqJY/3ZbjCQEeYvyxgq39eXPOWto8twGVcvK3itFeNUJrfk/QGQaFyLv6qRansVRHFLwHRHJWPS5mT3Ry0UuS3lnwhfdGbxfuD7hbXYvG+PuQRzzlxjIbBkJLRAzp+WU6q64oWHyy6mWb7bN9jUDSngMj9m6BLOUFzzQtMyeQ26HLs5M2RxJI+uLop3nN+jLwDaEJczYVOyBMi8op3FULeglOa4iLAP+mWTbQeBzWk/Z2grGCRnO530taHUhVwZnbSJp+pzVK+0BmaSqrWbkZ6w8Gqqhcd+8EFGFSmZ4O5efShcXjKKnem9g0AP+OK6xLxq3yksv1R7Q1WjnKW9sPkhbOvhgq2721IEERqqIQYxyzOdAKkBsS1QacOqqrqQUcAq15ZVVYOywxM10RU= X-MS-TrafficTypeDiagnostic: AM6PR03MB4101: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rexJPYlxBMvNPbtek8DLsEp1SBl03AYNRgmYvyx0UW6zMYHVJ1NUmtzb1wTz2s1eQwPiebPdFueZFh3iEa4iS80KIfxINsycW/Lr7OZZI0u4pemOavcJfyJNHTWRTmSws7Nd1JSEvPOYeApAv7pggAmr6wWLWEJPtRUslQtb3gV7RCsxbYbOqKt1K0CozTcnB/uvVzp2ztoNk1lkJ7qXBJKWxoEU94KT4VwpKNPcU7YJPZYqZigUl3lJMWNSIOcKW/J7sOjhy5K+qF8+4BgdbA4OpjQFymbwsC8AULNsk2XeigHXwcN/O+hqP72+AURJolHMLKepAff1uSOO8ra8aGDHmzw46x5tpDOMyzogWIw8WOOeOVUyoSrE/c6pn5k/zHyJeuhfNgZzbChxqHbFOgHZczQ2y87T5QtvhwW0nTCgRlADCD+WXS3RJnoG6YSx6bAW5CYmq6lEgx5EG9klZPl8StThFyHndDeI7HScG4y0XlGeRTSmcxkB7ZP6aphbW99bvq/Hu7oyNshfNc0Mg0mpc9OpZtRLsWAm+5muVBA65CIJfBMboPIY2qa9QBd8jiGt24y70HsM/iEAyLnJ8Q== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KrdFicyo6by+CPaXlDKXMl9SZBu1MsZY4bvWzEgvBSrNaLhAgdrK3DjInID62G2zQcStFh4QNNMbgho7T0KxExEEx2xmRcJPD9sPEjPb1YUj6DPvZksMhYgv8SQp94HejUtv2W1nCjlF69iXB/LWQo1L8h6M2Ld4tIbav5IE960qKeos+130Z5eruvsq4qaNxq39GZvVtvWUoprXknqqFiByD7+Wb6GdpkN6EhcYhuAdS2QIKjjSEZb/QgnRZ7SkfSC6PFhd2CrNW3o6LCQmxqPiLQJl+wDKbYLtp6ZlQKW3L7tdcaSrlKz6xU1jaAwiGSO53oLFPWO8rmf9JH6F+Q1peIIZ8EzQOsTqj60c44fwFvu9TaPr4turCokQM+O/eBTAd1cPpGiSBbx5DQ4wGy2UoXJ/i0bUpC5hwWtYuGIyuHsdy1YcRomhBN0u28Ate1HPHCyyc/ZAGIVytIKdoR/bb+AgXjo804d2gt+RHRKPMphP73U0xoY9GsOAZOP06CzWQo/utXKRxXXYm/7qqwoh+SmOPB6gwGj9Ms24zrTqWHadHIFm+XMizdMsgXmTqPR2S20cnkLiyCtP35BKZvIgTe4gLTDaxbzU1GR5ZXYffMO+C+1PsHiVQtvNRyP0r39f6O00EaYuUKBLEHGm7XfJwMy4RKVCtJbe81EYYx+bp9LI1lXBWAZW81xpEV2FJfYtbUSIfR8+17RIIniunJiFZJQ60gTeF6uoNOr3/w7Dbd74+u7BrwiS1LV3UW2emxRY7JBI9Shd6qpQo9tC1vyNfLBKnI9mrqiwd3AEvBVlTkoFImjWtzWGCqpZ5cgaIoZK4la7xrbkB7L9zQ+mvjg6/CE6aPLy75JhfZ+LRj90VK/JEke12sWOtKA2dUOCzfTu8fXbEzajx2lOn3OblMvTu2tjG5JZ+ylN4eJwZGTU3rqgROIG0agGDddgaNDUjzjB6GL7/gQ27fnh82QAdg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eeb71a57-33ed-46b7-c943-08d9b5d1cfc1 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2021 20:24:58.9730 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4101 Subject: [FFmpeg-devel] [PATCH 4/8] avdevice/lavfi: Avoid calling av_buffersink_get_* multiple times X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: RO3Bt43pEILG Signed-off-by: Andreas Rheinhardt --- libavdevice/lavfi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 209ebed5fd..878bb193af 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -320,27 +320,27 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) AVCodecParameters *const par = st->codecpar; avpriv_set_pts_info(st, 64, time_base.num, time_base.den); par->codec_type = av_buffersink_get_type(sink); - if (av_buffersink_get_type(sink) == AVMEDIA_TYPE_VIDEO) { + if (par->codec_type == AVMEDIA_TYPE_VIDEO) { + int64_t probesize; par->codec_id = AV_CODEC_ID_RAWVIDEO; par->format = av_buffersink_get_format(sink); par->width = av_buffersink_get_w(sink); par->height = av_buffersink_get_h(sink); + probesize = par->width * par->height * 30 * + av_get_padded_bits_per_pixel(av_pix_fmt_desc_get(par->format)); + avctx->probesize = FFMAX(avctx->probesize, probesize); st ->sample_aspect_ratio = par->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(sink); - avctx->probesize = FFMAX(avctx->probesize, - av_buffersink_get_w(sink) * av_buffersink_get_h(sink) * - av_get_padded_bits_per_pixel(av_pix_fmt_desc_get(av_buffersink_get_format(sink))) * - 30); - } else if (av_buffersink_get_type(sink) == AVMEDIA_TYPE_AUDIO) { + } else if (par->codec_type == AVMEDIA_TYPE_AUDIO) { par->channels = av_buffersink_get_channels(sink); par->sample_rate = av_buffersink_get_sample_rate(sink); par->channel_layout = av_buffersink_get_channel_layout(sink); par->format = av_buffersink_get_format(sink); - par->codec_id = av_get_pcm_codec(av_buffersink_get_format(sink), -1); + par->codec_id = av_get_pcm_codec(par->format, -1); if (par->codec_id == AV_CODEC_ID_NONE) av_log(avctx, AV_LOG_ERROR, "Could not find PCM codec for sample format %s.\n", - av_get_sample_fmt_name(av_buffersink_get_format(sink))); + av_get_sample_fmt_name(par->format)); } }