From patchwork Wed Mar 27 11:18:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhupengfei via ffmpeg-devel X-Patchwork-Id: 12477 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 C06AB448DC9 for ; Wed, 27 Mar 2019 13:21:20 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AEE2B68A92D; Wed, 27 Mar 2019 13:21:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2C4F168A716 for ; Wed, 27 Mar 2019 13:21:17 +0200 (EET) Received: by mail-wr1-f65.google.com with SMTP id g3so14591054wrx.9 for ; Wed, 27 Mar 2019 04:21:17 -0700 (PDT) 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=sbW4h/cmWOxIJtedFXhTguA4wie+k2EhGWCmCy1DPSg=; b=IdfR+GYvBXgh8FkkDBZnTwjC5vNlLRiwsYEVjwYv092BM9gIGqkInRi4NkGCrdSj9e jpM64ZKpMO0n4p8r7PrQ2u+DANcNo+Gcfzf4J8eDSwXnEgZan4gKYkHA7F97bVnAuXuk KS6jEX5YqYrvYuoimjSNCopmZLsZPKoB8/AGKTY73d/EEJHHwfxv58DP4is+uxyu8RpO xYXK7+ZO6R3tmBv6tPyWZ5abLslfrzyyW40w+nYzJIGwLVlUEng0aWKHPmjVDRMNmGDD i6+izG9xmPQOmUUnzEuS2FNXb7QRzGqMgHHyshK6xh72zJ9/uIMaH3pj63TyIHAy+Ro0 Muag== X-Gm-Message-State: APjAAAXSaCmOruxCpqQcnVXQS9A0lU5KLSl7Ksjj4q2Mes4SbJZ/IQcO zG3m59rbHi046nyJnI8Y4DPrY72auw0= X-Google-Smtp-Source: APXvYqxi+YoiHJEh3xGkiX3bv0ANzu5gwt3UMcD6AGwQjArqS9TY6yIjUF622SqOr+IYU9i0eY6eLQ== X-Received: by 2002:a05:6000:1152:: with SMTP id d18mr23345488wrx.32.1553685676418; Wed, 27 Mar 2019 04:21:16 -0700 (PDT) Received: from localhost.localdomain (ipbcc08c44.dynamic.kabel-deutschland.de. [188.192.140.68]) by smtp.googlemail.com with ESMTPSA id h10sm31745448wrs.27.2019.03.27.04.21.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Mar 2019 04:21:15 -0700 (PDT) To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2019 12:18:42 +0100 Message-Id: <20190327111852.3784-12-andreas.rheinhardt@googlemail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190327111852.3784-1-andreas.rheinhardt@googlemail.com> References: <20190308092604.3752-1-andreas.rheinhardt@googlemail.com> <20190327111852.3784-1-andreas.rheinhardt@googlemail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/21] 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: , X-Patchwork-Original-From: Andreas Rheinhardt via ffmpeg-devel From: zhupengfei via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt , robux4@ycbcr.xyz 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 997c96d78f..b98e690f01 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -79,7 +79,6 @@ typedef enum { EBML_BIN, EBML_NEST, EBML_LEVEL1, - EBML_PASS, EBML_STOP, EBML_SINT, EBML_TYPE_COUNT @@ -694,7 +693,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 } }, @@ -706,7 +704,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 }, @@ -1169,7 +1167,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; @@ -1225,8 +1223,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: