From patchwork Thu Apr 9 23:09:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 18803 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 D04E144A0CA for ; Fri, 10 Apr 2020 02:09:40 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AD38468B824; Fri, 10 Apr 2020 02:09:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 63C99689D90 for ; Fri, 10 Apr 2020 02:09:34 +0300 (EEST) Received: by mail-qk1-f195.google.com with SMTP id z15so545376qki.7 for ; Thu, 09 Apr 2020 16:09:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=FveLfoJ1Tr0Fs9mnqqHDA6uhs3FRrcndEnymrjaMJIE=; b=YoRZiBHUmMP1NEay9lMyFn5VuW5J4vbhfCGPYfx33SATr6U2PadNPCozDsNqYiCQjj RAr9dkxiQ/V58Hyjp8vjVRvDVau9lLtL3eSZAMQPM+/NwnneT1OCvS6A9mp4sQJ2mKnA eR3OPW3bgeV/rPtOAKH7FpGhXKSEgVDw5qSgytk6cqmOKEeJVtCIK5dyEEVXbhRSxFb+ /VYxOx3ZYGmH3jEKXZVFT97aMOY8xGxPZdQjcZkaPxoV87Qe+xXkE4qM97evo9vE+vIh VjIplp78op595yjf25laI8HL5uOWHZx9MwJP22Th8EOxnKsJGigqIHl0S8V2QckbpcM6 V0vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=FveLfoJ1Tr0Fs9mnqqHDA6uhs3FRrcndEnymrjaMJIE=; b=VyBci5SwHUL0M77KbOM2Qh1JlkqMGYC08UqU9HdsPDMYfhIcRQZVJY3H/y9SEeE/Dx UlYbq7erGhFWBXwk0J0GkWteGzaKiT4BF8jksIKhowViuUvOemZrQyghbc4bO1PfEtVO 70g61VWigcz2UsszmZSSQGkFx8Bt8Y8/muemgpJakcttdCiplJcDS9VKdLsfgVfshrKR fvofsKzhDRRTmRuhcM5P6I1k0de2TXamAbwd+BdUgBaqKlulZ9J2T2OK23k/tkG9tE0K afMIUpYG1+x2gSSKPjLiRF8i5LJiz1JnLcuG8vguDGx+R0jXkGZUL/B2v/3jFH6f0Wyl /KRg== X-Gm-Message-State: AGi0PubfHvrJ7R7GU3KB/q+nR40rQTQxliXscgTB0lovJsHjI8WIS3Y/ xWKp3SC7HZ0SD21RcBkCQn0DuOl/ X-Google-Smtp-Source: APiQypIToq69TIosahNXmIF97s8ktNgvKTETUKRouuLU+kmlNsHPH03VNvVXzkobvW9j/nMdTYVvPQ== X-Received: by 2002:a37:54e:: with SMTP id 75mr1375906qkf.257.1586473772453; Thu, 09 Apr 2020 16:09:32 -0700 (PDT) Received: from localhost.localdomain ([191.83.218.14]) by smtp.gmail.com with ESMTPSA id b1sm249623qkf.103.2020.04.09.16.09.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2020 16:09:32 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Apr 2020 20:09:03 -0300 Message-Id: <20200409230903.1516-1-jamrial@gmail.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/bsf: mention that av_bsf_send_packet() returning EAGAIN is not an error 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" EAGAIN is returned when input is provided but can't be consumed. The filtering process is unaffected in this case, and the function will be able to consume new input after retrieving filtered packets with av_bsf_receive_packet(). Remove the line about empty packets never failing added in 41b05b849f215b03eeb9e3608571ba47de64182a while at it. Even if it's currently the case, it unnecessarily constrains the API and could be changed in the future in case it needs to be extended. The user should always check for errors and never expect a call to never fail. Signed-off-by: James Almer --- libavcodec/avcodec.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 8fc0ad92c9..ba35cb695b 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -6020,8 +6020,9 @@ int av_bsf_init(AVBSFContext *ctx); * 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. + * @return 0 on success. AVERROR(EAGAIN) if packets need to be retrieved from the + * filter (using av_bsf_receive_packet()) before new input can be consumed. Another + * negative AVERROR value if an error occurs. */ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);