From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 6A8C14302C for ; Sun, 17 Jul 2022 20:10:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 031AB68B743; Sun, 17 Jul 2022 23:10:43 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7A9E268B5D6 for ; Sun, 17 Jul 2022 23:10:36 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 18540E75B6 for ; Sun, 17 Jul 2022 22:10:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GSooYcZ_eXnT for ; Sun, 17 Jul 2022 22:10:06 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 80364E6C1F for ; Sun, 17 Jul 2022 22:10:06 +0200 (CEST) Date: Sun, 17 Jul 2022 22:10:06 +0200 (CEST) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20220710184237.4435-1-cus@passwd.hu> Message-ID: <1a23800-e65b-1a69-66b8-93ea676fe31@passwd.hu> References: <20220710184237.4435-1-cus@passwd.hu> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] avdevice/avdevice: fix return value of avdevice_list_devices() 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sun, 10 Jul 2022, Marton Balint wrote: > According to API docs avdevice_list_devices(), avdevice_list_input_sources() > and avdevice_list_input_sinks() should return the number of autodetected > devices on success. This is redundant with AVDeviceInfoList->nb_devices so it > was not noticed earlier that none of the underlying device list functions work > like that. > > Let's fix it in generic code to make it in line with the API docs. > > Fixes ticket #9820. Will apply. Regards, Marton > > Signed-off-by: Marton Balint > --- > libavdevice/avdevice.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c > index b4fb272eb6..58996404b3 100644 > --- a/libavdevice/avdevice.c > +++ b/libavdevice/avdevice.c > @@ -75,9 +75,11 @@ int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list) > ret = s->oformat->get_device_list(s, *device_list); > else > ret = s->iformat->get_device_list(s, *device_list); > - if (ret < 0) > + if (ret < 0) { > avdevice_free_list_devices(device_list); > - return ret; > + return ret; > + } > + return (*device_list)->nb_devices; > } > > static int list_devices_for_context(AVFormatContext *s, AVDictionary *options, > -- > 2.35.3 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".