summaryrefslogtreecommitdiff
path: root/libavdevice/alldevices.c
diff options
context:
space:
mode:
authorFelix Matouschek <felix@matouschek.org>2018-03-14 13:14:07 +0100
committerTimo Rothenpieler <timo@rothenpieler.org>2018-03-18 17:45:20 +0100
commitce1d77a5e7cebce11074bf6f9e38ad6da37338ff (patch)
treece37b1e5fc922ebd902770a53954e63003a78bab /libavdevice/alldevices.c
parent3e7fa34d3b688b9b4b5b22344e8fc27c4b53286d (diff)
downloadffmpeg-ce1d77a5e7cebce11074bf6f9e38ad6da37338ff.tar.gz
lavd: fix 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 Signed-off-by: Felix Matouschek <felix@matouschek.org> Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavdevice/alldevices.c')
-rw-r--r--libavdevice/alldevices.c7
1 files 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;
}