From patchwork Wed Mar 14 12:20:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Matouschek X-Patchwork-Id: 7992 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp1950254jad; Wed, 14 Mar 2018 05:20:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELtBR65WixQa5NLZnSeyyRN3ZtGt0QSUpbBjBDg6dSCS0XcTRV55qcRwK8lMQc4nBV2+e6GB X-Received: by 10.223.186.66 with SMTP id t2mr3902661wrg.155.1521030059709; Wed, 14 Mar 2018 05:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521030059; cv=none; d=google.com; s=arc-20160816; b=CXgJl4O2p0hZp3CckkzVVFkvghH1YL7Y8I71hYinxGkvzcWM9ZfMhkGH1wdaQRoSxG 0V0lh/7smsH3yly3qJhw0xzyNtrLp4yjidmH7gwFPovbgPCft7V3GJHkw9sPqrBi0LvL nydWERYbhgs0me1quY2cQBs4yDLA5U65+wV/Z+QrSHWIFcHBjNYa13QXOIjPe3CZz2lW O89d8C61wXH0H9pUdsSrWa30YH2CxOGjrvZ9YsvSkbhQLDhR4aRaLVGKA/cef0JemG8k 9JjQEcm9T91fEgaE/XIz6qyX+e0ZM5uPfzGFh15xAgdC0mxY8hyvR4NJLeIJsuPqmxbl ffCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:message-id :to:from:date:mime-version:dkim-signature:delivered-to :arc-authentication-results; bh=/Z25yfxaly88CwEsesSAQgZ0ORj3ZgjWVARo05bfoTE=; b=whPq58SIhbsouj8n2tsHDOiULdB2eSv3Svp2PrbS0NoQfjDgqB/WevwQu+7av5zGzZ hoteodq1agZkDr89ygt2KjMw5qLQk4/Zu9KR33dpYf/ZQuICTjenQVCqOhkkHHmO87eN U4XgQVveOeRAeQQY/nEWOZ5MvUFVlzzE4uCf3CueLXITxRHGQ9hFgvpFXOVfmyCfss8C QFrdRdBVtcMeAhF7icFGnuAq7DtgidMDRq72mEI7kAzmEWKHYcibS95qunnPaRlp1Wdy uV4+Y5ty/OISDkwrubdFLND4oSWS+LMURlrLGP0D4QRyUItMQFG+aMs1gqgzz189s5pZ RTGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@matouschek.org header.s=mail header.b=mDTG1OK8; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=matouschek.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f19si835876wme.246.2018.03.14.05.20.58; Wed, 14 Mar 2018 05:20:59 -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=@matouschek.org header.s=mail header.b=mDTG1OK8; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=matouschek.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B923F689CB0; Wed, 14 Mar 2018 14:20:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.fmat.eu (mail.fmat.eu [37.120.191.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C256E689CB0 for ; Wed, 14 Mar 2018 14:20:39 +0200 (EET) Received: from authenticated-user (mail.fmat.eu [37.120.191.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.fmat.eu (Postfix) with ESMTPSA id 660671A0A71 for ; Wed, 14 Mar 2018 13:20:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=matouschek.org; s=mail; t=1521030050; bh=lkztD4+6tzWWAhhCesZlcVHOuxcLAE0zqwrCMxjYXMg=; h=Date:From:To:Subject:From; b=mDTG1OK84GgbVB4HF5d/o2RvEQa+igzE/StbEhazC5XzSxSYKuVJZ+e8HKgWVd62d aOAj4V96cN/7X8yxiyVWycTkUuDgc0BbJusMFVZo+qMOlL/Itc+ATDHO9969sMIA+B +9h5ki3AtKDVmik3ROQmuoYuEKainLWcEgFglQgbcWx9BtTZN2kUikUzR2VBsRXc4t I4uYSgddxALaL8bJi7LRFOPWF+M+ITUt0WBWRyG8rkdpH2ZOhaucLbOdx9B+1vYwt2 O6vYSIfgI9AMYKg5i3HT+mxk8HGUturceLRffEJwHML7/gBspboReMOCU0psOc4eUy 0+5TsXowdDhBw== MIME-Version: 1.0 Date: Wed, 14 Mar 2018 13:20:50 +0100 From: Felix Matouschek To: ffmpeg-devel@ffmpeg.org Message-ID: <20739ccecc4fd528ea84c1d386a658e3@matouschek.org> X-Sender: felix@matouschek.org Subject: [FFmpeg-devel] [PATCH] Fix iterating of input and output devices 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" This fixes the iterating of input and output devices In the previous implementation the first input or output device was skipped when device_next was called with prev = NULL From f90823e8dccf5751e88b8990f5789d8f67e7c496 Mon Sep 17 00:00:00 2001 From: Felix Matouschek Date: Wed, 14 Mar 2018 13:14:07 +0100 Subject: [PATCH] Fix iterating of input and output devices To: ffmpeg-devel@ffmpeg.org In the previous implementation the first input or output device was skipped when device_next was called with prev = NULL Signed-off-by: Felix Matouschek --- libavdevice/alldevices.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index 4c89649b97..271a3182a0 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -126,16 +126,13 @@ static void *device_next(void *prev, int output, ff_thread_once(&av_device_next_init, av_device_init_next); - if (!prev && !(prev = (output ? (void*)outdev_list[0] : (void*)indev_list[0]))) - return NULL; - do { if (output) { - if (!(prev = ((AVOutputFormat *)prev)->next)) + if (!(prev = prev ? ((AVInputFormat *)prev)->next : (void*)outdev_list[0])) break; pc = ((AVOutputFormat *)prev)->priv_class; } else { - if (!(prev = ((AVInputFormat *)prev)->next)) + if (!(prev = prev ? ((AVInputFormat *)prev)->next : (void*)indev_list[0])) break; pc = ((AVInputFormat *)prev)->priv_class; } -- 2.14.1.windows.1