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 358841 - [dv1394src] should have property probe
[dv1394src] should have property probe
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: 0.10.7
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 339896
 
 
Reported: 2006-10-01 19:43 UTC by Snark
Modified: 2007-11-14 19:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Header part of adding the new GObject property (259 bytes, patch)
2006-10-07 13:01 UTC, Snark
none Details | Review
Implementation part of the new GObject property (2.37 KB, patch)
2006-10-07 13:02 UTC, Snark
needs-work Details | Review
Stupid test to print the device name (347 bytes, text/x-csrc)
2007-02-12 14:27 UTC, Snark
  Details
Implementation part of the new GObject property (2.14 KB, patch)
2007-02-12 14:28 UTC, Snark
needs-work Details | Review
Header file for the property probe (1.02 KB, text/x-chdr)
2007-02-21 10:19 UTC, Snark
  Details
Implementation file for the property probe (3.91 KB, text/x-csrc)
2007-02-21 10:19 UTC, Snark
  Details
Patch to build the property probe (670 bytes, patch)
2007-02-21 10:20 UTC, Snark
none Details | Review
Patch to enable the property probe (547 bytes, patch)
2007-02-21 10:21 UTC, Snark
none Details | Review
Better test to test the property probing feature (1.74 KB, text/x-csrc)
2007-02-21 10:24 UTC, Snark
  Details
Implementation part of the new GObject property (3.44 KB, patch)
2007-02-21 14:51 UTC, Snark
none Details | Review
The patch in a single file (10.65 KB, patch)
2007-05-03 16:57 UTC, Jerome Alet
committed Details | Review

Description Snark 2006-10-01 19:43:52 UTC
Well, everything is in the title. I should be able to probe it to know which devices are available, their names and capabilities...

See bug #339896 for my motivation.
Comment 1 Snark 2006-10-03 19:27:49 UTC
Ok, since I'm an open-source developper myself, I'm pretty conscious just posting the report won't get me the feature ;-)

Here are a few pointers on what should be done, with indications how when I know.

(1) the current dv1394src doesn't provide the user-friendly name

This doesn't look that hard to add : there's already a call to rom1394_get_directory in the node discovery. It's just a matter of using rom_dir.label and storing it somewhere (a "device-name" property sounds nice).

(2) The current dv1394src doesn't have PropertyProbe introspection

I don't know exactly how this works, but I guess factoring out the current detection code would help here : the property probing should be able to return a list of either directly the port, or the ports as-uri.

Does that sound sane ?
Comment 2 Snark 2006-10-07 13:01:39 UTC
Created attachment 74208 [details] [review]
Header part of adding the new GObject property

Hopefully that header part is ok :-)
Comment 3 Snark 2006-10-07 13:02:48 UTC
Created attachment 74209 [details] [review]
Implementation part of the new GObject property

As can be seen, there's a place where I should probably add some more code. But at least the fundamentals should be right.
Comment 4 Snark 2006-10-07 14:08:19 UTC
I have two questions on the current code of dv1394src :
(1) why are strings freed in _dispose? They should be in _finalize.
(2) how come rom1394_free_directory is never called although rom1394_get_directory is?
Comment 5 Snark 2006-11-25 21:28:38 UTC
Hmmmm... could a gstreamer developper answer my questions please? I'm willing to do most of the work, but some help will definitely be needed.
Comment 6 Tim-Philipp Müller 2006-12-09 19:39:32 UTC
> I have two questions on the current code of dv1394src :
> (1) why are strings freed in _dispose? They should be in _finalize.

For all practical purposes, it doesn't really matter (as long as you keep in mind that dispose may be called multiple times). It's probably just that someone copy'n'pasted it from elsewhere. Feel free to fix and send a patch.


> (2) how come rom1394_free_directory is never called although
> rom1394_get_directory is?

(Disclaimer: I'm not familiar with the code or the library) It might just be an oversight/leak. You can verify this by running an application (or gst-launch-0.10 pipeline containing the element and triggering the code path in question) in valgrind with --leak-check=yes and see if it reports this as leak, for example. Please fix and send a patch if you find there's a leak :)


Comment 7 Snark 2006-12-09 20:56:31 UTC
Thanks for your answer.

I'll probably try to make some patches in the future, if I find the time.

What about the existing patches ?

Which of the copyright holders should I bug (pun intended) to discuss about this all ? :-)
Comment 8 Tim-Philipp Müller 2006-12-10 19:01:42 UTC
> What about the existing patches ?

Ah, sorry, missed the fact that no one has looked at them yet.

Looks good mostly, but the device-name property should probably be read-only instead of read-write. Also, you'd typically do something like g_object_notify (G_OBJECT (obj), "device-name"); when you set or change the device name from within the code.

 
> Which of the copyright holders should I bug (pun intended) to discuss about
> this all ? :-)

None of them really, at least not directly. The best place to discuss issues like this is in bugzilla (for specific issues/items/patches) or on the gstreamer-devel mailing list (for more general things). If you don't get an answer in bugzilla, it's fine to 'ping' again after a week or two without reply (either in bugzilla or on IRC).

Can't help you with the above issue (2) I'm afriad, since I don't know anything about this stuff from the library/device point of view. Just give it a try and see how far you get; you can always implement it independently first and re-factor the code later.


Comment 9 Snark 2006-12-10 19:11:35 UTC
Thanks, I'll try to have a look.
Comment 10 Snark 2007-02-12 14:27:29 UTC
Created attachment 82387 [details]
Stupid test to print the device name

This primitive program just prints the name of the default dv device.
Comment 11 Snark 2007-02-12 14:28:55 UTC
Created attachment 82388 [details] [review]
Implementation part of the new GObject property

This patch works with my test program, makes the property readonly, and calls
Comment 12 Snark 2007-02-12 14:30:47 UTC
... rom1394_free_directory after a successful rom1394_get_directory.

Sorry for the incomplete comment, my fingers slipped.
Comment 13 Snark 2007-02-14 08:29:51 UTC
Maybe I should explicitly say that I'm waiting for a review for the header&implementation of the new property : bugzilla doesn't have a "needs-review" state, it seems :-)

Then I'll try to implement the property probe which is the goal of this report.
Comment 14 Snark 2007-02-21 10:18:45 UTC
I'll attach the implementation of the property probing ; unfortunately my tests show that the patch which adds the device-name property isn't good enough yet : it doesn't initialize the property when the guid is changed -- which means I can't have the name before I really use the element.

Changing the status of the patch to reflect this.
Comment 15 Snark 2007-02-21 10:19:29 UTC
Created attachment 83027 [details]
Header file for the property probe
Comment 16 Snark 2007-02-21 10:19:51 UTC
Created attachment 83028 [details]
Implementation file for the property probe
Comment 17 Snark 2007-02-21 10:20:32 UTC
Created attachment 83029 [details] [review]
Patch to build the property probe
Comment 18 Snark 2007-02-21 10:21:00 UTC
Created attachment 83030 [details] [review]
Patch to enable the property probe
Comment 19 Snark 2007-02-21 10:24:12 UTC
Created attachment 83031 [details]
Better test to test the property probing feature
Comment 20 Snark 2007-02-21 14:51:29 UTC
Created attachment 83041 [details] [review]
Implementation part of the new GObject property

This new version adds a new function, which is called when the guid property is set : this makes sure that the test runs perfectly.
Comment 21 Snark 2007-03-29 14:57:59 UTC
What should I do to make this code go in ?
Comment 22 Jerome Alet 2007-05-03 16:57:23 UTC
Created attachment 87468 [details] [review]
The patch in a single file

This is the otherwise unmodified patch, but in a single file which is easier to apply (tested against cvs today May 3rd 2007). It seems to work fine for me with a Canopus ADVC55 but not with an ADVC700 for which "Default" is always returned. I don't know if this is a limitation of the ADVC700 or a problem with the code, which I haven't even read.
Comment 23 Snark 2007-10-27 11:54:02 UTC
Could this bug be fixed before the next set of releases?
Comment 24 Tim-Philipp Müller 2007-11-14 19:14:01 UTC
Committed with small changes:

 2007-11-14  Tim-Philipp Müller  <tim at centricular dot net>

	Patch by: Julien Puydt <julien dot puydt at laposte net>

	* ext/raw1394/Makefile.am:
	* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
	  (gst_1394_property_probe_get_properties),
	  (gst_1394_property_probe_probe_property),
	  (gst_1394_property_probe_needs_probe),
	  (gst_1394_property_probe_get_values),
	  (gst_1394_property_probe_interface_init),
	  (gst_1394_type_add_property_probe_interface):
	* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
	* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
	  (gst_dv1394src_init), (gst_dv1394src_dispose),
	  (gst_dv1394src_set_property), (gst_dv1394src_get_property),
	  (gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
	  (gst_dv1394src_update_device_name):
	* ext/raw1394/gstdv1394src.h:
	  Implement GstPropertyProbe interface and add "device-name" property,
	  so applications can use this to probe for available devices in the
	  same way they can already with v4lsrc and v4l2src (however horrible
	  this property probe interface may be). Fixes #358841.

(renamed new files to make the filename slighty shorter; renamed _find_device_name() to _update_device_name(); added rom1394_free_directory() in update_device_name() and some additional checks/logging; removed FIXME in gst_dv1394src_discover_avc_node() - calling update_device_name() shouldn't be necessary there, because that branch is executed only if a GUID has been set explicitly, at which point the name would already have been updated via the set_property function).

Please test version in CVS to make sure I didn't mess anything up.

Thanks a lot for the patch, and sorry for the long wait.