Message ID | 20200101005837.11356-14-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Headers | show
Delivered-To: andriy.gelman@gmail.com Received: by 2002:a05:6214:1865:0:0:0:0 with SMTP id eh5csp217899qvb; Tue, 31 Dec 2019 17:00:24 -0800 (PST) X-Google-Smtp-Source: APXvYqzLuldVPfiJxyvHwxSjHc+wWF6wQg1EqqgL/8R1q5G7n2BqGTJxKuVaPJ3cqjkI8HzMpk4k X-Received: by 2002:a05:6402:17cf:: with SMTP id s15mr78899018edy.189.1577840423969; Tue, 31 Dec 2019 17:00:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577840423; cv=none; d=google.com; s=arc-20160816; b=m89sPRjZbbz0YB5MwCNuVOb76R7lF4yVph45nK7bPt0cQuf2LbVLrPFd+WVbOE8+JS sztxmem2mK75T1+CLlNUtB/NqiY2rzqvXLxxWioSqCMe1snqJQ0c12ylRpMSwWCNKzSs 9thLeXdxUB0FuW8SRdKTV6MqZFrwhN0JUbT7CoQQS0db6Q0+g0kNyR8d2O3IbKxh6DPT ODQ1z8PwxmggxQRjqBKuJjcMpIEGUyqYyjkIj31pAOFgsbCMIpThf8ga661E8NM/P5cb mOdqIas2aMNsEyFhjB4MNl1v6RqXsgAZStFtMoQoZw4/RW2P2bnpBJZ8YqBf6KsRtpgu bogw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=viPklEqNZaiTzIApNN8EheukLDntrcGdNkRVSsnPR1Q=; b=Zq6iw41jH8EejyKYNlKwPl1sjk0rOnBP0uSQmInmbK+s34V85/A4WpCYmfI5xVVaLS gXPr8ckm5jB3ojJoOI1KkLJ1DbkydRQcbIb9n/uVybxbN+/StDApnzQPAh2OCWps7tdF HRixxUgUh5XcTIktJ5I8FmFESMr/wFVHt7kwaKqVBK9DIFinyCvSYJL7di3T3rOQYn5d 7iG5KKM7tCP+nSoHNQcz9L2P92/XDldZpful4WcG8LLJReXwqrSApy/Y0jYFNjkb8+MC 1o2W4VGDqFKbGnQzgJK/HHJiwS9/LD1BXCv6WhWjPCrBWXJdtTGvba/xoX5/JlIwV8Qn ZEMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=csjYQD7v; 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=gmail.com Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f19si32704552edq.319.2019.12.31.17.00.23; Tue, 31 Dec 2019 17:00:23 -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=@gmail.com header.s=20161025 header.b=csjYQD7v; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 80A7F68ADCD; Wed, 1 Jan 2020 02:59:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2274868AD10 for <ffmpeg-devel@ffmpeg.org>; Wed, 1 Jan 2020 02:59:12 +0200 (EET) Received: by mail-wr1-f68.google.com with SMTP id g17so36197903wro.2 for <ffmpeg-devel@ffmpeg.org>; Tue, 31 Dec 2019 16:59:12 -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=N7laOIV8gFlsOwgy7c1ecXcTqEabqSLIk/MPGTCcAMA=; b=csjYQD7vCe/2ikulckSJb/RYdt5rHbJjQpXJHUnCd2H9LPh3v2L7mg0sgkX9U0U+SQ YLruhUkU3ttM6l+6AxK9Gwg8/SXKisIwjgakEnjMbSHRRwdeK8IpxcwLHrcScuSD3/ZW nIVFGO59FOh0uxTD+LoPkcN1lwr0BVQeeaE3hotA+sesdklND6t0HShWvmjiTqtqjBSk pRVwtqyri2GWp1QgbM5uN5jcbq3a1t0zKcRn+vkzJj/v5lBRgUnOQiF9FK4dMtpQJqxb HSQtU+quHvhqH9agTlm/A6vHiIaANmV7khPSVwSYu19rAtkglUyThnnLZWn0Ap1y50g/ F9IQ== 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=N7laOIV8gFlsOwgy7c1ecXcTqEabqSLIk/MPGTCcAMA=; b=GLnt5np/J06rTeNaoKVqUcT7R3qySlh0eRnJ3PbuqVTlqJekH+ApKrrHUj8UtaSA5F 4mdVUwH6DH77CRby2StxtKxxFZBj8YU5LZ29894I2AokZCVyC8BlW7BLnntEnjmB2ihl xMmEVpcWJX6ZqwHAbnB70NHvnTlHD5S+WGkbz6aqJ9WpNw3OvkRqipElE1AGJcHazsRU MjaZZamN+SArWfQCoYhOWW0EooqWVd6OGghD/G+horBajMutQN0lPB6p3vX7K+DspP/4 omhvu6vYoQc/Iovky225YOMZJFUBGKP3Q5o2We1h/iO3nuu5Ew5ByWlrJRFKIkznPPAi e7uQ== X-Gm-Message-State: APjAAAUegDAOyDMntkjOFqbv8IkNvm8zQceDD1xEs7yLWRsJRdQionq/ yGJwBSqA760aHYHUBR8LGU2s39EY X-Received: by 2002:a5d:50ce:: with SMTP id f14mr74277813wrt.254.1577840351484; Tue, 31 Dec 2019 16:59:11 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08bbf.dynamic.kabel-deutschland.de. [188.192.139.191]) by smtp.gmail.com with ESMTPSA id w17sm52431655wrt.89.2019.12.31.16.59.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Dec 2019 16:59:10 -0800 (PST) From: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> To: ffmpeg-devel@ffmpeg.org Date: Wed, 1 Jan 2020 01:58:30 +0100 Message-Id: <20200101005837.11356-14-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200101005837.11356-1-andreas.rheinhardt@gmail.com> References: <20200101005837.11356-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 13/20] avformat/aviobuf: Add function to reset dynamic buffer X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Cc: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> X-TUID: iWdzDva3M4XI Content-Length: 3101 |
Series |
Matroska muxer patches
|
expand
|
Context | Check | Description |
---|---|---|
andriy/ffmpeg-patchwork | success | Make fate finished |
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index eb628ac493..c575df8035 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -171,6 +171,13 @@ int ffio_open_whitelist(AVIOContext **s, const char *url, int flags, */ int ffio_close_null_buf(AVIOContext *s); +/** + * Reset a dynamic buffer. + * + * Resets everything, but keeps the allocated buffer for later use. + */ +void ffio_reset_dyn_buf(AVIOContext *s); + /** * Free a dynamic buffer. * diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 70e1d2ca10..d44ee0fa35 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1461,6 +1461,17 @@ int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer) return d->size; } +void ffio_reset_dyn_buf(AVIOContext *s) +{ + DynBuffer *d = s->opaque; + int max_packet_size = s->max_packet_size; + + ffio_init_context(s, d->io_buffer, d->io_buffer_size, 1, d, NULL, + s->write_packet, s->seek); + s->max_packet_size = max_packet_size; + d->pos = d->size = 0; +} + int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) { DynBuffer *d;
Resetting a dynamic buffer means to keep the AVIOContext and the internal buffer used by the dynamic buffer. This is done in order to save (re)allocations when one has a workflow where one opens and closes dynamic buffers in sequence. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- This function might also be beneficial in the mpegts muxer when converting AAC to ADTS (currently a new dynamic buffer is opened for every packet) or in the nut muxer. Besides the application in this very patchset, there is another way that this can be used in the Matroska muxer: By not reallocating the buffer used for writing packets one can improve speed on platforms where realloc is slow (namely Windows). A patch for this comes soon. libavformat/avio_internal.h | 7 +++++++ libavformat/aviobuf.c | 11 +++++++++++ 2 files changed, 18 insertions(+)