From patchwork Sat May 30 16:05:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20009 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 6FB1844A43F for ; Sat, 30 May 2020 19:09:52 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 06BD368B0D6; Sat, 30 May 2020 19:06:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AFA6B68AEEB for ; Sat, 30 May 2020 19:06:37 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id j10so7159830wrw.8 for ; Sat, 30 May 2020 09:06:37 -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=4kFEXqhLclpN3pCkCYpulyhW8n8IrgwL3Ex4Y8yRYiQ=; b=D6Oom1dwBOBo+/Ns2dp0KQFCkepkBmH4yyLiLI/ByaB12ZzNSQi1G12eZhF96yWCsS tDnLffMigkXTSfPKJaHPhMZA57mS/t4h1GBbSjFYosDxkEQJFv5w47B0U3XNmvCvGA1p BqRNiIOinHof0F6yWuN9MfhaRfdn8vKZIlIhvISdcidREkFDEt7tZ+0dfP1qcCf52q8P AW11jxPzSwSRhNKWWOhLeuReNV1zRlf2IBqffbsZDUVt188/0f5Gb3QwTGcQgBq/nj/6 jEEtMwfzcmWvhUN2Zfaf7LFFulrMyUA7vRMFbiLzDIdHMcp8TBUeXuxMLAOU20nzTszT yg4A== 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=4kFEXqhLclpN3pCkCYpulyhW8n8IrgwL3Ex4Y8yRYiQ=; b=XKMlSiDmyeiTHlj6dMrrxU3aqrGuLlbWdZKmuBPjgNT7f57e10V7cQjoY2uBqwKsTY PzyWscXGb65m3LhoMeKYEe+IzlX/22j2fWgr737HEVt2dZ7119Xd5QxFvyhK5l8OvhMy RXs9A3/VlwmmGn17FweHGvsVcdqwVvtDYcMSCI7soOePNMA13UC2dxCe6OOFiMR8m8EO bukceIKCz0O7tSJSPO1ottyvu57AqNCO9bj50t2PrqDWy/fH4SVTpFO0UJRhfd9jGHdP xHUsjKwLhF6M/jZeSYuxceM2hB4nEU6TkBiTG75z/glmjvLUYUtvZyba9VZrIX1kGuSP I2eg== X-Gm-Message-State: AOAM530Uo9DcNTNYKEGrNveMATly1dXKxBmNQcH/DTPLcuJmBxStJl8H 1tjIFkAGHqDL+w8/v+NRD0T/7zXX X-Google-Smtp-Source: ABdhPJwQEkKVzln8lZtZ0Pv/WdX0tVOdyY6cxgS56WkeZR1LtX1zScF3MchzAm2TfOTuabyxaiV1GQ== X-Received: by 2002:adf:a283:: with SMTP id s3mr13039868wra.147.1590854796782; Sat, 30 May 2020 09:06:36 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id v27sm15186517wrv.81.2020.05.30.09.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 May 2020 09:06:36 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 30 May 2020 18:05:26 +0200 Message-Id: <20200530160541.29517-21-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200530160541.29517-1-andreas.rheinhardt@gmail.com> References: <20200530160541.29517-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 21/36] avcodec/hevc_mp4toannexb_bsf: Reindent after last commit 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" While just at it, use a smaller scope for a loop counter. Signed-off-by: Andreas Rheinhardt --- libavcodec/hevc_mp4toannexb_bsf.c | 45 +++++++++++++++---------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c index 3776d5b279..731ff2e7d3 100644 --- a/libavcodec/hevc_mp4toannexb_bsf.c +++ b/libavcodec/hevc_mp4toannexb_bsf.c @@ -121,8 +121,7 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) HEVCBSFContext *s = ctx->priv_data; PutByteContext pb; AVPacket *in; - - int i, ret = 0; + int ret; ret = ff_bsf_get_packet(ctx, &in); if (ret < 0) @@ -139,32 +138,32 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) uint64_t out_size = 0; int got_irap = 0; - bytestream2_init(&gb, in->data, in->size); + bytestream2_init(&gb, in->data, in->size); - while (bytestream2_get_bytes_left(&gb)) { - uint32_t nalu_size = 0; - int nalu_type; + while (bytestream2_get_bytes_left(&gb)) { + uint32_t nalu_size = 0; + int nalu_type; int is_irap, add_extradata, extra_size; - if (bytestream2_get_bytes_left(&gb) < s->length_size) { - ret = AVERROR_INVALIDDATA; - goto fail; - } - for (i = 0; i < s->length_size; i++) - nalu_size = (nalu_size << 8) | bytestream2_get_byteu(&gb); + if (bytestream2_get_bytes_left(&gb) < s->length_size) { + ret = AVERROR_INVALIDDATA; + goto fail; + } + for (int i = 0; i < s->length_size; i++) + nalu_size = (nalu_size << 8) | bytestream2_get_byteu(&gb); - if (nalu_size < 2 || nalu_size > bytestream2_get_bytes_left(&gb)) { - ret = AVERROR_INVALIDDATA; - goto fail; - } + if (nalu_size < 2 || nalu_size > bytestream2_get_bytes_left(&gb)) { + ret = AVERROR_INVALIDDATA; + goto fail; + } - nalu_type = (bytestream2_peek_byteu(&gb) >> 1) & 0x3f; + nalu_type = (bytestream2_peek_byteu(&gb) >> 1) & 0x3f; - /* prepend extradata to IRAP frames */ - is_irap = nalu_type >= 16 && nalu_type <= 23; - add_extradata = is_irap && !got_irap; - extra_size = add_extradata * ctx->par_out->extradata_size; - got_irap |= is_irap; + /* prepend extradata to IRAP frames */ + is_irap = nalu_type >= 16 && nalu_type <= 23; + add_extradata = is_irap && !got_irap; + extra_size = add_extradata * ctx->par_out->extradata_size; + got_irap |= is_irap; if (!pass) { out_size += extra_size + 4ULL + nalu_size; @@ -175,7 +174,7 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) bytestream2_put_be32u(&pb, 1); bytestream2_copy_bufferu(&pb, &gb, nalu_size); } - } + } if (!pass) { if (out_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {