From patchwork Thu Nov 14 14:44:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 16263 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 8E6E7446F1B for ; Thu, 14 Nov 2019 16:51:20 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 52C1368A323; Thu, 14 Nov 2019 16:51:20 +0200 (EET) 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 46261689B6E for ; Thu, 14 Nov 2019 16:51:13 +0200 (EET) Received: by mail-wr1-f66.google.com with SMTP id r10so6804073wrx.3 for ; Thu, 14 Nov 2019 06:51:13 -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=Dg5dEDQzOpQ7nq+5L5DENJ4VQtybK6zNUJV9LZckUX8=; b=Z1k2XjFAmnno33MjV2aNuIF6vn8mIwd1NSU+P+072+bQSyd1HuMjOpOykXbWXcwIeC IwhAHlPJKE6ZzQv/ZOdGZRs28oCoiPBZ3QjN7uCU1BxGnBPioVxFZaoyeCbfjBXOARRI /a63UkwKQrFUFpu8KWBV8/OEYFtO0WL+aR/Txj+z4ya9rEH0lMsRhHTAvtjn6k5dLPsA xZd9SkbnOS0t+NHmmnlQfC+VtXKyu1XQI3RPBx1mbLreGa8FtBPgwVAGl4yDNaOQERNd 1zAK20nXq1sRmSkeMbFEkkS2RYA0OsMKemaateQHJX6jvjhYy2HuQx3pe95eOxWyVQag Q/Ow== 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=Dg5dEDQzOpQ7nq+5L5DENJ4VQtybK6zNUJV9LZckUX8=; b=nHAKz9Hde+mfvPs8MlMq2b7hRF9F7UMDxWeExE5O8/2xd8X/eMxw+UToidyHKRivbm rSx6ELj5MOLU81gwishSG0OoojWo6vofLnqItbn8QR0NwWwZlCVmvbhDlnPPirgro7tG sTy1XK9l7HjmuGfxAfnjfm/WWL19cBzimRJUWTX/nTjP6LTA0gmkBhOhXBrqjftjxHLE 4vVWChRQzRLs9kAUYjPiGywkt+QZBfWgwVio7Eo6LjxHULB7gc6bF9CxVghsUDHAC23n ULPFZgRfrQxfUSwtLcxq7/iijD59ougrpvDOk8L8eraEQokojRlmxeXSiDASIpyNhGMo 0Lfw== X-Gm-Message-State: APjAAAWkzcUIIvCaTXj7+3AThMDmtcuWbUtW8vmk5VB4PJy0kO1cKe6C 84SSvbfXBV0lplgi9v6vQENW2Utm X-Google-Smtp-Source: APXvYqxHojt6/j+ZpUxRdsMC8SKJy0N7rXahqPhUshSZY3I6oV3uXfl9eZLr5W2lfWqtD/rtCqTUeA== X-Received: by 2002:adf:a3d5:: with SMTP id m21mr8261796wrb.386.1573742663633; Thu, 14 Nov 2019 06:44:23 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08937.dynamic.kabel-deutschland.de. [188.192.137.55]) by smtp.gmail.com with ESMTPSA id w10sm6105795wmd.26.2019.11.14.06.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 06:44:22 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 14 Nov 2019 15:44:15 +0100 Message-Id: <20191114144415.23841-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <92032a0a-5eef-62a4-51ad-e4f4415c148d@gmail.com> References: <92032a0a-5eef-62a4-51ad-e4f4415c148d@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/avcodec: Adapt the doc of av_bsf_send_packet 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" to match its actual implementation. Explicitly allowing empty packets to signal flushing helps getting rid of special cases. It does not hinder the ability to send i.e. timing-only packets, because one can send packets with zero size and pkt->data set. Signed-off-by: Andreas Rheinhardt --- I used "vanish" as an umbrella term for "being NULL or zero" (pkt->side_data_elems is an int). Maybe using C directly (i.e. !pkt->data) would be more clear? It would certainly be briefer. libavcodec/avcodec.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index bcb931f0dd..82f04f1130 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -5946,11 +5946,13 @@ int av_bsf_init(AVBSFContext *ctx); * * @param pkt the packet to filter. The bitstream filter will take ownership of * the packet and reset the contents of pkt. pkt is not touched if an error occurs. - * This parameter may be NULL, which signals the end of the stream (i.e. no more - * packets will be sent). That will cause the filter to output any packets it - * may have buffered internally. + * If pkt is empty (i.e. NULL or pkt->data is NULL and pkt->side_data_elems zero), + * it signals the end of the stream (i.e. no more non-empty packets will be sent; + * sending more empty packets does nothing) and will cause the filter to output + * any packets it may have buffered internally. * * @return 0 on success, a negative AVERROR on error. + * This function never fails if pkt is empty. */ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);