From patchwork Fri Aug 16 17:01:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 14553 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 03BCF447AC1 for ; Fri, 16 Aug 2019 20:02:30 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D432A68ABB0; Fri, 16 Aug 2019 20:02:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 67D5268AB87 for ; Fri, 16 Aug 2019 20:02:23 +0300 (EEST) Received: by mail-wm1-f66.google.com with SMTP id 10so4578397wmp.3 for ; Fri, 16 Aug 2019 10:02:23 -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=ZWSGPMs1s652CjvzEbAXY7xZEVSGP9Iqwi0GGXPJXZk=; b=m5qdeE5vnqarc2LcA7DcH//r2r+B4lajL1eNRt2AZvAGql0UBG9eyPIvtxepWera3f 4S7YqqOCxbb8HWn7+yQNQRUs0a81ZC4gP0yMbmU/DN7iuNwND86h8iWeV4iZVaigg/FJ LBfdIUPMspsZeKddXpBlwnJWP24ucq0709ZC46Z+Exg3w0vr3i8TbX/iglSOSe2w6HS3 G2VDPyQSuZiflKBocUMtLSwLwe2KVgIuxjQnMZkIfRzu15kPnrhfBfzlCCc+LjSu8Mjq rkiiSZZJlsiK857YxznV9AkXv7DOILT+53WGpmFbqTvF7BGr5g6uETEUubNZ4jZoKkxT zUtA== 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=ZWSGPMs1s652CjvzEbAXY7xZEVSGP9Iqwi0GGXPJXZk=; b=QERMJSiECiwTQQ00tLFGAgpm90N5kwODE0QT5a8zTri4muioHfKWrvAgciKwIbL/Yr h++upBJ4hMpR694XL60m6CvvHyRQ+6q+FQvRe5eU37kWFSJaTwNGSq6CZJcOI1NtIzpn 4FzJZHgep3oebkhTmlM1gHnmgdYq8EaCNaX0u9ykkNZUHByfcv/d3oKrE2le5TOw7LO1 eEp27RFMY8cvnU/gCyPnQ7DIfM0/Uofd1+qTcWbCd77Qye0KdrD/BZxOtBVBVz28bk1G iI+D8F1RXNhR6jOUdH30CXhW9rSz45pDRfrjB/vPCmdAG8T0/UBkXLiMQaBMZbNJW/XS pL2g== X-Gm-Message-State: APjAAAXuO6W8MSV3n1Qa+lP2NmWxETOFNdAyEycfC09OOp9uQilJEIPX 5uJD+XcM6OfHDLi321J+kZfdTS/7 X-Google-Smtp-Source: APXvYqxOOpLy+7mnyHJfEp2rbNSOXa2TfEvXETYGZzKQKiDXD2FcDIYc5JM5cHuFu2vFAc5RMr94Vw== X-Received: by 2002:a1c:1d4f:: with SMTP id d76mr8852600wmd.127.1565974942675; Fri, 16 Aug 2019 10:02:22 -0700 (PDT) Received: from localhost.localdomain (ipbcc08b69.dynamic.kabel-deutschland.de. [188.192.139.105]) by smtp.gmail.com with ESMTPSA id w15sm5130795wmi.19.2019.08.16.10.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2019 10:02:22 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 16 Aug 2019 19:01:34 +0200 Message-Id: <20190816170135.57811-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816164314.57764-1-andreas.rheinhardt@gmail.com> References: <20190816164314.57764-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] 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 --- 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);