From patchwork Fri May 21 09:17:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 27888 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp340823iof; Fri, 21 May 2021 02:20:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhSvQSArnWgAaoUSEhUtcNiL2TBJnVEG/50z4vYDtVLjcIFzcHet9WQeePHqe7KGzuvOSq X-Received: by 2002:a05:6402:2788:: with SMTP id b8mr6828706ede.335.1621588803100; Fri, 21 May 2021 02:20:03 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id pw5si4919461ejb.531.2021.05.21.02.20.02; Fri, 21 May 2021 02:20:03 -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=@outlook.com header.s=selector1 header.b=lTAI7MqK; 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 BDC6C689D21; Fri, 21 May 2021 12:18:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066076.outbound.protection.outlook.com [40.92.66.76]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C8DAB689C1D for ; Fri, 21 May 2021 12:18:16 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LpWvNoqUdudU+1pQVH6bp92WvuoLFWNskta55q59SyYV9sbzcus/nKDmDjFbQhsjDhu/B3GyYRdB5N5SndbfA9LXJA4/np/Gdpd7+3pNv1s1yD4qzDM7Uk6w3knCnLJGQAFucyytqleI5p3d32A7a7QtFvkRiujppLSfFT1MXvHiE53eFj8HJzFpG4qU4buwKiE3QlGxNWTM34Exjs8OTXjjMDtCUmdjOEMQIIarLSHagEcOPPb/5OSuorYYAGgScd7J6ebdEH30W18IX+AJrN0K1Ju4lqK/1zOnJMOQu4zmaBZUAAo/T6U/3wt4rbksqSQmfcqAU3YEU8in18Ddww== 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-SenderADCheck; bh=WfBMjATnUpvsVOE7Hv5y+6YZrLN58Z7AsiQRz1xdnsQ=; b=nhN6NmeuLuLy5kvdEqjKu/ONzjaNU1CZHNSUGDxPi6728rE7XirwuBNaShLB0f3q08qjaLjalws402AqOjWLiIXIgPWkJ6JSjhjGs+ES3JLJRnbvSDBTKWEr5KW/XiKqzyIqYd59E+B5vSQQEmgtIgIykOZprKwqA43TNeT9HFanu7nabehFdsyTzbBG5ZcO5rKc3rLZ8xGfzdB1wfAmFKUnfmkWnbne5nSZeuKMc8l6oRFo8Db3k22Jfoas5/AYkWUw7WvGXyWPjRBRSKsAHTtbnwj4pHIJte+i64dSY1awNpG4Wb2pebnrt+4wmNvTvhUAq+1GAmwjcfxs2/L18g== 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=WfBMjATnUpvsVOE7Hv5y+6YZrLN58Z7AsiQRz1xdnsQ=; b=lTAI7MqK2n99jF31zN5z/6p+oDQiPdaouhYLsbTmIxPyZ44wixVK+YGIGeitUySLMJ0yUrf+03VUXYDeiqPiyf7CB7SiIfwY8Z1P82lNHBVa8dWIPXhW0NpJN2sHC10uBRxEl7y46AcmENFmmWlGTtReNrwe78H3emJO8SJsf5cmjXMchmvpuuRKYtgsJeoSNK9nNGfWAyoLykeX4OlWQ1ZGQbvgf43AlHcMbrw+Pg9AmVmSNbC+qmw3pmZpF1aMARL8thlM3B8uy5TO+8ZwDJdWhAbP2cS0LuzKtCz7fqNsLe+0oZy/KxPrZ2nLBr3N1Pe9mDxGKkD/Xbi9k0rCRg== Received: from VE1EUR01FT010.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::4c) by VE1EUR01HT043.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::268) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Fri, 21 May 2021 09:18:15 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e19::41) by VE1EUR01FT010.mail.protection.outlook.com (2a01:111:e400:7e19::83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Fri, 21 May 2021 09:18:15 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E6BB1F0EFF08D6324C5EC93223D741F2A10A29672705CB35793C420141DAF397; UpperCasedChecksum:032BEA6B32438F0C8FEF975BD09B6D42A55F9481C1D21333293ED3553719A2E3; SizeAsReceived:7585; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb%6]) with mapi id 15.20.4150.025; Fri, 21 May 2021 09:18:15 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 May 2021 11:17:16 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [ph8W/0paOQak7HyLxh6qJpNznoVeuN8A] X-ClientProxiedBy: PR0P264CA0070.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1d::34) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210521091742.184902-12-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.27) by PR0P264CA0070.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Fri, 21 May 2021 09:18:14 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e5bdb651-f808-4010-60a3-08d91c395ce5 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNU/M7M4vrgvBd+IenKLBfauGgBLX+CNMivSbtevQNSoL6iJ6lQjox6Nd383+LeRNX/M58E4AEaXODeg9Cua8ggiPi9xQdp5Jv2XIff9qOab8cLWOv3+A7yG+R6irR460mMCMi9X1SHZ3hwxzfXKv5DW/JuhfFpPnh17Xx8IBCyDfBOHP1vYBBCLjyw7zbHg1hH6KUwADMWbhjn3jefbrJVcIIyR/3tH5jxfKMTLgKhbZibGePMKbKD+/aEU3g3xOR85SnBLtoMLcnbj041ONnhhLH2yLBNTqkV5gBhI0jwruD41+ahVXzcxTKenK7eddaS0l4CoT0Lx0wntZCyh1QyEC26LBteRkOc6sOxFNS/LkVNkSz/gyAwIGuJNMjuNTsUdLb2pa4OZ5Qt1FtrNnRMNzyKxlNOFx/UqzeGqVge81SnPGnUmWG3N25UCkiJPWIMdzsStEFsDg4CatPBNTDToZ+T8Zq2xIb2cSnh0udbnm7A+9BtOMN5+dCtLyGvvDUKoqHJ5t8GtmylcoQLlGWbRp8H7uKFBp9U4r/7nG9t2pu2kosrpDWUYUjxclb0Q43/gLGSjOZ+n0XpsyNdMLmNDOCIMyrxUnCGG72a+N7GwL4dixI0UZst2BXgyBOeonBKBiMNuY1FxRLBXxYCUsGsOjxlK/+BiYSdBFhQI3cV+OhIB/L/ew7blaItdUp8y2jWEisyFVk5VxwlQA7p48cwH3wB1tU/0xYI= X-MS-TrafficTypeDiagnostic: VE1EUR01HT043: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PXtr19JX48c0MLSPrFKaFFRpGsJCdIxN/b8zUdaVZ6HDZDuBy4MEhdSlsM1jBtbLDjWTrPdu0ri4k3ou1hDNEKDGfmfoaekPhlQYiW+2c9dKCMS0PgHZB+kcVSncNRkDXVOTacdkN95LukFVbJcNh4wktwU4jQirZp02GSNJi7KoKqj14y/c+3cTBU5DclaUmj6cAkxD2DdvdxEQPBcTESB+JRUmkoCwf6PO8+A+qOQFC1RRRGscf6L8cVExN0xvgZTblOo+bv1EQ9bcKhwzR7G3JxY38905HJz7vEMB+8a+bWB6xcFdjHjtoOekfsPpN6aPga7eLDFO2d2WAHAMscrKz3K1p5OBbTJRm8sfKlGMcVCNyUskq5Urnhavg8DugyWj/Lj3HiqtFMYCc5NJxA== X-MS-Exchange-AntiSpam-MessageData: lowVY1of6X/uBxh/6hy+zxk7yuoyX+61Q6AECgTKby3D6dt2aR9dL7vRpaum0sUui+BFBHUvl2raXvsZBSDwEG2W97hzrLI9m5f4RCoHNS/1jTguR1/jifOL6GF60bj1uqchkLNyL7aSyCqG6OJCyw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5bdb651-f808-4010-60a3-08d91c395ce5 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2021 09:18:15.0764 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT010.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR01HT043 Subject: [FFmpeg-devel] [PATCH 13/39] avcodec/libwebpenc: Allow user-supplied buffers 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: N9y1bX4Yi86A Here the packet size is known before allocating the packet, so that supporting user-supplied buffers is trivial. Signed-off-by: Andreas Rheinhardt --- libavcodec/libwebpenc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/libwebpenc.c b/libavcodec/libwebpenc.c index 2e5b811455..97adacb6b2 100644 --- a/libavcodec/libwebpenc.c +++ b/libavcodec/libwebpenc.c @@ -24,6 +24,7 @@ * WebP encoder using libwebp (WebPEncode API) */ +#include "encode.h" #include "libwebpenc_common.h" typedef LibWebPContextCommon LibWebPContext; @@ -57,7 +58,7 @@ static int libwebp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, goto end; } - ret = ff_alloc_packet2(avctx, pkt, mw.size, mw.size); + ret = ff_get_encode_buffer(avctx, pkt, mw.size, 0); if (ret < 0) goto end; memcpy(pkt->data, mw.mem, mw.size); @@ -98,6 +99,7 @@ const AVCodec ff_libwebp_encoder = { .long_name = NULL_IF_CONFIG_SMALL("libwebp WebP image"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_WEBP, + .capabilities = AV_CODEC_CAP_DR1, .priv_data_size = sizeof(LibWebPContext), .init = libwebp_encode_init, .encode2 = libwebp_encode_frame,