From patchwork Sun Oct 6 05:01:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 15524 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 6ED4E449159 for ; Sun, 6 Oct 2019 08:10:39 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5797F6809D1; Sun, 6 Oct 2019 08:10:39 +0300 (EEST) 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 6928A687F89 for ; Sun, 6 Oct 2019 08:10:32 +0300 (EEST) Received: by mail-wr1-f68.google.com with SMTP id b9so11465946wrs.0 for ; Sat, 05 Oct 2019 22:10:32 -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=fEo6OItPWddeVNAidUxWAnntnoyz0YeOVvocip/Uwck=; b=oFQnqLmUZCU4Lrv7Et4z8TisTUMC6TJfoOqcHEBIY6Pz2uAh5krY1SOKXGTFdGUwSr uuwKaC2UC7M5bABAqXGMY1pHgyTUOj5/CqGAiOz2UuuANLSn5aRjT7LVJODFlRno9ANp zY6G0k/r23VR3WJsMjr8grTkK5PQjnaAW3O+Ky6DpM9KmbuCakMFKizeZ+byNu6U+sfV 5+lRpfJPczAUqPhMk8N5FLkpcBfjm5IWjb1lj8667KMlrqxMxp2bAdK0rc8Y+CPV6d93 Cl4vtCUhVp8jqS0zfDZ2hE4gfcz1x9JgYgFkaTHVfz6Fo1nYtY7pD1RFH6pWbCrQLdXR FOTQ== 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=fEo6OItPWddeVNAidUxWAnntnoyz0YeOVvocip/Uwck=; b=ZMbjl6IJC/ZirQav494XZ/X0ffVs1paYPAMHPXcxP6k5PJCoKBX6pRv+56beY9sReP 5ceN4cM6AHj0ZXWnJ4VcCZR/jK8ZPhT9McGA/c94eIix1MiUCasy3FF1irFjuDH4Jq0D qFaJey6LDj/nOWaJw52XWWM6bsJpvtfTGFWjh3OaVGUbzvvFCN41vQQAeZe0UPpqYrfG RZmIM456iXf2mYYnOYtMdSLyADQnFDeu5gkHc4Lvp6WsX7qbea3hpHYVwvYXItCy8TW1 cWdDWfAyIrUPhZxoYvPbCMEIDlk04jCTPEMtpbQvvkrs+/JgN18ps3ZMi2BDvya3NH6+ gelA== X-Gm-Message-State: APjAAAXQPTG+ctupVI/Wjcts8LVJnv1FrTfhuvpKi4p5CuQn0r2h45ri XpuoDrNn7loclZFedFnr+L0XkP5Qd7A= X-Google-Smtp-Source: APXvYqzy2bo8Jp7Wl1Rd9UiiLqBGcbfjtBNtALH3bcbukczZ4kdn+/WQGVOenviW+uAsRsfPBctPJg== X-Received: by 2002:a5d:4a8a:: with SMTP id o10mr13127254wrq.201.1570338631699; Sat, 05 Oct 2019 22:10:31 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc08937.dynamic.kabel-deutschland.de. [188.192.137.55]) by smtp.gmail.com with ESMTPSA id s10sm18543014wmf.48.2019.10.05.22.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2019 22:10:31 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 6 Oct 2019 07:01:20 +0200 Message-Id: <20191006050120.26807-10-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191006050120.26807-1-andreas.rheinhardt@gmail.com> References: <20191006050120.26807-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/10] avcodec/flac_parser: Cosmetics 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" Signed-off-by: Andreas Rheinhardt --- libavcodec/flac_parser.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c index 7ff7683c2e..9280246af2 100644 --- a/libavcodec/flac_parser.c +++ b/libavcodec/flac_parser.c @@ -113,8 +113,8 @@ static int frame_header_is_valid(AVCodecContext *avctx, const uint8_t *buf, * This function is based on av_fifo_generic_read, which is why there is a comment * about a memory barrier for SMP. */ -static uint8_t* flac_fifo_read_wrap(FLACParseContext *fpc, int offset, int len, - uint8_t** wrap_buf, int* allocated_size) +static uint8_t *flac_fifo_read_wrap(FLACParseContext *fpc, int offset, int len, + uint8_t **wrap_buf, int *allocated_size) { AVFifoBuffer *f = fpc->fifo_buf; uint8_t *start = f->rptr + offset; @@ -153,7 +153,7 @@ static uint8_t* flac_fifo_read_wrap(FLACParseContext *fpc, int offset, int len, * A second call to flac_fifo_read (with new offset and len) should be called * to get the post-wrap buf if the returned len is less than the requested. **/ -static uint8_t* flac_fifo_read(FLACParseContext *fpc, int offset, int *len) +static uint8_t *flac_fifo_read(FLACParseContext *fpc, int offset, int *len) { AVFifoBuffer *f = fpc->fifo_buf; uint8_t *start = f->rptr + offset; @@ -189,8 +189,8 @@ static int find_headers_search_validate(FLACParseContext *fpc, int offset) "couldn't allocate FLACHeaderMarker\n"); return AVERROR(ENOMEM); } - (*end_handle)->fi = fi; - (*end_handle)->offset = offset; + (*end_handle)->fi = fi; + (*end_handle)->offset = offset; for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS; i++) (*end_handle)->link_penalty[i] = FLAC_HEADER_NOT_PENALIZED_YET; @@ -201,9 +201,8 @@ static int find_headers_search_validate(FLACParseContext *fpc, int offset) return size; } -static int find_headers_search(FLACParseContext *fpc, uint8_t *buf, int buf_size, - int search_start) - +static int find_headers_search(FLACParseContext *fpc, uint8_t *buf, + int buf_size, int search_start) { int size = 0, mod_offset = (buf_size - 1) % 4, i, j; uint32_t x; @@ -464,7 +463,7 @@ static void score_sequences(FLACParseContext *fpc) } } -static int get_best_header(FLACParseContext* fpc, const uint8_t **poutbuf, +static int get_best_header(FLACParseContext *fpc, const uint8_t **poutbuf, int *poutbuf_size) { FLACHeaderMarker *header = fpc->best_header; @@ -490,7 +489,7 @@ static int get_best_header(FLACParseContext* fpc, const uint8_t **poutbuf, &fpc->wrap_buf_allocated_size); - if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){ + if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS) { if (header->fi.is_var_size) fpc->pc->pts = header->fi.frame_or_sample_num; else if (header->best_child) @@ -524,7 +523,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, s->duration = fi.blocksize; if (!avctx->sample_rate) avctx->sample_rate = fi.samplerate; - if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){ + if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS) { fpc->pc->pts = fi.frame_or_sample_num; if (!fi.is_var_size) fpc->pc->pts *= fi.blocksize; @@ -594,7 +593,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, /* Pad the end once if EOF, to check the final region for headers. */ if (!buf_size) { - fpc->end_padded = 1; + fpc->end_padded = 1; read_end = read_start + MAX_FRAME_HEADER_SIZE; } else { /* The maximum read size is the upper-bound of what the parser @@ -691,13 +690,13 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, fpc->best_header->offset); /* Set duration to 0. It is unknown or invalid in a junk frame. */ - s->duration = 0; - *poutbuf_size = fpc->best_header->offset; - *poutbuf = flac_fifo_read_wrap(fpc, 0, *poutbuf_size, - &fpc->wrap_buf, - &fpc->wrap_buf_allocated_size); + s->duration = 0; + *poutbuf_size = fpc->best_header->offset; + *poutbuf = flac_fifo_read_wrap(fpc, 0, *poutbuf_size, + &fpc->wrap_buf, + &fpc->wrap_buf_allocated_size); return buf_size ? (read_end - buf) : (fpc->best_header->offset - - av_fifo_size(fpc->fifo_buf)); + av_fifo_size(fpc->fifo_buf)); } if (!buf_size) return get_best_header(fpc, poutbuf, poutbuf_size);