Diederick Niehorster: > 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 <dcni...@gmail.com> > --- > libavdevice/dshow.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c > index f25537db5c..fa3a06c077 100644 > --- a/libavdevice/dshow.c > +++ b/libavdevice/dshow.c > @@ -377,6 +377,11 @@ dshow_cycle_devices(AVFormatContext *avctx, > ICreateDevEnum *devenum, > if (!device->device_name || !device->device_description) > goto fail1; > > + device->nb_media_types = nb_media_types; > + device->media_types = media_types; > + nb_media_types = 0; > + media_types = NULL; > +
If this array is intended to be given to the caller, my "put in on the stack" suggestion from #8 is no longer feasible. > // store to device_list output > if (av_reallocp_array(&(*device_list)->devices, > (*device_list)->nb_devices + 1, > @@ -412,6 +417,8 @@ dshow_cycle_devices(AVFormatContext *avctx, > ICreateDevEnum *devenum, > av_freep(&device->device_name); > if (device->device_name) > av_freep(&device->device_description); > + if (device->media_types) > + av_freep(&device->media_types); You are duplicating freeing code here: You have code to free media_types both before it was put into device and after; you can avoid the latter by only attaching media_types to device when nothing else can fail. Btw: All these checks before av_freep() here are unnecessary. > av_free(device); > } > if (olestr && co_malloc) > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".