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., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, 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"
28 #include "gst/interfaces/propertyprobe.h"
31 gst_1394_get_guid_array (void)
33 GValueArray *result = NULL;
34 raw1394handle_t handle = NULL;
39 rom1394_directory directory;
40 GValue value = { 0, };
42 handle = raw1394_new_handle ();
47 num_ports = raw1394_get_port_info (handle, NULL, 0);
48 for (port = 0; port < num_ports; port++) {
49 if (raw1394_set_port (handle, port) >= 0) {
50 num_nodes = raw1394_get_nodecount (handle);
51 for (node = 0; node < num_nodes; node++) {
52 rom1394_get_directory (handle, node, &directory);
53 if (rom1394_get_node_type (&directory) == ROM1394_NODE_TYPE_AVC &&
54 avc1394_check_subunit_type (handle, node,
55 AVC1394_SUBUNIT_TYPE_VCR)) {
57 result = g_value_array_new (3); /* looks like a sensible default */
58 g_value_init (&value, G_TYPE_UINT64);
59 g_value_set_uint64 (&value, rom1394_get_guid (handle, node));
60 g_value_array_append (result, &value);
61 g_value_unset (&value);
71 gst_1394_property_probe_get_properties (GstPropertyProbe * probe)
73 static GList *result = NULL;
74 GObjectClass *klass = NULL;
75 GParamSpec *spec = NULL;
78 klass = G_OBJECT_GET_CLASS (probe);
79 spec = g_object_class_find_property (klass, "guid");
80 result = g_list_append (result, spec);
87 gst_1394_property_probe_probe_property (GstPropertyProbe * probe, guint prop_id,
88 const GParamSpec * pspec)
90 if (!g_str_equal (pspec->name, "guid"))
91 G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
95 gst_1394_property_probe_needs_probe (GstPropertyProbe * probe, guint prop_id,
96 const GParamSpec * pspec)
102 gst_1394_property_probe_get_values (GstPropertyProbe * probe, guint prop_id,
103 const GParamSpec * pspec)
105 GValueArray *result = NULL;
107 if (!g_str_equal (pspec->name, "guid")) {
108 G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
112 result = gst_1394_get_guid_array ();
115 GST_LOG_OBJECT (probe, "No guid found");
121 gst_1394_property_probe_interface_init (GstPropertyProbeInterface * iface)
123 iface->get_properties = gst_1394_property_probe_get_properties;
124 iface->probe_property = gst_1394_property_probe_probe_property;
125 iface->needs_probe = gst_1394_property_probe_needs_probe;
126 iface->get_values = gst_1394_property_probe_get_values;
130 gst_1394_type_add_property_probe_interface (GType type)
132 static const GInterfaceInfo probe_iface_info = {
133 (GInterfaceInitFunc) gst_1394_property_probe_interface_init,
138 g_type_add_interface_static (type, GST_TYPE_PROPERTY_PROBE,