diff mbox

[FFmpeg-devel] Fix iterating of input and output devices

Message ID 7115c8f118345ac513eafcc2fda415d3@matouschek.org
State New
Headers show

Commit Message

Felix Matouschek March 14, 2018, 12:31 p.m. UTC
My bad

Am 14.03.2018 13:25, schrieb Timo Rothenpieler:
>> -            if (!(prev = ((AVOutputFormat *)prev)->next))
>> +            if (!(prev = prev ? ((AVInputFormat *)prev)->next :
> (void*)outdev_list[0]))
> 
> AVOutputFormat
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Comments

Timo Rothenpieler March 15, 2018, 10:59 a.m. UTC | #1
Looks reasonable to me.
Timo Rothenpieler March 16, 2018, 9:52 a.m. UTC | #2
Will push tomorrow unless someone sees a problem with this.
Timo Rothenpieler March 18, 2018, 5:21 p.m. UTC | #3
Am 16.03.2018 um 10:52 schrieb Timo Rothenpieler:
> Will push tomorrow unless someone sees a problem with this.
> 

applied
diff mbox

Patch

From cd8842ecf606d368832066fcda925c705e9e9205 Mon Sep 17 00:00:00 2001
From: Felix Matouschek <felix@matouschek.org>
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 <felix@matouschek.org>
---
 libavdevice/alldevices.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 4c89649b97..39993354bc 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 ? ((AVOutputFormat *)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