2 * Copyright (C) 2007 Julien Puydt <jpuydt@free.fr>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #include <libavc1394/avc1394.h>
21 #include <libavc1394/avc1394_vcr.h>
22 #include <libavc1394/rom1394.h>
23 #include <libraw1394/raw1394.h>
27 #include "gst1394probe.h"
32 gst_1394_get_guid_array (void)
34 GValueArray *result = NULL;
35 raw1394handle_t handle = NULL;
40 rom1394_directory directory;
41 GValue value = { 0, };
43 handle = raw1394_new_handle ();
48 num_ports = raw1394_get_port_info (handle, NULL, 0);
49 for (port = 0; port < num_ports; port++) {
50 if (raw1394_set_port (handle, port) >= 0) {
51 num_nodes = raw1394_get_nodecount (handle);
52 for (node = 0; node < num_nodes; node++) {
53 rom1394_get_directory (handle, node, &directory);
54 if (rom1394_get_node_type (&directory) == ROM1394_NODE_TYPE_AVC &&
55 avc1394_check_subunit_type (handle, node,
56 AVC1394_SUBUNIT_TYPE_VCR)) {
58 result = g_value_array_new (3); /* looks like a sensible default */
59 g_value_init (&value, G_TYPE_UINT64);
60 g_value_set_uint64 (&value, rom1394_get_guid (handle, node));
61 g_value_array_append (result, &value);
62 g_value_unset (&value);
72 gst_1394_property_probe_get_properties (GstPropertyProbe * probe)
74 static GList *result = NULL;
75 GObjectClass *klass = NULL;
76 GParamSpec *spec = NULL;
79 klass = G_OBJECT_GET_CLASS (probe);
80 spec = g_object_class_find_property (klass, "guid");
81 result = g_list_append (result, spec);
88 gst_1394_property_probe_probe_property (GstPropertyProbe * probe, guint prop_id,
89 const GParamSpec * pspec)
91 if (!g_str_equal (pspec->name, "guid"))
92 G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
96 gst_1394_property_probe_needs_probe (GstPropertyProbe * probe, guint prop_id,
97 const GParamSpec * pspec)
103 gst_1394_property_probe_get_values (GstPropertyProbe * probe, guint prop_id,
104 const GParamSpec * pspec)
106 GValueArray *result = NULL;
108 if (!g_str_equal (pspec->name, "guid")) {
109 G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
113 result = gst_1394_get_guid_array ();
116 GST_LOG_OBJECT (probe, "No guid found");
122 gst_1394_property_probe_interface_init (GstPropertyProbeInterface * iface)
124 iface->get_properties = gst_1394_property_probe_get_properties;
125 iface->probe_property = gst_1394_property_probe_probe_property;
126 iface->needs_probe = gst_1394_property_probe_needs_probe;
127 iface->get_values = gst_1394_property_probe_get_values;
131 gst_1394_type_add_property_probe_interface (GType type)
133 static const GInterfaceInfo probe_iface_info = {
134 (GInterfaceInitFunc) gst_1394_property_probe_interface_init,
139 g_type_add_interface_static (type, GST_TYPE_PROPERTY_PROBE,