From patchwork Fri May 21 09:17:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 27876 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp340924iof; Fri, 21 May 2021 02:20:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0TjzIzZeMZ4qQ32kpsCZqLyFUCEw/q3dDGrP9piMU81Yo/JTEgK5l8kMR7CI2K1TyEqI1 X-Received: by 2002:aa7:d801:: with SMTP id v1mr10180599edq.349.1621588813296; Fri, 21 May 2021 02:20:13 -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 l3si2777144ejd.203.2021.05.21.02.20.13; Fri, 21 May 2021 02:20:13 -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=FXn7WDuh; 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 B3432689CDF; Fri, 21 May 2021 12:18:21 +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-oln040092066044.outbound.protection.outlook.com [40.92.66.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DE2C0689CCC for ; Fri, 21 May 2021 12:18:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PGPAv0g6yTMOp8DCF0WT/jRAtyOklVprkinFL2r3+lBAoFGfQNp7TZjA2qoQOhxBJkKOaFaDlmrqw/CShc8UarYoNhWOqytZbxn/i8k5U1+rAuIKzYD5NHW34O/BbxG4B5z+j9APpF8zkGcIWwcVxGmqmAY4xgzVvXNF/3T5HGuZqDdYquSp46HIOOnVyz+hRA7QEG3tjFqh71vOr/g4XQfohPqgmk8XkZpMEwUFDHdYq0NNwjTH8Ip96zOCSamxliajpkQJFeLiIpEIFU9LiJ7YFXe8HNAhm92wAXH0AC+RISpHQowiqdT4jWHPRwXRsRyO1iTkjNDoyT++nMHFag== 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=VXmK9BSw2LnVeJCwFtAhl5CWNOAjs9JziBipnKDuuEs=; b=BBfxmhzuY7kf5JUnEQ4Qw1Q/T0wPDDLUXzO3i0ROsO+uBik02eBLEU/RRGJV3btia183vM9xzd0A/BvN+MPN5KjoCfMiF38AG7vNmaS0Ysvqe+VOQtYV/dcOnDfUDxhHT/Kf+VbxgnG6k+EXiY8DMkhclUd/pivcXlHzbNJH+ctmTnsCM6taFzHJWNB6p87SJO/rffBzxOkbpkXADJi4v/HdTUIB9JQwX01fuIuZxL2zOAki86Cnnjqi2d9oW1P9fgOErrylUXkBKtseP7nwUDrqPw6Yv1x+Dq/QJuKL8wCXh2Ue1fprP8WsfcOxfbV2qrM+Zb3YSBI7+53RLpN6fA== 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=VXmK9BSw2LnVeJCwFtAhl5CWNOAjs9JziBipnKDuuEs=; b=FXn7WDuhjaCtERu0P8c4QOQiFYV/N/17HnwcAb9VaQ+FOqyfSUi0CzBtqaUP3cnfUzeMgNveNwiT3FsejBZzVY+wXEoJBeIn3BhI+zG+/4d6DEwksRXa2Eg1iujH745UQH5N3GEt1MlbcDkr2HW1sVMzG8munH8OMEhGvFd6qXd8s+WRyqDBSaD1WajCcUupI8LtXSk8ZCKSxFmMAh+mJh3VXxFDnw/m1weNAlIlACMXzGvBkhYaSNbTO5vlA5Q4aMZ1ubzyVj6EUzzU5OMPcFzIckKl2tNsYF4zTeCYPnJLIJhoI8hsUW7tzyZA2/XsZsjaNyNRnbXbLMGOb2Lydg== Received: from VE1EUR01FT010.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::42) by VE1EUR01HT215.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::449) 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:16 +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:16 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:CDC6A4C26EDF0E10B7D985953EB18F53E510A10B8697F9A713EE4405209729AD; UpperCasedChecksum:1C150C66474D6E1FC848EA1D0DC5F9EA195B710BDD841B5D7CFF867D410BEF43; SizeAsReceived:7596; 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:16 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 May 2021 11:17:17 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [OlB82fxfHyxxCcVq+2bhnotu7KM36JJ8] 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-13-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:15 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: d105b13e-08bd-4559-c091-08d91c395dc3 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiSiYaxVAPXjtBLAGaAm06Ue5FPHl9akGyBRjIp4Sy7F7/xaUiGjUMecZdAGUXA6xdh7qOZIoEyUMpdwCZj4ylNlR1XYISV0utOEjng/skCdUJ9iL2U2SyQXvxu9arLl1L9EwzF1epN6cs5adNGdzOKhNrzgrYLp2Q46CAnMh3I2xbzKTVfJ7EEu5C7rBnUpR8J+43IK6XoztUTyGLhG5jAhKkZSuo97IOlM9A8y5ydZmBRE3GS+gVZPgIVJPRndhsRwNYMxJfUF53pGLOJOIYYw9CSYXeA+2AYhDmESWq8iQ02ZQRjvcOEgU8odAbSSweyxjz0bjUsKwcsO099pFgFQr3vYj1bqhkbFi8Ww+W3khU0ur9B0J+TbDIzFTjyZPBdlHtBGlGTdiLrLphVMheM3IB1dsiOh6LlJYn8hWUn17nKm+FUVuAUaDwYI/TyVIu5VMIqO/DQhS2g20OX0MIIz1FGn0P7eulRCZ33gdov8c3d4snDpBI1SUf2rwhWgc7ZK1lVQKh70vCN0yheEzBCF/7yMINVR1Tm9Lm1uYyu681xo0zsDsxtYw8ADdD+vmZmN0HFlRN/hWSy4hPumSifZs2e634BPfZDm04uS+YqXDtMb8Zu1aEudm6wBU4GA9iogSbA1/DjXcB+UbKB12YIcglILJh+tCCK/RvtdZGth2HFWXeENruWOzfBCkIy57LE3ahC8q2Q8u2/1O9zQfONiDwxqk+Yks1e5V4AR96VDSVzhVTOAECR5Gsnc6r+JmTE= X-MS-TrafficTypeDiagnostic: VE1EUR01HT215: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P6N2ke7HKxoCuyQ3xlwFZFP3OBEWFyukZBJoiEWL91FAfEAsaeqT1KblztOakViJn2a00hvNd4I2tia6IOjuw1hjReiBuclZ8nRvKlWxk6uR9fggBsax/ccL1Rj93hYONzQRDvzioOlrn+QvHbowVCmbeWr1aYZYznJoARO3Rxfl+X6HCQLRVgFam8gLVtQYPlsc0Yi4xGLJ13nyuVIRUxGla6U6BtswCJ1POwG5ERjs7trRHOeWERQMXYjO2z205CN6X4oTkjRLul4IvpkiJLlsSDPgAt5emmEaVGWXjUCmQGuJpjvI9u0qBNgJHY1O2r25YPILjCQpdqRrI2iXnN10kMEyGPhBW8xYdkxB2zKpYiv9msTNZ8Hy4AWND9rA/AA8LvrS+i6fULgIxvgCyg== X-MS-Exchange-AntiSpam-MessageData: 69VqioKF3IIDYL6Vn51AIRI1iN4GKzBJS0vhQLlttMCqNR3B8NQHK8TL7q24P+sWnPo0XJYVxcxouW6s6FyCgj0FDUf+6+e1JuPqvSqH1DieJyBVBtQB9nQucKk+dLw09AoE7UevNvnUt2smCcKMQQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d105b13e-08bd-4559-c091-08d91c395dc3 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2021 09:18:16.3708 (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: VE1EUR01HT215 Subject: [FFmpeg-devel] [PATCH 14/39] avcodec/libwebpenc_animencoder: 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: omQE41oVj1Yb 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_animencoder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/libwebpenc_animencoder.c b/libavcodec/libwebpenc_animencoder.c index 5f0c6ba194..742aefb467 100644 --- a/libavcodec/libwebpenc_animencoder.c +++ b/libavcodec/libwebpenc_animencoder.c @@ -25,6 +25,7 @@ */ #include "config.h" +#include "encode.h" #include "libwebpenc_common.h" #include @@ -67,7 +68,7 @@ static int libwebp_anim_encode_frame(AVCodecContext *avctx, AVPacket *pkt, WebPData assembled_data = { 0 }; ret = WebPAnimEncoderAssemble(s->enc, &assembled_data); if (ret) { - ret = ff_alloc_packet2(avctx, pkt, assembled_data.size, assembled_data.size); + ret = ff_get_encode_buffer(avctx, pkt, assembled_data.size, 0); if (ret < 0) return ret; memcpy(pkt->data, assembled_data.bytes, assembled_data.size); @@ -136,11 +137,11 @@ const AVCodec ff_libwebp_anim_encoder = { .long_name = NULL_IF_CONFIG_SMALL("libwebp WebP image"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_WEBP, + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, .priv_data_size = sizeof(LibWebPAnimContext), .init = libwebp_anim_encode_init, .encode2 = libwebp_anim_encode_frame, .close = libwebp_anim_encode_close, - .capabilities = AV_CODEC_CAP_DELAY, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB32, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,