From patchwork Thu May 16 22:30:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 13171 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 ED473449AF9 for ; Fri, 17 May 2019 01:50:05 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D64D768A56C; Fri, 17 May 2019 01:50:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BC07368A52D for ; Fri, 17 May 2019 01:50:03 +0300 (EEST) Received: by mail-wm1-f66.google.com with SMTP id 198so5122526wme.3 for ; Thu, 16 May 2019 15:50:03 -0700 (PDT) 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=UzKx6fpY1TIWaDmsmkfaefJ1zI/zv0lW2HI4DiwxLDA=; b=LVALHKsZID70eNcx2Wsoxp5rzJVwgt8eNoLNUkfbu4ps2zs5ERLkkMXU5ei9sdU9+0 dpWl9mC9+OrJvUfaHhkjYDliCMIz9qXoWR1ZD1BIaZhWICW23yi38WjIUvp1q9vT4Zl3 DlgOtPxd+oQUg1oVk/UUfm9cfjPzmfx2hcXlvmBG+9nED0a2Ew3dT6sMnmct94RajbR/ tWDw1kwIJ/25BA/h33nb2DclJ/BGA6OqKlkhFDl6dQR3ZXfs7YFHQvjLhH3RARD5dY57 kR5/mlw8+OBAMB+rhAJVWe33EfbVZ5dlR8p8JH6Ub48ujZu8SDaVmx9v6b7NOt55oCPd owbQ== 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=UzKx6fpY1TIWaDmsmkfaefJ1zI/zv0lW2HI4DiwxLDA=; b=rkratYK2YxtFVRM33QdUSuMx/MYePcgjuODxyq/ZWx5SAjAJZWg9JftG840zvbriLD rSh62uhJbqXySLvtu3y/IkfLeAaWWmIKg6bs8NmY+XI+7yTM+e/sCBbsr2Dol9afKcpq k8xr6rBXVvwvcxiq+TVVw3LTyBLqk7uHAIx8bmyxfdnatvu931x/wfe5E8+dyJmu8TwK R0lxOtRPNuXAni2+NMQupMhXIxEkQ9T6NxMNQBjHjWBxUiA0oRhFmkSqhfEyM1VXaQKV EnztfKelR54GG/kgU0pU1ZYPwnkmunLavt9ABPV/2sdA011X8T61WNCceZE3YRDrRXT5 Xu3Q== X-Gm-Message-State: APjAAAUj0HIJj50Bz1CZg3rVuhwaijsGZtdQtVEzblhyjIWvzSCqB0Qk PREdv5xPcIYB54XaElWz0rA/a5MV X-Google-Smtp-Source: APXvYqzNb6H9yPo/8qc5A90EARu4pHjsWQN+gHQFsClm5psesOAQpiXRNb2H+/OTJBNDlwOskvKlTQ== X-Received: by 2002:a1c:c54a:: with SMTP id v71mr24034725wmf.51.1558046595066; Thu, 16 May 2019 15:43:15 -0700 (PDT) Received: from localhost.localdomain (ipbcc18715.dynamic.kabel-deutschland.de. [188.193.135.21]) by smtp.gmail.com with ESMTPSA id i185sm11168725wmg.32.2019.05.16.15.43.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 15:43:14 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 May 2019 00:30:00 +0200 Message-Id: <20190516223018.30827-17-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190516223018.30827-1-andreas.rheinhardt@gmail.com> References: <20190516223018.30827-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 16/37] avformat/matroskadec: Treat SimpleBlock as EBML_BIN 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" Up until now, the SimpleBlock was treated specially: It basically had its own EBML category and it was also included in the BlockGroup EBML syntax (although a SimpleBlock must not exist in a BlockGroup according to the Matroska specifications). The latter fact also meant that a MatroskaBlock's buffer was always unreferenced twice. This has been changed: The type of a SimpleBlock is now an EBML_BIN. The only way in which SimpleBlocks are still different is that they share their associated structure with another unit (namely BlockGroup). This is also used to unref the block: It is always unreferenced via the BlockGroup syntax. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 380db55340..93bf72661c 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -81,7 +81,6 @@ typedef enum { EBML_BIN, EBML_NEST, EBML_LEVEL1, - EBML_PASS, EBML_STOP, EBML_SINT, EBML_TYPE_COUNT @@ -696,7 +695,6 @@ static const EbmlSyntax matroska_blockadditions[] = { static const EbmlSyntax matroska_blockgroup[] = { { MATROSKA_ID_BLOCK, EBML_BIN, 0, offsetof(MatroskaBlock, bin) }, { MATROSKA_ID_BLOCKADDITIONS, EBML_NEST, 0, 0, { .n = matroska_blockadditions} }, - { MATROSKA_ID_SIMPLEBLOCK, EBML_BIN, 0, offsetof(MatroskaBlock, bin) }, { MATROSKA_ID_BLOCKDURATION, EBML_UINT, 0, offsetof(MatroskaBlock, duration) }, { MATROSKA_ID_DISCARDPADDING, EBML_SINT, 0, offsetof(MatroskaBlock, discard_padding) }, { MATROSKA_ID_BLOCKREFERENCE, EBML_SINT, 0, offsetof(MatroskaBlock, reference), { .i = INT64_MIN } }, @@ -708,7 +706,7 @@ static const EbmlSyntax matroska_blockgroup[] = { static const EbmlSyntax matroska_cluster_parsing[] = { { MATROSKA_ID_CLUSTERTIMECODE, EBML_UINT, 0, offsetof(MatroskaCluster, timecode) }, { MATROSKA_ID_BLOCKGROUP, EBML_NEST, 0, 0, { .n = matroska_blockgroup } }, - { MATROSKA_ID_SIMPLEBLOCK, EBML_PASS, 0, 0, { .n = matroska_blockgroup } }, + { MATROSKA_ID_SIMPLEBLOCK, EBML_BIN, 0, offsetof(MatroskaBlock, bin) }, { MATROSKA_ID_CLUSTERPOSITION, EBML_NONE }, { MATROSKA_ID_CLUSTERPREVSIZE, EBML_NONE }, { MATROSKA_ID_INFO, EBML_NONE }, @@ -1179,7 +1177,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, list->nb_elem++; } - if (syntax->type != EBML_PASS && syntax->type != EBML_STOP) { + if (syntax->type != EBML_STOP) { matroska->current_id = 0; if ((res = ebml_read_length(matroska, pb, &length)) < 0) return res; @@ -1253,8 +1251,6 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, level1_elem->parsed = 1; } return ebml_parse_nest(matroska, syntax->def.n, data); - case EBML_PASS: - return ebml_parse_id(matroska, syntax->def.n, id, data); case EBML_STOP: return 1; default: