After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 797338 - dshowvideosrc: add device-index, add GstDeviceMonitor, and several fixes
dshowvideosrc: add device-index, add GstDeviceMonitor, and several fixes
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Windows
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-10-26 16:10 UTC by Joshua M. Doe
Modified: 2018-11-03 14:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001 - dshowsrcwrapper: add debug category for general dshowsrcwrapper (1.57 KB, patch)
2018-10-26 16:10 UTC, Joshua M. Doe
committed Details | Review
0002 - dshowsrcwrapper: support building 32- and 64-bit with CMake (1.84 KB, patch)
2018-10-26 16:12 UTC, Joshua M. Doe
committed Details | Review
0003 - dshowsrcwrapper: update CMake build instructions (1.82 KB, patch)
2018-10-26 16:12 UTC, Joshua M. Doe
committed Details | Review
0004 - dshowsrcwrapper: add device-index property to sources (8.81 KB, patch)
2018-10-26 16:13 UTC, Joshua M. Doe
committed Details | Review
0005 - dshowsrcwrapper: add some helpful debug statements (2.75 KB, patch)
2018-10-26 16:13 UTC, Joshua M. Doe
reviewed Details | Review
0006 - dshowvideosrc: fix template caps to reflect actual supported caps (1.29 KB, patch)
2018-10-26 16:14 UTC, Joshua M. Doe
accepted-commit_now Details | Review
0007 - dshowvideosrc: delay selecting device until source is started (3.58 KB, patch)
2018-10-26 16:15 UTC, Joshua M. Doe
needs-work Details | Review
0008 - dshowvideosrc: handle empty strings for device and device-name (3.25 KB, patch)
2018-10-26 16:15 UTC, Joshua M. Doe
reviewed Details | Review
0009 - dshowsrcwrapper: add get_property implementation to sources (2.18 KB, patch)
2018-10-26 16:15 UTC, Joshua M. Doe
accepted-commit_now Details | Review
0010 - dshowsrcwrapper: refactor device selection, filter creation, and caps retrieval (19.18 KB, patch)
2018-10-26 16:16 UTC, Joshua M. Doe
reviewed Details | Review
0011 - dshowsrcwrapper: add implementation of GstDeviceMonitor (15.77 KB, patch)
2018-10-26 16:16 UTC, Joshua M. Doe
needs-work Details | Review

Description Joshua M. Doe 2018-10-26 16:10:51 UTC
Created attachment 374042 [details] [review]
0001 - dshowsrcwrapper: add debug category for general dshowsrcwrapper

It seems the DirectShow source dshowvideosrc hasn't seen much attention lately. The plugin winks provides ksvideosrc which supports most modern video sources, that is devices supporting the USB Video Class (UVC). However there are still several sources which are stuck with DirectShow, which I happen to be stuck using, so I worked on it a bit to make it usable for me.

They can be seen here:
https://github.com/joshdoe/gst-plugins-bad/tree/dshowsrc

There are 11 patches, should I upload them all here? I already did some squashing, but perhaps could go further to limit the number of patches.
Comment 1 Joshua M. Doe 2018-10-26 16:12:23 UTC
Created attachment 374043 [details] [review]
0002 - dshowsrcwrapper: support building 32- and 64-bit with CMake
Comment 2 Joshua M. Doe 2018-10-26 16:12:54 UTC
Created attachment 374044 [details] [review]
0003 - dshowsrcwrapper: update CMake build instructions
Comment 3 Joshua M. Doe 2018-10-26 16:13:33 UTC
Created attachment 374045 [details] [review]
0004 - dshowsrcwrapper: add device-index property to sources
Comment 4 Joshua M. Doe 2018-10-26 16:13:52 UTC
Created attachment 374046 [details] [review]
0005 - dshowsrcwrapper: add some helpful debug statements
Comment 5 Joshua M. Doe 2018-10-26 16:14:34 UTC
Created attachment 374047 [details] [review]
0006 - dshowvideosrc: fix template caps to reflect actual supported caps
Comment 6 Joshua M. Doe 2018-10-26 16:15:04 UTC
Created attachment 374048 [details] [review]
0007 - dshowvideosrc: delay selecting device until source is started
Comment 7 Joshua M. Doe 2018-10-26 16:15:23 UTC
Created attachment 374049 [details] [review]
0008 - dshowvideosrc: handle empty strings for device and device-name
Comment 8 Joshua M. Doe 2018-10-26 16:15:44 UTC
Created attachment 374050 [details] [review]
0009 - dshowsrcwrapper: add get_property implementation to sources
Comment 9 Joshua M. Doe 2018-10-26 16:16:00 UTC
Created attachment 374051 [details] [review]
0010 - dshowsrcwrapper: refactor device selection, filter creation, and caps retrieval
Comment 10 Joshua M. Doe 2018-10-26 16:16:21 UTC
Created attachment 374052 [details] [review]
0011 - dshowsrcwrapper: add implementation of GstDeviceMonitor
Comment 11 Nirbheek Chauhan 2018-10-27 14:52:27 UTC
Review of attachment 374042 [details] [review]:

