Skip to content

Commit

Permalink
avdevice/dshow: add media type info to get_device_list
Browse files Browse the repository at this point in the history
The list returned by get_device_list now contains info about what media
type(s), if any, can be provided by each device.

Signed-off-by: Diederick Niehorster <[email protected]>
Reviewed-by: Roger Pack <[email protected]>
  • Loading branch information
dcnieho authored and GyanD committed Dec 24, 2021
1 parent a8a5303 commit e4b9aee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libavdevice/dshow.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ dshow_cycle_devices(AVFormatContext *avctx, ICreateDevEnum *devenum,
sizeof(*(*device_list)->devices)) < 0)
goto fail;

// attach media_types to device
device->nb_media_types = nb_media_types;
device->media_types = media_types;
nb_media_types = 0;
media_types = NULL;

// store device in list
(*device_list)->devices[(*device_list)->nb_devices] = device;
(*device_list)->nb_devices++;
Expand Down Expand Up @@ -412,6 +418,7 @@ dshow_cycle_devices(AVFormatContext *avctx, ICreateDevEnum *devenum,
if (device) {
av_freep(&device->device_name);
av_freep(&device->device_description);
// NB: no need to av_freep(&device->media_types), its only moved to device once nothing can fail anymore
av_free(device);
}
if (olestr && co_malloc)
Expand Down

0 comments on commit e4b9aee

Please sign in to comment.