| 1 |
/* GStreamer |
| 2 |
* Copyright (C) 2007 Julien Puydt <[email protected]> |
| 3 |
* |
| 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. |
| 8 |
* |
| 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. |
| 13 |
* |
| 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. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <libavc1394/avc1394.h> |
| 21 |
#include <libavc1394/avc1394_vcr.h> |
| 22 |
#include <libavc1394/rom1394.h> |
| 23 |
#include <libraw1394/raw1394.h> |
| 24 |
|
| 25 |
#include <gst/gst.h> |
| 26 |
|
| 27 |
#include "gst1394probe.h" |
| 28 |
|
| 29 |
#if 0 |
| 30 |
|
| 31 |
static GValueArray * |
| 32 |
gst_1394_get_guid_array (void) |
| 33 |
{ |
| 34 |
GValueArray *result = NULL; |
| 35 |
raw1394handle_t handle = NULL; |
| 36 |
int num_ports = 0; |
| 37 |
int port = 0; |
| 38 |
int num_nodes = 0; |
| 39 |
int node = 0; |
| 40 |
rom1394_directory directory; |
| 41 |
GValue value = { 0, }; |
| 42 |
|
| 43 |
handle = raw1394_new_handle (); |
| 44 |
|
| 45 |
if (handle == NULL) |
| 46 |
return NULL; |
| 47 |
|
| 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)) { |
| 57 |
if (result == NULL) |
| 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); |
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
return result; |
| 69 |
} |
| 70 |
|
| 71 |
static const GList * |
| 72 |
gst_1394_property_probe_get_properties (GstPropertyProbe * probe) |
| 73 |
{ |
| 74 |
static GList *result = NULL; |
| 75 |
GObjectClass *klass = NULL; |
| 76 |
GParamSpec *spec = NULL; |
| 77 |
|
| 78 |
if (result == NULL) { |
| 79 |
klass = G_OBJECT_GET_CLASS (probe); |
| 80 |
spec = g_object_class_find_property (klass, "guid"); |
| 81 |
result = g_list_append (result, spec); |
| 82 |
} |
| 83 |
|
| 84 |
return result; |
| 85 |
} |
| 86 |
|
| 87 |
static void |
| 88 |
gst_1394_property_probe_probe_property (GstPropertyProbe * probe, guint prop_id, |
| 89 |
const GParamSpec * pspec) |
| 90 |
{ |
| 91 |
if (!g_str_equal (pspec->name, "guid")) |
| 92 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec); |
| 93 |
} |
| 94 |
|
| 95 |
static gboolean |
| 96 |
gst_1394_property_probe_needs_probe (GstPropertyProbe * probe, guint prop_id, |
| 97 |
const GParamSpec * pspec) |
| 98 |
{ |
| 99 |
return TRUE; |
| 100 |
} |
| 101 |
|
| 102 |
static GValueArray * |
| 103 |
gst_1394_property_probe_get_values (GstPropertyProbe * probe, guint prop_id, |
| 104 |
const GParamSpec * pspec) |
| 105 |
{ |
| 106 |
GValueArray *result = NULL; |
| 107 |
|
| 108 |
if (!g_str_equal (pspec->name, "guid")) { |
| 109 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec); |
| 110 |
return NULL; |
| 111 |
} |
| 112 |
|
| 113 |
result = gst_1394_get_guid_array (); |
| 114 |
|
| 115 |
if (result == NULL) |
| 116 |
GST_LOG_OBJECT (probe, "No guid found"); |
| 117 |
|
| 118 |
return result; |
| 119 |
} |
| 120 |
|
| 121 |
static void |
| 122 |
gst_1394_property_probe_interface_init (GstPropertyProbeInterface * iface) |
| 123 |
{ |
| 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; |
| 128 |
} |
| 129 |
|
| 130 |
void |
| 131 |
gst_1394_type_add_property_probe_interface (GType type) |
| 132 |
{ |
| 133 |
static const GInterfaceInfo probe_iface_info = { |
| 134 |
(GInterfaceInitFunc) gst_1394_property_probe_interface_init, |
| 135 |
NULL, |
| 136 |
NULL, |
| 137 |
}; |
| 138 |
|
| 139 |
g_type_add_interface_static (type, GST_TYPE_PROPERTY_PROBE, |
| 140 |
&probe_iface_info); |
| 141 |
} |
| 142 |
|
| 143 |
#endif |