[FFmpeg-trac] #11163(avdevice:new): avdevice_list_input_sources for dshow fails on machines with no video capture devices.
FFmpeg
trac at avcodec.org
Wed Aug 28 22:28:00 EEST 2024
#11163: avdevice_list_input_sources for dshow fails on machines with no video
capture devices.
----------------------------------+---------------------------------------
Reporter: Rishi | Type: enhancement
Status: new | Priority: normal
Component: avdevice | Version: 6.1.1
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+---------------------------------------
Summary of the bug: avdevice_list_input_sources fails on machines with no
video capture devices. While this sounds like by design, there are some
machines with audio only capture devices, which an api user can then
filter through.
How to reproduce:
It requires a Windows machine with no video capture devices.
const AVInputFormat* inputFormat = av_find_input_format("dshow");
AVDeviceInfoList* p;
__FFmpegReturnFalseIfFail(avdevice_list_input_sources(inputFormat,
nullptr, nullptr, &p));
This stems from here libavdevice/dshow.c
ret = dshow_cycle_devices(avctx, devenum, VideoDevice,
VideoSourceDevice, NULL, NULL, &device_list);
if (ret < S_OK)
goto error;
ret = dshow_cycle_devices(avctx, devenum, AudioDevice,
AudioSourceDevice, NULL, NULL, &device_list);
From https://learn.microsoft.com/en-us/previous-versions/ms784969(v=vs.85)
ICreateDevEnum::CreateClassEnumerator returns S_FALSE if the category does
not exist ...
So why not cycle the audio devices if the video category does not exist,
ie if specifically S_FALSE is returned. Happy to put in a patch, but does
this sound like a right ask?
My main scenario is to capture Stereo Mix Audio or any other recording
devices.
I am using this in my binary linked against FFmpeg 6_1 that I build on my
own.
$ git log -1
commit 36126e4c142e43cc703f4b8c535d388ac5e403a4 (HEAD -> master)
Author: Michael Niedermayer <michael at niedermayer.cc>
Date: Fri May 3 23:25:10 2024 +0200
avcodec/exr: Fix preview overflow
Fixes: CID1515456 Unintentional integer overflow
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
rishi at DESKTOP-0NQHKQI MINGW64 ~/localgitrepos/ffmpeg (master)
$ git branch -vv
* master 36126e4c14 [origin/master: behind 1596] avcodec/exr: Fix preview
overflow
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11163>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list