From patchwork Wed Nov 27 07:48:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 16439 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 E1B8B44ACB4 for ; Wed, 27 Nov 2019 09:49:14 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B721F68B0A3; Wed, 27 Nov 2019 09:49:14 +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 6B83368AF81 for ; Wed, 27 Nov 2019 09:49:08 +0200 (EET) Received: by mail-wr1-f68.google.com with SMTP id y11so22331683wrt.6 for ; Tue, 26 Nov 2019 23:49:08 -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=EQWrJt29fUMOlNwWFzw6ezKfV3avhQ/Mc//31/0ekU0=; b=jOIfRhw3iztluskpDzKK/BKTAgFB3VvpSopIWPIgy9MqIZr2X2GpYsjG0vHRBvA1Wj Rl8mrmkulR2jnZwIdlGE02ftpRLnCr62nD2F1j5HbvCneVMsU+bJGCNPJHX9cCZywcdT tcnwQXMJ2Hi14gul/zXN9ZbZbEN9BcfTtt/tFaQ4whZHWqr+ov/2Mzx9cIc0awDvfJa6 OAeoxRn/C9KlTT9YFLrzBZdSUu3VXjS8xpxC9RztZxNrsYHrnuZD/CrSNkXNx4lE+pf7 z4gkaK1/4w8MDVhBeWHyTHqov5vB5ado+nO1iQg/gchBaeB9NmPcDUN/SZ1yS2jOgOcj SeoA== 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=EQWrJt29fUMOlNwWFzw6ezKfV3avhQ/Mc//31/0ekU0=; b=H6ZBJFVf6w86Ko63i1HsU/Jm4PSDl1BbgMNr+YIn54McFS3Zq92bOxstu3SQ9q62s4 UTlxpqL33cdbxh4JpefX1zKq/LaUIrupLj0UBb8vkoBuaanhtMJ1UtMtpz2+YiyaWasR jjuAEpVyCAxJbIx/0IzG87gHgkodZoI5vqr3Og0klPxb3++1NsbG7LkA8tO3D3nZK6es nXDosBmlgPXpuPp+HMV8IrRZs1l/wWNR1KGVrZDlEk8VaFXkV57V+9xSuM279Q69AA/k H2fVup1+olqBPQsM/cpO+jmpMC1gIHJgNOZiN0yn9IjTlenFKdmPbjRHheVHFCBZLPDA Ligg== X-Gm-Message-State: APjAAAVFco6DJm/BtIGv179mYNsDQe+NVA4mNX635xqYjiYXTjwLPnMW YORVsksDn22rXrJtvfJtSq061DmK X-Google-Smtp-Source: APXvYqxH8CAYzmFqKraTgXvvSONAUf/ZQtDJx/OxPIkQygAtUaA0vQ1cTBgy69YvQG64pOsI9RdyJg== X-Received: by 2002:adf:dd4d:: with SMTP id u13mr22556908wrm.394.1574840947811; Tue, 26 Nov 2019 23:49:07 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08e23.dynamic.kabel-deutschland.de. [188.192.142.35]) by smtp.gmail.com with ESMTPSA id n16sm4230831wro.88.2019.11.26.23.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 23:49:07 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Nov 2019 08:48:54 +0100 Message-Id: <20191127074858.32066-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191106024922.19228-1-andreas.rheinhardt@gmail.com> References: <20191106024922.19228-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 25/29] avformat/matroskaenc: Adapt documentation of put_ebml_num 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" to its actual behaviour: That it uses the least amount of bytes unless overridden. The current documentation leaves it undefined how many bytes will be used when no number to use has been given explicitly. But several estimates (used to write EBML Master elements with a small length field) require this number to be the least amount of bytes to work. Therefore change the documentation; and remove a comment about writing length fields indicating "unkown length". It has been outdated since 0580a122. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 4589e25707..43966a4378 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -221,7 +221,7 @@ static void put_ebml_uid(AVIOContext *pb, uint32_t elementid, uint64_t uid) * Write a number in EBML variable length format. * * @param bytes The number of bytes that need to be used to write the number. - * If zero, any number of bytes can be used. + * If zero, the minimal number of bytes will be used. */ static void put_ebml_num(AVIOContext *pb, uint64_t num, int bytes) { @@ -231,10 +231,9 @@ static void put_ebml_num(AVIOContext *pb, uint64_t num, int bytes) av_assert0(num < (1ULL << 56) - 1); if (bytes == 0) - // don't care how many bytes are used, so use the min bytes = needed_bytes; - // the bytes needed to write the given size would exceed the bytes - // that we need to use, so write unknown size. This shouldn't happen. + // The bytes needed to write the given size must not exceed + // the bytes that we ought to use. av_assert0(bytes >= needed_bytes); num |= 1ULL << bytes * 7;