From patchwork Wed Jan 1 00:58:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 17098 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a05:6214:1865:0:0:0:0 with SMTP id eh5csp216928qvb; Tue, 31 Dec 2019 16:59:39 -0800 (PST) X-Google-Smtp-Source: APXvYqzgP8e6eN33uCxQyoKQ8OHYb4u91hzUYJP/oADkWmGPBaVeM8zvYzS6ZbKyerDS+SozBR1B X-Received: by 2002:a17:907:10da:: with SMTP id rv26mr77106087ejb.242.1577840379524; Tue, 31 Dec 2019 16:59:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577840379; cv=none; d=google.com; s=arc-20160816; b=KxpENjMzoxbY9NVd7cBYSgXosBHNk3rc1pU4VspmdOLlC8ZXxVzgVF555B4JX66pGp 0wJiAStcySslnB4s6lJSSU4SgEP2kumbpqDitLynB0dNPyTMsaGvsoXO87dfArcvlybe hW29OblWTyfprTKVoh8mkwyIsdAoWwSwsXc8CxXo6zMrjnTSloAzMSiaMOQscChEoQ8E n7/6Fz2+hWm8G8nTGMCjjcAnO+pHqteAQ6VLqBXd25Ohmlr7s9LzDVqpEoRKKRmv7gHr Zf2t5L9KB3ch9/81au8LpOWBlUMZVtAQq9U2bdnEPxIMiepv7a3sP8vBFBkTFPWg3FtF HL8A== 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=e1aE83mMiYZUm6lIlVly1fg8A90C1JwvJ3txBnAnCkE=; b=A/pFoFCWix/WJHasqkB75vG+ibLAaTFQqwJWCnf4u9ABdqcRUMNDYU52GAH+eClQwC Uw2Md4hO7u2wCKODB5TTd1ExlVCcO3U7B2xsF9OWvSklV2wjgoe7FRQPcmU5/tSteRfb iIsv/7wYMqGCNnJqescJyFcT2cs7Kcr584bJpJCX2Cva7/BQUmGpcWpowVpjEecznZxx ZSoRg235fBaGLEzuLAy8RuoJjfhglVsTycnE65ThFZS4HEE6doWIR0N/764fMRkuU5RL sNtm8inOernJzFVfRiYyIyjfdvIHUcj/vGuyjTw5URoEnRZ8eJHdlDIyDkYjiTx57IjG knAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=RsTqa1Mg; 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: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id rv11si32671548ejb.407.2019.12.31.16.59.39; Tue, 31 Dec 2019 16:59:39 -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=RsTqa1Mg; 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 71F0768AD82; Wed, 1 Jan 2020 02:59:13 +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 BE4DF68AC9E for ; Wed, 1 Jan 2020 02:59:04 +0200 (EET) Received: by mail-wr1-f68.google.com with SMTP id d16so36206613wre.10 for ; Tue, 31 Dec 2019 16:59:04 -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=Oi2iMvlJzNdP3AiR+VuXwV+NP98qzA5vRj/7oMOJbNg=; b=RsTqa1MgHvPdi2g/tZ4LfO4m3gmnwiw1A1uFKnMEH81URyGX9CB6BlhIT2IsnQx1AQ f8DHyYcfNASTh6XwGQ1BE15anjF6muSBLVBnQTK+UNLvEF4ihklinPLmkh3EkhGI2RAN MKuLUgUZZYDxb3XwyiWXSAXVKjIPUCdy3IZx75YQTemkiFwJvs7t4Zn/y/SjcIwWeU1Y fwbbw/1XCfE/z/WK9RwTW8673fE4iH9p0NhBCyOM7/51DXgtkfi46ViMRz4HISYc+9ls OoQZb/ML0BO6BUk2/q+kUpUzvQbUbCIYM35RFBGS0lINaPXEfaRxb6GosVd2xeZvvb6P rCZg== 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=Oi2iMvlJzNdP3AiR+VuXwV+NP98qzA5vRj/7oMOJbNg=; b=KWhAf0+6tcqOLwXymfed9v/KSI36mefg+gkh48UBREeCYFFL/rMk4dV82DgVURt+xc FI5FGt/DUg6vc3CxOSrpXUCnPutS5THB9bhT9xEiU4s0ZMOo+CoYrZKAqdc1TMRENmSG rZOsuKWvuubwz4IhrIetnKn5MJCJGAp6BTJT0tamCSED4/AZ1KDyOd2otl+QdRo2n4i8 SJHG9KPvfyN/0A0cA7DX9wKzO0C3iG+kK/4MK1I6u6xf72onXaDGMuikpqdSt65KAD0N YMVdv2fK+bgQhBs5Pm1SmTj5xTIc15kZTU5KSLy6g02rgEaW6tuI62DxwxQyIs5f8/F9 BydQ== X-Gm-Message-State: APjAAAVHxqlSL4El9ZguAv6lb4uOuf8gNlYUHn3gz1lKCQzmSKHuwO2J 5ZyhRGnpzwXSaVQW8TaSjPLscJc6 X-Received: by 2002:adf:f18b:: with SMTP id h11mr71399037wro.56.1577840344105; Tue, 31 Dec 2019 16:59:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Dec 2019 16:59:03 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 1 Jan 2020 01:58:21 +0100 Message-Id: <20200101005837.11356-5-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 04/20] 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" X-TUID: BeZahjDP169/ Content-Length: 2781 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 d51c8cbebf..76c38b8d09 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -218,7 +218,7 @@ static int ebml_num_size(uint64_t num) * 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) { @@ -228,10 +228,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;