From patchwork Mon Aug 19 21:56:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 14598 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 EDAC6446D51 for ; Tue, 20 Aug 2019 01:12:18 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D7C0068AB46; Tue, 20 Aug 2019 01:12:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DA3D568A0FA for ; Tue, 20 Aug 2019 01:12:12 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id c3so10277617wrd.7 for ; Mon, 19 Aug 2019 15:12:12 -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=ptxQyU7IHQEuaiq2dtPlIW7D2DEVdY2+sThx2gDO1dw=; b=Eys4Dwu8HGuhsGaKMIVLjnp+gLmbp9fz9RuPA8DNEYAscwO0oIopqUSkyJSAiZE2MF Pma+RXtJPeP2mT8XkdyCdWIOjXdjpdKe2V4f6IyhOz/4M7tmG3FHe27aMyVSHliGS/JO WwDXiR9gTCWT7jQLsrvAv8ftH4Wh9Iy8TwrRfzefpEXOYFfIFXe6DATrfdRULxRALQAR XqcV58IdSsqez1a+51tBy2cRmpH1kSxusI88HomuvFVXlxY4WNmG5O7n+2SukDDqSH4V CjjkqDAr6Ly71MFq9x9sLvJuoXccrlUs9mZiV3492XHGqk6CGTa8Hu96pdiIkJUqobor t2IQ== 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=ptxQyU7IHQEuaiq2dtPlIW7D2DEVdY2+sThx2gDO1dw=; b=rm1ZLp151zTd3uVtu0j9lMbeixuHTuJU9SiHj+LhOtDGY6eoNtwhNxpqukv0fM7Ka5 Uk++y/YScjuzwQxRj3Z+2XsRatOnUFpY3ZAAIslwX0b/2ZTg3CfrU2kqppfpAIoNx45E gmTiVXVnDTQCGhqUjhTIuz2DZcLa4GS+Txg5qHcuPFdZoanxfO3gsT2jk76zb/K8Q09I jXX26SHVgHDH5pIgdOJ977LyN4l1VlfyWsfko4Tmf8quiESKIw1vtSAGbcSocDwcyKFk dUIRiKbf2vnudgM+nF3hYWOiqV6kOT0+PlwBpsH4PED8dI6/NUoUbUxRg1usQ7QjbCJM Cdzg== X-Gm-Message-State: APjAAAUFvCoiLr1kyEFBMOYD6NyycuMWl5w1hpLfXo5ZQVBcxogzlxvB AZ2J5BEOfM5JKwv6lsh8LyRE2Ki5 X-Google-Smtp-Source: APXvYqx2UHHIQxXLCKOcS+dA9Jzvc2jWKXDll6GbVfnEsYL5VspX5dgyu0Yn9W9v6IKNUk7plKZMqw== X-Received: by 2002:a5d:6a05:: with SMTP id m5mr30812438wru.305.1566252233419; Mon, 19 Aug 2019 15:03:53 -0700 (PDT) Received: from localhost.localdomain (ipbcc08c5c.dynamic.kabel-deutschland.de. [188.192.140.92]) by smtp.gmail.com with ESMTPSA id s64sm32952293wmf.16.2019.08.19.15.03.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 15:03:52 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Aug 2019 23:56:18 +0200 Message-Id: <20190819215624.49795-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190819215624.49795-1-andreas.rheinhardt@gmail.com> References: <20190819215624.49795-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/8] avformat/internal: Improve documentation of ff_packet_list_get 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 documentation of ff_packet_list_get currently didn't match the actual usage: 1. It said that the destination packet is supposed to be initialized. But this makes no sense given that it will be overwritten completely and flacenc, mp3enc and ttaenc ignored this. 2. ff_packet_list_get returns an int, although it can't fail in case the packet list is not empty (for which there is an assert). Again, several callers didn't check for any return value. In both cases, the documentation has been adapted to match actual usage. Signed-off-by: Andreas Rheinhardt --- No changes since last time. libavformat/internal.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index d6a039c497..163587f416 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -773,13 +773,16 @@ int ff_packet_list_put(AVPacketList **head, AVPacketList **tail, /** * Remove the oldest AVPacket in the list and return it. + * The behaviour is undefined if the packet list is empty. * * @note The pkt will be overwritten completely. The caller owns the * packet and must unref it by itself. * * @param head List head element * @param tail List tail element - * @param pkt Pointer to an initialized AVPacket struct + * @param pkt Pointer to an AVPacket struct + * @return 0 on success. Success is guaranteed + * if the packet list is not empty. */ int ff_packet_list_get(AVPacketList **head, AVPacketList **tail, AVPacket *pkt);