From patchwork Thu May 16 22:30:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 13167 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 083A2449AEB for ; Fri, 17 May 2019 01:49:52 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CEA4768A4C7; Fri, 17 May 2019 01:49:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 190EA68A3F2 for ; Fri, 17 May 2019 01:49:49 +0300 (EEST) Received: by mail-wm1-f67.google.com with SMTP id j187so8030064wma.1 for ; Thu, 16 May 2019 15:49:49 -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=u/TVo+29hKroArDOvhYGvmONgNQ0+btFoqfSrpnVNYc=; b=MwCEDkmbH0vpyEcY0QIPvJmD6hEc5T0vpOiKsbdN6HWrRagou8jaZYDLRgR3eswDW2 UpqRcnwXWOn5Mzh3jb4iaudP+7HQHZY/bidQwu7xDRXlmY2GJmQGjyvy6UCihNAHnI3r hRzBUiaTtrtZHm7ohRFVQuHk8XZrLEVySFhfOagOM9eMJGQT50lSnXJNXvS2Eh1JIn1M MCfULcvL33bRQBGN2Cpg9HZYouA2+EAvM/yaIQSuIM4cb1INmGlDLfUc2eiNH9sGE3xO Fmvef6mtH7RRwY6TqrzRna5VAnLzI2tNMlbKt2VVPMzT8d6/bE4/GlNpibI513To1huE YOfw== 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=u/TVo+29hKroArDOvhYGvmONgNQ0+btFoqfSrpnVNYc=; b=j7X8RjBWDXab3v45Hbb+OaWO0rPsfa6DdDMWmIyggytZXOLJwBmz19E1PTs8GIG9m5 2qpaHYE6Txh2w2tsl4wHgy4z9gzYyqJZU3jNTuAttVHK18TonKr8RLz41/NIdcCEKgTB 5rigTkOrwYdqWr4HLCkA9a5iV7q34N5kiw7H2x7oEfTNjguyx4omU+zy1IsjPS7Q5uGM 9ZNtjgCkM5K05oSSQrwpStRNpmeW3DSZRt7924fU0cA0CrM8IvLCVkxGth0DYV/hX/2e jKEDyi5rvm/PxUSKhPj6nw6MrtiV6BTJs6fkg/8y25UsCTb3eNQ39TvnvAKm2LAtVScz 0Q5A== X-Gm-Message-State: APjAAAUoENNpLEOnUcs14FQ0pTHAB0xpCaF8vqRg9kdxHX62IdsHBY8/ 7+9ADeCBWrR5m1BxS516TFWGMv1s X-Google-Smtp-Source: APXvYqyjav4gSG3cEYlUWAayid5yCkhbZh4Gyb9E+P6cy0qeia4DC2OLkd4CFjbplwV2VhAbKRM44A== X-Received: by 2002:a7b:c7d5:: with SMTP id z21mr23064019wmk.56.1558046596638; Thu, 16 May 2019 15:43:16 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 15:43:16 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 May 2019 00:30:02 +0200 Message-Id: <20190516223018.30827-19-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 18/37] avformat/matroskadec: Add function to reset status 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" This function will be useful later to reset the status (e.g. current level and the already parsed id). Signed-off-by: Andreas Rheinhardt --- This function is not used yet, so compilation will likely result in a warning because of an unused function. This will be fixed with the next commit. Splitting this into two commits is a suggestion by Steve. libavformat/matroskadec.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index b14f168c2c..4e81108dbe 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -739,6 +739,25 @@ static const char *const matroska_doctypes[] = { "matroska", "webm" }; static int matroska_read_close(AVFormatContext *s); +/* + * This function prepares the status for parsing of level 1 elements. + */ +static int matroska_reset_status(MatroskaDemuxContext *matroska, + uint32_t id, int64_t position) +{ + if (position >= 0) { + int err = avio_seek(matroska->ctx->pb, position, SEEK_SET); + if (err < 0) + return err; + } + + matroska->current_id = id; + matroska->num_levels = 1; + matroska->current_cluster.pos = 0; + + return 0; +} + static int matroska_resync(MatroskaDemuxContext *matroska, int64_t last_pos) { AVIOContext *pb = matroska->ctx->pb;