From patchwork Mon Apr 19 14:10:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 27063 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:5014:0:0:0:0:0 with SMTP id e20csp566005iob; Mon, 19 Apr 2021 07:23:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3+s8JY4Yqf84h39BrjwKpmFvvnJ75ESLl9Koqivwtv/G6F/3zevoCRhNPEsw/wdsQP/4m X-Received: by 2002:a05:6402:31f0:: with SMTP id dy16mr19200618edb.161.1618842232740; Mon, 19 Apr 2021 07:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618842232; cv=none; d=google.com; s=arc-20160816; b=k0fNqRHXJB8eUOC4/UIDuwBNPj5XIcMEd30KbHJ6b/dglHCvwwNnhstq+8dRBK0gHM y9HHbeiJilpk7l0v208Co9GO6IIWe3bZg6Qn0HG8urSH7OrlqS8hZQ0tbtpdi2rHXuhb B50jZZKZ60tiQjdsSoIIN8B1W8q0zApq0tpYIeEsvtHq76L0vpzesq8RN0mmatfRfS7g fOr3ejr1QwvvNrW6VTH8AwcWMHeY1fvnbVLax1Y/st5zG/LdZN8YdfyKKbUumYkLCMFJ kUIJkKQdsg+Gv6fNhZ48qKnt5nnTd/qQMNaEMl1zruNye7h3i+eANRGY5rsn3BlhTS3X r4Rg== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=R+71md3E1KOBjOYPmnmlG6Ho2U9fOaxsgHgTrqd2g3w=; b=FMvEjHsXI63x4GqX8t5Q4hgzR1LPHQF/Ki0eYZ5q+M+jLObktCCsaLSBrfzLXKNyIW Ie5fLQdu2RWCJoNYfpd7OH3r3wQylDlts0VzpUY/f+aGsVR6wsDrByDMuaN4l69tPuJQ iC/ZjbmNDmESHTzQzKYH8NQS6JWHr7PaxDEB2mI65Mo00S8R+mlwloryUrN3dRPL7WTs jdf9J2jneOxTuf7Ty/6RKjSyX66CPR2DcMGYlBOswMjLCef0rRLYwjPVwS35hnU5OvNX deXXM7p8flenVefKGK1OaG9M+HeZkw7KiEiyOVzUEQwykszi/77Ep1mV/RJ1kyI6kYnb BOxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b="UNFv/F1i"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id jt15si6031223ejb.406.2021.04.19.07.23.52; Mon, 19 Apr 2021 07:23:52 -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=@gmail.com header.s=20161025 header.b="UNFv/F1i"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8726F689EE9; Mon, 19 Apr 2021 17:12:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ECC49689E5B for ; Mon, 19 Apr 2021 17:12:40 +0300 (EEST) Received: by mail-qv1-f49.google.com with SMTP id 30so16899903qva.9 for ; Mon, 19 Apr 2021 07:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=HTtGmAXU+jonsRg7q5IQD5kx3zTilcKkz+ZPeq9NAno=; b=UNFv/F1iGTNddayTCvDzeuNJxGlgFZAUVxDoMHL0hr6G7rO2lBPvu1QDqk0858QT6b j6H+ymSzvCBtlvlC6luarWG9vhts2h37mf6+Xi3FhLSxi2ImvbgfJEfkCFSGOU51wriB 2GicqSTPFjBqTNKSsnWi2+z3a5jPm6k0lAALrgpe9UAjmXG3lchaKdfCqF9PRIamdJhI GhgpzLmTuqLmWSf83vBatPE8PQ+NSLrNA7Ij29QS40la/WyHh2MkntI2jAz57DTQMgAL 5CvlOHGc6a3kqDGHNmIdd6JX8YiQshjrFMHqECzJ3FPmFEPcUNerFn8j4U+xT9VTv9ep s8bg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=HTtGmAXU+jonsRg7q5IQD5kx3zTilcKkz+ZPeq9NAno=; b=ll8xPWTICdq1ckkOXKnGgzhuEfDIUmzk7s2uAfJo8AVsLl19UTwxKmUMmQpQ9GqTL9 jdM1ZmhDW6lP3UsB8ORkM6h1XGLx07iySwzW5Z4fRX1R+Se6i9/QcV/E2hHlmEc2198D C+gT9xo85vBGV29RUsbkdnWRmW2boGQXhaezLRJ3lbPvpILueHmRtrX+irNT53rqWIzR vXdf1ZqBofw0YsVoRroSoFdyyPRERyhvz8LLOR5xe2fVijRRyOzZ/C2u+I7n3kQ0WDLL DmDpsWLKvBn0m6Ksy9QA+S1FFBAxmFGPVzumz8nbaSull7/CxAdzKqTgNc+XgpZKgk43 qlNA== X-Gm-Message-State: AOAM533ggnPY2jHqhMAR0+zQ0VvJqzC7D6zDM8DJhCxBvOqqyb0F/LUe HtEnpyvtermzW8Plll4TRlSMZl08/3k= X-Received: by 2002:ad4:576e:: with SMTP id r14mr21943847qvx.13.1618841559283; Mon, 19 Apr 2021 07:12:39 -0700 (PDT) Received: from localhost.localdomain ([191.83.209.133]) by smtp.gmail.com with ESMTPSA id f7sm2049494qtv.53.2021.04.19.07.12.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 07:12:39 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Apr 2021 11:10:14 -0300 Message-Id: <20210419141024.8174-78-jamrial@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419141024.8174-1-jamrial@gmail.com> References: <20210419141024.8174-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 77/87] avdevice/avdevice: Constify av_*_device_next API 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: Xmy1wflnZt51 From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- doc/APIchanges | 4 ++++ fftools/cmdutils.c | 4 ++-- libavdevice/alldevices.c | 16 ++++++++-------- libavdevice/avdevice.h | 8 ++++---- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 443cb84b27..f405cd789c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -17,6 +17,10 @@ API changes, most recent first: 2021-04-17 - xxxxxxxxxx - lavu 56.73.100 - frame.h detection_bbox.h Add AV_FRAME_DATA_DETECTION_BBOXES +2021-04-14 - xxxxxxxxxx - lavd yyyyyyyyy - avdevice.h + The av_*_device_next API functions now accept and return + pointers to const AVInputFormat resp. AVOutputFormat. + 2021-04-14 - xxxxxxxxxx - lavd yyyyyyyyy - avdevice.h avdevice_list_input_sources and avdevice_list_output_sinks now accept pointers to const AVInputFormat resp. const AVOutputFormat. diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 822fa8df45..4148285971 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -2289,7 +2289,7 @@ static int show_sinks_sources_parse_arg(const char *arg, char **dev, AVDictionar int show_sources(void *optctx, const char *opt, const char *arg) { - AVInputFormat *fmt = NULL; + const AVInputFormat *fmt = NULL; char *dev = NULL; AVDictionary *opts = NULL; int ret = 0; @@ -2327,7 +2327,7 @@ int show_sources(void *optctx, const char *opt, const char *arg) int show_sinks(void *optctx, const char *opt, const char *arg) { - AVOutputFormat *fmt = NULL; + const AVOutputFormat *fmt = NULL; char *dev = NULL; AVDictionary *opts = NULL; int ret = 0; diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index 92b27a1d14..f65317018a 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -68,7 +68,7 @@ void avdevice_register_all(void) avpriv_register_devices(outdev_list, indev_list); } -static void *next_input(const AVInputFormat *prev, AVClassCategory c2) +static const void *next_input(const AVInputFormat *prev, AVClassCategory c2) { const AVClass *pc; const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_INPUT; @@ -91,10 +91,10 @@ static void *next_input(const AVInputFormat *prev, AVClassCategory c2) continue; category = pc->category; } while (category != c1 && category != c2); - return (AVInputFormat *)fmt; + return fmt; } -static void *next_output(const AVOutputFormat *prev, AVClassCategory c2) +static const void *next_output(const AVOutputFormat *prev, AVClassCategory c2) { const AVClass *pc; const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_OUTPUT; @@ -117,25 +117,25 @@ static void *next_output(const AVOutputFormat *prev, AVClassCategory c2) continue; category = pc->category; } while (category != c1 && category != c2); - return (AVOutputFormat *)fmt; + return fmt; } -AVInputFormat *av_input_audio_device_next(AVInputFormat *d) +const AVInputFormat *av_input_audio_device_next(const AVInputFormat *d) { return next_input(d, AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT); } -AVInputFormat *av_input_video_device_next(AVInputFormat *d) +const AVInputFormat *av_input_video_device_next(const AVInputFormat *d) { return next_input(d, AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT); } -AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d) +const AVOutputFormat *av_output_audio_device_next(const AVOutputFormat *d) { return next_output(d, AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT); } -AVOutputFormat *av_output_video_device_next(AVOutputFormat *d) +const AVOutputFormat *av_output_video_device_next(const AVOutputFormat *d) { return next_output(d, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT); } diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index d0b0f23f5d..8370bbc7f2 100644 --- a/libavdevice/avdevice.h +++ b/libavdevice/avdevice.h @@ -77,7 +77,7 @@ void avdevice_register_all(void); * if d is non-NULL, returns the next registered input audio/video device after d * or NULL if d is the last one. */ -AVInputFormat *av_input_audio_device_next(AVInputFormat *d); +const AVInputFormat *av_input_audio_device_next(const AVInputFormat *d); /** * Video input devices iterator. @@ -86,7 +86,7 @@ AVInputFormat *av_input_audio_device_next(AVInputFormat *d); * if d is non-NULL, returns the next registered input audio/video device after d * or NULL if d is the last one. */ -AVInputFormat *av_input_video_device_next(AVInputFormat *d); +const AVInputFormat *av_input_video_device_next(const AVInputFormat *d); /** * Audio output devices iterator. @@ -95,7 +95,7 @@ AVInputFormat *av_input_video_device_next(AVInputFormat *d); * if d is non-NULL, returns the next registered output audio/video device after d * or NULL if d is the last one. */ -AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d); +const AVOutputFormat *av_output_audio_device_next(const AVOutputFormat *d); /** * Video output devices iterator. @@ -104,7 +104,7 @@ AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d); * if d is non-NULL, returns the next registered output audio/video device after d * or NULL if d is the last one. */ -AVOutputFormat *av_output_video_device_next(AVOutputFormat *d); +const AVOutputFormat *av_output_video_device_next(const AVOutputFormat *d); typedef struct AVDeviceRect { int x; /**< x coordinate of top left corner */