From patchwork Tue Sep 28 08:22:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gijs Peskens X-Patchwork-Id: 30623 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp4962188iob; Tue, 28 Sep 2021 01:22:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzo3neBIP46Q6r4WbPZxKJ0wKmErauePj3czCOODmEkIQa0EIlUV2fzH95KWgk8/BP28aYd X-Received: by 2002:a17:906:3281:: with SMTP id 1mr5062086ejw.167.1632817376724; Tue, 28 Sep 2021 01:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632817376; cv=none; d=google.com; s=arc-20160816; b=XEGEkLsCY/NaHvDn0ONETgpzqbsrSC525LyauiZ2aAFWrSsqkODZb4IdKp/qrj31k6 /ofDq4Sn4/AoAvPLtU3aLLp3iU86eizKY9me9MakEdQuqvpdoC2/vMSfYBc0V1BAwdRx PfiJQ/hUd+eszYSImrwKYZpTxsNUy9zzx2C1wm+1YzieiVKrLbCeTvEEPvq4/6nxmSlh gCIPY9gbfl0ixjqbYesUt1Vp4kwP8lIgCi3b7ZTa2ZOEfsmNmJRO/tGQNHlrDr2LE/Hk jbJQGScsRIr91xci+XT8e6fHUOaDqydOCiJUNqbebfIqYeHvFTDBw9FSRotl8D4Khb3p Fq+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=z4yo+uXkDq7sopFtsQ6xIDvvZO0dlb+BkLlk+XJT1hU=; b=fa+qZizM4/VJY28bumBfDnFc4p0f9sqj2wXxoN+Vr0nCBT1pGxHIOtiz0i6muaePS0 1IAiSXwrPWBlA4HtzA3i6tEtB3VTxWMlEnK7CZP6DWuBIGXWcVa4SoyRD7kiO9T6fpkw CXWlWx3uGAZCWcywc5yvuK/Cf9LPCWUNQg2v6cBKRIUid6dVb5BMyOUbJlrGQb/6RyK5 YsnTOuh38Zp14PFdgDj6fUHA09KqB9Hdk2gmnWE/IWSvCJeCGdWZ24OJfQnrYVZFdkTu 4BhHK3SWg7mNY8iYnyggTgWTe7Gc3TmAF/ktZ/XqFM/M1ROw1W3jfaCbhhfNWfb8CyGx FyRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@heteigenwijsje.nl header.s=dkim header.b=YrUhGohr; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=peskens.net Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p12si13980720ejy.596.2021.09.28.01.22.55; Tue, 28 Sep 2021 01:22:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@heteigenwijsje.nl header.s=dkim header.b=YrUhGohr; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=peskens.net Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E0EA0689259; Tue, 28 Sep 2021 11:22:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp.heteigenwijsje.nl (smtp.heteigenwijsje.nl [80.127.116.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 12C4F688051 for ; Tue, 28 Sep 2021 11:22:44 +0300 (EEST) Received: from mail.heteigenwijsje.nl (localhost [127.0.0.1]) by smtp.heteigenwijsje.nl (Postfix) with ESMTP id BF8E89C332 for ; Tue, 28 Sep 2021 10:18:03 +0200 (CEST) Authentication-Results: mail.heteigenwijsje.nl (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=heteigenwijsje.nl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= heteigenwijsje.nl; h=content-transfer-encoding:mime-version :x-mailer:message-id:date:date:subject:subject:to:from:from; s= dkim; t=1632817081; x=1635409082; bh=BtCktKCNBqz+5gdDC1w8Is9mRGZ Mbl2P80fkh4fsbW4=; b=YrUhGohr8eCI5M3lXwdCTL3nHFcQ16WZeaUV83nPb70 tGr+wV3I013go2lq1ded0HtE/HoQgKWCSIZxkaVbc3pdfNMQppveH3JfRvnx0E54 sRV766Hygyau9eFb94ZDbpJ9hksl4zUR6z+AKD5VaPa2EM0U3zNwzG5cHT7u6hzU = X-Virus-Scanned: amavisd-new at mail.heteigenwijsje.nl Received: from smtp.heteigenwijsje.nl ([127.0.0.1]) by mail.heteigenwijsje.nl (mail.heteigenwijsje.nl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zf8gLh6DAX36 for ; Tue, 28 Sep 2021 10:18:01 +0200 (CEST) Received: from smtp.heteigenwijsje.nl (localhost [127.0.0.1]) by smtp.heteigenwijsje.nl (Postfix) with ESMTP id 840F59C12D for ; Tue, 28 Sep 2021 10:18:01 +0200 (CEST) Received: from unknown ([94.208.100.217]) by smtp.heteigenwijsje.nl with ESMTPSA id WOEfH7nPUmGEtAAAc3PRCQ (envelope-from ) for ; Tue, 28 Sep 2021 10:18:01 +0200 From: Gijs Peskens To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Sep 2021 10:22:39 +0200 Message-Id: <20210928082241.918233-1-gijs@peskens.net> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] librist: replace deprecated functions. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: lgjvm2JPCx/9 This gets rid of of rist_receiver_data_read, rist_receiver_data_block_free and rist_parse_address these functions have been deprecated since librist release v0.2.1 and are replaced with functions suffixed with 2. I added a version macro check at the top of the file to ensure ffmpeg can still be compiled against older versions. Signed-off-by: Gijs Peskens --- libavformat/librist.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/libavformat/librist.c b/libavformat/librist.c index 8f51050c3e..b120346f48 100644 --- a/libavformat/librist.c +++ b/libavformat/librist.c @@ -34,10 +34,24 @@ #include "url.h" #include - +#include // RIST_MAX_PACKET_SIZE - 28 minimum protocol overhead #define MAX_PAYLOAD_SIZE (10000-28) +#define FF_LIBRIST_MAKE_VERSION(major, minor, patch) \ + ((patch) + ((minor)* 0x100) + ((major) *0x10000)) +#define FF_LIBRIST_VERSION FF_LIBRIST_MAKE_VERSION(LIBRIST_API_VERSION_MAJOR, LIBRIST_API_VERSION_MINOR, LIBRIST_API_VERSION_PATCH) +//API version 4.1 deprecated: +// rist_receiver_data_read +// rist_receiver_data_callback_set +// rist_receiver_data_block_free +// rist_parse_address +// rist_parse_udp_address +// rist_peer_config_free +// rist_logging_settings_free +// rist_udp_config_free +//And replaced them with functions suffixed with 2 +#define FF_LIBRIST_VERSION_41 FF_LIBRIST_MAKE_VERSION(4, 1, 0) typedef struct RISTContext { const AVClass *class; @@ -146,7 +160,11 @@ static int librist_open(URLContext *h, const char *uri, int flags) if (ret < 0) goto err; +#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41 ret = rist_parse_address(uri, (const struct rist_peer_config **)&peer_config); +#else + ret = rist_parse_address2(uri, &peer_config); +#endif if (ret < 0) goto err; @@ -187,10 +205,16 @@ err: static int librist_read(URLContext *h, uint8_t *buf, int size) { RISTContext *s = h->priv_data; - const struct rist_data_block *data_block; int ret; +#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41 + const struct rist_data_block *data_block; ret = rist_receiver_data_read(s->ctx, &data_block, POLLING_TIME); +#else + struct rist_data_block *data_block; + ret = rist_receiver_data_read2(s->ctx, &data_block, POLLING_TIME); +#endif + if (ret < 0) return risterr2ret(ret); @@ -198,14 +222,21 @@ static int librist_read(URLContext *h, uint8_t *buf, int size) return AVERROR(EAGAIN); if (data_block->payload_len > MAX_PAYLOAD_SIZE) { +#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41 rist_receiver_data_block_free((struct rist_data_block**)&data_block); +#else + rist_receiver_data_block_free2(&data_block); +#endif return AVERROR_EXTERNAL; } size = data_block->payload_len; memcpy(buf, data_block->payload, size); +#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41 rist_receiver_data_block_free((struct rist_data_block**)&data_block); - +#else + rist_receiver_data_block_free2(&data_block); +#endif return size; }