From patchwork Mon Jun 1 13:35:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 20054 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 DCE4244B6B6 for ; Mon, 1 Jun 2020 16:35:30 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA8CB689AB3; Mon, 1 Jun 2020 16:35:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F2857680415 for ; Mon, 1 Jun 2020 16:35:23 +0300 (EEST) Received: by mail-qt1-f175.google.com with SMTP id e16so7667085qtg.0 for ; Mon, 01 Jun 2020 06:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YVFduDvD/OKdGOXarEEP7YpSOam7WzrDcohcBcE72lo=; b=fUlf565zn6yi4K1gcVfOxQFvsJYBHAywU/SO8P+OeMLBQk8geTIj/s3xpcfMDqchIY rie+LjrxRTJAMYEdu5gyQbLyBmplJ59Hinlg+zzOnCbYTmOtpLsdxj9pMBOHAes4mMmX foMUhU5iWEWDcI6vm71IE1eqtbQvdgf6+S9064vhBCbNSO+QlHcU+glqBC7f6zrbYWlY gauuwjww673POKChYgRsApyQNp3Qk+DBZ1EkTXVtdTWLALMqb/Nldp9lfQ2BlwMPTcL4 sSihKpok2hjrULK7oMkGc4y0MFoY1nMEXBwBDJ7yNqNdW4VL4+TlBnfXvhgN2LIe2NuS Olhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YVFduDvD/OKdGOXarEEP7YpSOam7WzrDcohcBcE72lo=; b=pwAbCF4R+O/oluyJW5W1H/HxQn/kSdgzp1ZHDfJoyxmWM0eIaS7grP4pkUiZR+1umz oTyLdOlLor5haT+20YDLwYU6SWVaz9ZHxOik3P23cz0mocNzgYYtPcqDVIkAkTT/whA0 JsJ2Vijye8GLA6icdEu7DcH8lKgKFTGbUpsksiv2PYlnD5Sso6dPK4bV2G0LJDPDSP00 4IeVbnUmH6eeKVRJRofokb6QrYiS18eOOKN3UmlhY3BzLTxd1G3m9mbClt7u+ojjz8KC LNjVmWJQ7ZnqMNECBSzs0HycjdNJdjc9kArm7JbRKfo3NYXp4nI8UgZUuMZnWRh1rJKO Smcg== X-Gm-Message-State: AOAM530ZEWIgZk8DNyHUBnvmxKZETjugQYR52hiF7+xnyUi49TFnVz+k d46veBqYpPiFBQF2GghkHgY5lcZw X-Google-Smtp-Source: ABdhPJz+wTw/25Ka7eZyO+udJt+0SUU1dileFIBe2DmZwJWrdW5tF2vcI+Bgq81f2oArf7Wa5B8Uig== X-Received: by 2002:aed:3fb4:: with SMTP id s49mr22572845qth.16.1591018522078; Mon, 01 Jun 2020 06:35:22 -0700 (PDT) Received: from localhost.localdomain ([181.23.72.208]) by smtp.gmail.com with ESMTPSA id d140sm13584055qkc.22.2020.06.01.06.35.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 06:35:21 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Jun 2020 10:35:07 -0300 Message-Id: <20200601133508.1795-1-jamrial@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avutil/buffer: use the default allocator if none is provided to av_buffer_pool_init2() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- doc/APIchanges | 3 +++ libavutil/buffer.c | 3 +++ libavutil/version.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index fb5534b5f5..c7e4ce3e6a 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2020-06-xx - xxxxxxxxxx - lavu 56.50.100 - buffer.h + Passing NULL as alloc argument to av_buffer_pool_init2() is now allowed. + 2020-xx-xx - xxxxxxxxxx - lavc 58.88.100 - avcodec.h codec.h Move AVCodec-related public API to new header codec.h. diff --git a/libavutil/buffer.c b/libavutil/buffer.c index 6d9cb7428e..b43cd179d7 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -229,6 +229,7 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque, pool->size = size; pool->opaque = opaque; pool->alloc2 = alloc; + pool->alloc = av_buffer_alloc; // fallback pool->pool_free = pool_free; atomic_init(&pool->refcount, 1); @@ -310,6 +311,8 @@ static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool) BufferPoolEntry *buf; AVBufferRef *ret; + av_assert0(pool->alloc || pool->alloc2); + ret = pool->alloc2 ? pool->alloc2(pool->opaque, pool->size) : pool->alloc(pool->size); if (!ret) diff --git a/libavutil/version.h b/libavutil/version.h index 7acecf5a97..5d5cec62ab 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 49 +#define LIBAVUTIL_VERSION_MINOR 50 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ From patchwork Mon Jun 1 13:35:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 20055 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 67F8544AFC0 for ; Mon, 1 Jun 2020 16:41:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3FC35688200; Mon, 1 Jun 2020 16:41:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A061568048E for ; Mon, 1 Jun 2020 16:41:29 +0300 (EEST) Received: by mail-qk1-f194.google.com with SMTP id s1so8989394qkf.9 for ; Mon, 01 Jun 2020 06:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Z8MKGKJniFMiQAPt46kkgG/RtSFMDwM0sVDcnx+0Zfc=; b=tZld82TBlbCrEdQ5tFI0XkvMi81RfufMeFKiHrZy5mI/JMCMM/lucjdrjIx/fiQp59 W3+Khl5ZUnuPIUDVGRc3Ct6OkV65isuuLMkvICRXQ1KoemwLTlU5Os0L3SAjuJRYSY+u /kEaJFED/7VqH6WZedWQADPDdwEjPWsXIGNowxDkihzidOF+AGo8T9eRcpijwRIYhjQt miDsL48kgAM87HKE8iRgOZtSnuOcmAtYhixNSfPlud+FrQJR55IsY/PpXlkvDOemfpj1 P3ai9T0UTVrMOnt5/gRQycoZeWwcpFaDWkakXlcp0jlyfduEdSgCDQBbeW9U0HtBQid/ YUXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z8MKGKJniFMiQAPt46kkgG/RtSFMDwM0sVDcnx+0Zfc=; b=WJdC2xFiT09TAM/Pg8A7xCjvUXa0B2cio1AWECEs+fQdfip//3fcjZdYpKdJU9ULcK 6U1Ny0qkbe0rjVV2hLHZLlZ77TaMV8du1oLmDyTBAvov7v2XHntAd5KPWIPvZHOtkgdt /YLaWBkaj93g4jVHMbj8d6r/eK61Qk18eaLLhLMlmMBVHtkD96zNjxXI09hCX59ZuI6S lIJqznsGuSCveg7RCMxt3JBqqs9Wg98NktKICUbd13gVXcADwrIzYqw8L36JKksODTqI mRe5Zy4oV1s/5Ui5630+KzNcN5kXrB6+QwFEEZLLbtKWdZq/iNVEHLAORacy2zRD+EQE 7lEw== X-Gm-Message-State: AOAM530Xezx0Sbe3t7BzXm6X2XY82GBfch4VNHTJ2SeNpllcsF0QPdPr N3TwR88Ppeg4mBVUGr6z5Kg1i7V/ X-Google-Smtp-Source: ABdhPJys6qBsm0UEVADlOz52J5nNTKM4lWZXuhF77ItalKgD6UXa2UeQYQl4+gLoSAO0F3QzPSEX3A== X-Received: by 2002:ae9:f40b:: with SMTP id y11mr20107818qkl.107.1591018523625; Mon, 01 Jun 2020 06:35:23 -0700 (PDT) Received: from localhost.localdomain ([181.23.72.208]) by smtp.gmail.com with ESMTPSA id d140sm13584055qkc.22.2020.06.01.06.35.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 06:35:22 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Jun 2020 10:35:08 -0300 Message-Id: <20200601133508.1795-2-jamrial@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601133508.1795-1-jamrial@gmail.com> References: <20200601133508.1795-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2 v2] avutil/buffer: avutil/buffer: add a mention that some arguments from av_buffer_pool_init2() may be NULL 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- libavutil/buffer.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavutil/buffer.h b/libavutil/buffer.h index e0f94314f4..c0f3f6cc9a 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -254,12 +254,13 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); * @param size size of each buffer in this pool * @param opaque arbitrary user data used by the allocator * @param alloc a function that will be used to allocate new buffers when the - * pool is empty. + * pool is empty. May be NULL, then the default allocator will be + * used (av_buffer_alloc()). * @param pool_free a function that will be called immediately before the pool * is freed. I.e. after av_buffer_pool_uninit() is called * by the caller and all the frames are returned to the pool * and freed. It is intended to uninitialize the user opaque - * data. + * data. May be NULL. * @return newly created buffer pool on success, NULL on error. */ AVBufferPool *av_buffer_pool_init2(int size, void *opaque,