PR #26115 opened by stevebanik URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26115 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26115.patch
### Summary of Changes This PR fixes a long-standing issue on macOS where querying input devices using `-f avfoundation -list_devices true -i ""` reports false I/O errors and exits with non-zero exit code 251. 1. **`libavdevice/avfoundation.m`**: - In `avf_read_header`, after enumerating video and audio devices for `list_devices`, set `ret = AVERROR_EXIT;` before jumping to `fail:`. - Previously, `ret` was unset, causing it to fall through and return `AVERROR(EIO)`. Setting `AVERROR_EXIT` aligns `avfoundation` with other indevs (`dshow`, `v4l2`, `decklink_dec`, `openal-dec`). 2. **`fftools/ffmpeg_opt.c`**: - In `open_files()`, suppress the spurious `"Error opening input file"` log when `ret == AVERROR_EXIT`. - Matches the existing error suppression logic in `fftools/ffmpeg_demux.c:2466` and `fftools/ffmpeg_opt.c:1530`. ### Verification Tested on macOS (Apple Silicon, macOS Darwin arm64): **Before:** >From cb1ae56af8a684c7aeabf2e9c4217d715c1f5477 Mon Sep 17 00:00:00 2001 From: Steve Banik <[email protected]> Date: Mon, 16 Nov 2026 12:40:15 -0600 Subject: [PATCH 1/2] avdevice/avfoundation: return AVERROR_EXIT when list_devices is set When listing devices, avf_read_header jumped to fail without setting a return code, causing it to fall through and return AVERROR(EIO). Returning AVERROR_EXIT aligns avfoundation with other indevs (dshow, v4l2, decklink) and signals clean termination after listing. --- libavdevice/avfoundation.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index 8b7e728279e..7348edb0855 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -1132,7 +1132,8 @@ static int avf_read_header(AVFormatContext *s) int index = [devices indexOfObject:device]; avf_log_device_entry(ctx, index, device); } - goto fail; + ret = AVERROR_EXIT; + goto fail; } // parse input filename for video and audio device -- 2.54.0 >From 414648a1a41a98d0d0d4175e3e53dd36f0da2129 Mon Sep 17 00:00:00 2001 From: Steve Banik <[email protected]> Date: Mon, 16 Nov 2026 12:40:15 -0600 Subject: [PATCH 2/2] fftools/ffmpeg_opt: do not log error when opening file returns AVERROR_EXIT Indevs return AVERROR_EXIT for informational commands such as listing devices or options. Suppress the spurious 'Error opening input file' log when ret == AVERROR_EXIT, matching ffmpeg_demux and ffmpeg.c. --- fftools/ffmpeg_opt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 603e9dfbaad..2012b5ac559 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1442,8 +1442,9 @@ static int open_files(OptionGroupList *l, const char *inout, Scheduler *sch, ret = open_file(&o, g->arg, sch); uninit_options(&o); if (ret < 0) { - av_log(NULL, AV_LOG_ERROR, "Error opening %s file %s.\n", - inout, g->arg); + if (ret != AVERROR_EXIT) + av_log(NULL, AV_LOG_ERROR, "Error opening %s file %s.\n", + inout, g->arg); return ret; } av_log(NULL, AV_LOG_DEBUG, "Successfully opened the file.\n"); -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
