hdv1394src: Make it possible to select a camera by its GUID
authorDjalma Lúcio Soares da Silva <dlucio@impa.br>
Thu, 31 Oct 2013 15:02:11 +0000 (13:02 -0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 31 Oct 2013 16:26:08 +0000 (17:26 +0100)
The source hdv1394src has the guid property that permits select a camera
connected from its GUID number.
However when this property is setted the selected camera is not changed.
The source continues using the default camera.

This problem was solved using the function iec61883_cmp_connect.
The reference for the function could be found here:
http://www.dennedy.org/libiec61883/API-iec61883-cmp-connect.html

The solution came from dvgrab source code.

https://bugzilla.gnome.org/show_bug.cgi?id=710415

ext/raw1394/gsthdv1394src.c

index 0bfa485..a8a032a 100644 (file)
@@ -562,6 +562,22 @@ gst_hdv1394src_start (GstBaseSrc * bsrc)
   raw1394_set_userdata (src->handle, src);
   raw1394_set_bus_reset_handler (src->handle, gst_hdv1394src_bus_reset);
 
+  {
+    nodeid_t m_node = (src->avc_node | 0xffc0);
+    int m_channel = -1;
+    int m_bandwidth = 0;
+    int m_outputPort = -1;
+    int m_inputPort = -1;
+
+    m_channel = iec61883_cmp_connect (src->handle, m_node, &m_outputPort,
+        raw1394_get_local_id (src->handle), &m_inputPort, &m_bandwidth);
+
+    if (m_channel >= 0) {
+      src->channel = m_channel;
+    }
+  }
+
+
   if ((src->iec61883mpeg2 =
           iec61883_mpeg2_recv_init (src->handle,
               gst_hdv1394src_iec61883_receive, src)) == NULL)