From patchwork Thu Jan 23 16:08:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 17493 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 22E6544BAAD for ; Thu, 23 Jan 2020 18:08:57 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 12F3A68B494; Thu, 23 Jan 2020 18:08:57 +0200 (EET) 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 3406968B0E2 for ; Thu, 23 Jan 2020 18:08:49 +0200 (EET) Received: by mail-wm1-f67.google.com with SMTP id p17so3116839wma.1 for ; Thu, 23 Jan 2020 08:08:49 -0800 (PST) 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=zYQMlqUGHZZIbGiWJMdD7gV48aJEdRxv/J0A39DxS/w=; b=FVslWbSF6Q/iuuLcYUnK/X9m6ZKTW+dSSzsNCDRQQZG22xAq5g35CUlgH7Q0bVHZX0 JeYB+2peW45Y8Ea27MxTDD8WSZzBSVwVXwrEFIeOolLFL4LdFvcj7SZlKlmDjjua2IJ6 j9mvMW3RP+FOe6K5pcM9OidBNCOkffKvZyxgkstbVVJubtWWbS4dMWPREs1fzsAYRfIa Lbfm0EZXcQ9ZCoJgR1DexHx3jZbM9nnGYsvQAQK8vSORkXeFTe1XDC7U/kkAfb9KUVm1 Ocx7hKKbb9b57hvmyPgZWcsqPBeFrg3vdSvg6Fly3uO4xgkVzhitXUXGxxdD70mh6fzm FSzw== 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=zYQMlqUGHZZIbGiWJMdD7gV48aJEdRxv/J0A39DxS/w=; b=Tl2QxlHsz/mc2lApUky4w0XW74eY/TAiP21D30ec8VC4lVy+c2euMDLIe4F2pphegv wYkn6LkHFdNuypl7Wyy+/fhJGw4NrtMUb5PoEiLN5bvpbMZURIOcdQHBP2T4g3VaXmVR amgmKYawVW7OXbmqy+u+4+ndDJPHelHET8wpnB8kBPbjrtMMvSEDcZr7kkzv6uCcj+NX K9+nG/S3oEbzy1Mus94bndGWhQNKiIDfzy642YjsSnPKx+DwZrYCQqXHPiarRYh4mL1Z jTHR0yimw8HNYrVNYHTcg1VUKiRVxFeS9MlqWZaangrMQLQYsE7yRbm27SYNIlZD41YG TyAg== X-Gm-Message-State: APjAAAXxteRVZxYkisuRIlHpu8nhGgxVmYjxMa/MQXhKyiJH7Lnu1WY8 oLQo4k+7iIWd8u76Nz0XG9LQRhKM X-Google-Smtp-Source: APXvYqy8Zke7xwM4wS4EY4FM1tET3VMYsZN1MPcfhzBiEEbgseJMmaLNE3LI8KeukSxiBSl8Rjfd5w== X-Received: by 2002:a05:600c:24d1:: with SMTP id 17mr4903329wmu.188.1579795728502; Thu, 23 Jan 2020 08:08:48 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08bbf.dynamic.kabel-deutschland.de. [188.192.139.191]) by smtp.gmail.com with ESMTPSA id o187sm3678419wme.36.2020.01.23.08.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2020 08:08:48 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 Jan 2020 17:08:30 +0100 Message-Id: <20200123160832.2020-4-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200123160832.2020-1-andreas.rheinhardt@gmail.com> References: <20200123160832.2020-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] avformat/av1, hevc: Make *_buf-functions return 0 on success 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" The output size is already returned via a pointer argument, so there is no need to return it via the ordinary return value as well. The rationale behind this is to not poison the return value on success. It also unifies the behaviour of the *_buf-functions for AVC, AV1 and HEVC. Signed-off-by: Andreas Rheinhardt --- libavformat/av1.c | 2 +- libavformat/av1.h | 4 ++-- libavformat/hevc.c | 2 +- libavformat/hevc.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/av1.c b/libavformat/av1.c index 5ad9222900..4ff4bffddf 100644 --- a/libavformat/av1.c +++ b/libavformat/av1.c @@ -76,7 +76,7 @@ int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size) av_freep(out); *size = avio_close_dyn_buf(pb, out); - return ret; + return 0; } static inline void uvlc(GetBitContext *gb) diff --git a/libavformat/av1.h b/libavformat/av1.h index 9354889afe..0578435376 100644 --- a/libavformat/av1.h +++ b/libavformat/av1.h @@ -66,8 +66,8 @@ int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size); * @param size size of the input data buffer. The size of the resulting output data buffer will be written here * - * @return the amount of bytes written in case of success, a negative AVERROR - * code in case of failure. On failure, out and size are unchanged + * @return 0 in case of success, a negative AVERROR code in case of failure. + * On failure, out and size are unchanged */ int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size); diff --git a/libavformat/hevc.c b/libavformat/hevc.c index db931d2017..f621cb2f19 100644 --- a/libavformat/hevc.c +++ b/libavformat/hevc.c @@ -1062,7 +1062,7 @@ int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, *size = avio_close_dyn_buf(pb, buf_out); - return ret; + return 0; } int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data, diff --git a/libavformat/hevc.h b/libavformat/hevc.h index 1e355cd34a..bb144397c0 100644 --- a/libavformat/hevc.h +++ b/libavformat/hevc.h @@ -71,8 +71,8 @@ int ff_hevc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in, * or to discard them (non-zero) * @param ps_count address of the variable where the number of discarded * parameter set NAL units shall be written, may be NULL - * @return the amount (in bytes) of data written in case of success, a negative - * value corresponding to an AVERROR code in case of failure + * @return 0 in case of success, a negative value corresponding to an AVERROR + * code in case of failure */ int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, int *size, int filter_ps, int *ps_count);