lgtm
Comment 12 Nirbheek Chauhan 2018-10-27 14:57:50 UTC
Review of attachment 374043 [details] [review]:

We support building all of gstreamer with MSVC with Meson now, and we intend to remove these old CMake files. This will likely happen immmediately after the 1.16 release. Please try to move your workflow to Meson. :)
Comment 13 Nirbheek Chauhan 2018-10-27 14:58:54 UTC
Review of attachment 374044 [details] [review]:

lgtm, with the caveat that this will be removed after 1.16 is released.
Comment 14 Nirbheek Chauhan 2018-10-27 15:03:07 UTC
Review of attachment 374045 [details] [review]:

lgtm
Comment 15 Nirbheek Chauhan 2018-10-27 19:58:01 UTC
Review of attachment 374046 [details] [review]:

::: sys/dshowsrcwrapper/gstdshowvideosrc.cpp
@@ +486,3 @@
   GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (bsrc);
   
+  GST_DEBUG_OBJECT (src, "start");

Is this a stray debug log? If not this should contain more information.
Comment 16 Nirbheek Chauhan 2018-10-27 20:14:42 UTC
Review of attachment 374048 [details] [review]:

::: sys/dshowsrcwrapper/gstdshowvideosrc.cpp
@@ +497,3 @@
+
+  gst_dshowvideosrc_create_capture_filter (src);
+

The device should indeed not be opened in get_caps, but it should also not be opened in start(), it should be opened in change_state() when going from NULL -> READY. See the winks src for an example.

dshowsrcvideo also already has gst_dshowvideosrc_change_state() so this function need to just be moved there.
Comment 17 Nirbheek Chauhan 2018-10-27 20:19:35 UTC
Review of attachment 374049 [details] [review]:

It this required to handle cases where the user has set the property to "" instead of not setting it at all?
Comment 18 Nirbheek Chauhan 2018-10-27 20:54:08 UTC
Review of attachment 374051 [details] [review]:

::: sys/dshowsrcwrapper/gstdshow.cpp
@@ +34,3 @@
 };
 
+

Accidental whitespace?

@@ +360,3 @@
+        gchar *friendly_name =
+            g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
+            wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL);

Maybe you want to refactor this into a utility function? I noticed that you were repeating this a lot in various files. :)
Comment 19 Nirbheek Chauhan 2018-10-27 20:57:16 UTC
Review of attachment 374052 [details] [review]:

Looks good overall! Can be pushed once the copyright header is fixed.

::: sys/dshowsrcwrapper/dshowdeviceprovider.c
@@ +3,3 @@
+ *
+ * ksdeviceprovider.c: Kernel Streaming device probing and monitoring
+ *

Fix the author and the filename please.

@@ +56,3 @@
+
+  GST_DEBUG ("class init");
+

This is not needed.

::: sys/dshowsrcwrapper/dshowdeviceprovider.h
@@ +3,3 @@
+ *
+ * ksdeviceprovider.h: Kernel Streaming device probing and monitoring
+ *

Same.
Comment 20 Joshua M. Doe 2018-10-30 11:52:00 UTC
Review of attachment 374046 [details] [review]:

Yes, stray debug log.
Comment 21 Joshua M. Doe 2018-10-30 12:16:59 UTC
Review of attachment 374048 [details] [review]:

I'm not clear on this one. What problems can arise by opening the device in start() as opposed to the NULL->READY state change? Looking through many source elements in -good, some seem to open devices in start(), and some during NULL->READY. Perhaps the documentation on start() needs to be improved, as it currently states "Subclasses should open resources and prepare to produce data". If I should move device opening to the NULL->READY state change, what do I leave in start()?
Comment 22 Joshua M. Doe 2018-10-30 12:19:52 UTC
Review of attachment 374049 [details] [review]:

Yes, several applications I've come across set empty strings instead of NULL, and looking across other elements, many handle them equivalently.
Comment 23 Joshua M. Doe 2018-10-30 13:29:23 UTC
Review of attachment 374051 [details] [review]:

Ok I'll fix these.
Comment 24 GStreamer system administrator 2018-11-03 14:37:00 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/807.