2 * Copyright (C) <2008> Edward Hervey <bilboed@bilboed.com>
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 * SECTION:element-hdv1394src
22 * Read MPEG-TS data from firewire port.
25 * <title>Example launch line</title>
27 * gst-launch-1.0 hdv1394src ! queue ! decodebin name=d ! queue ! xvimagesink d. ! queue ! alsasink
28 * ]| captures from the firewire port and plays the streams.
30 * gst-launch-1.0 hdv1394src ! queue ! filesink location=mydump.ts
31 * ]| capture to a disk file
40 #include <sys/socket.h>
46 #include <libavc1394/avc1394.h>
47 #include <libavc1394/avc1394_vcr.h>
48 #include <libavc1394/rom1394.h>
49 #include <libraw1394/raw1394.h>
50 #include <libiec61883/iec61883.h>
54 #include "gsthdv1394src.h"
55 #include "gst1394probe.h"
58 #define CONTROL_STOP 'S' /* stop the select call */
59 #define CONTROL_SOCKETS(src) src->control_sock
60 #define WRITE_SOCKET(src) src->control_sock[1]
61 #define READ_SOCKET(src) src->control_sock[0]
63 #define SEND_COMMAND(src, command) \
65 int G_GNUC_UNUSED _res; unsigned char c; c = command; \
66 _res = write (WRITE_SOCKET(src), &c, 1); \
69 #define READ_COMMAND(src, command, res) \
71 res = read(READ_SOCKET(src), &command, 1); \
75 GST_DEBUG_CATEGORY_STATIC (hdv1394src_debug);
76 #define GST_CAT_DEFAULT (hdv1394src_debug)
78 #define DEFAULT_PORT -1
79 #define DEFAULT_CHANNEL 63
80 #define DEFAULT_USE_AVC TRUE
81 #define DEFAULT_GUID 0
93 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
97 ("video/mpegts,systemstream=(boolean)true,packetsize=(int)188")
100 static void gst_hdv1394src_uri_handler_init (gpointer g_iface,
101 gpointer iface_data);
103 static void gst_hdv1394src_set_property (GObject * object, guint prop_id,
104 const GValue * value, GParamSpec * pspec);
105 static void gst_hdv1394src_get_property (GObject * object, guint prop_id,
106 GValue * value, GParamSpec * pspec);
107 static void gst_hdv1394src_dispose (GObject * object);
109 static gboolean gst_hdv1394src_start (GstBaseSrc * bsrc);
110 static gboolean gst_hdv1394src_stop (GstBaseSrc * bsrc);
111 static gboolean gst_hdv1394src_unlock (GstBaseSrc * bsrc);
113 static GstFlowReturn gst_hdv1394src_create (GstPushSrc * psrc,
116 static void gst_hdv1394src_update_device_name (GstHDV1394Src * src);
118 #define gst_hdv1394src_parent_class parent_class
119 G_DEFINE_TYPE_WITH_CODE (GstHDV1394Src, gst_hdv1394src, GST_TYPE_PUSH_SRC,
120 G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
121 gst_hdv1394src_uri_handler_init));
124 gst_hdv1394src_class_init (GstHDV1394SrcClass * klass)
126 GObjectClass *gobject_class;
127 GstElementClass *gstelement_class;
128 GstBaseSrcClass *gstbasesrc_class;
129 GstPushSrcClass *gstpushsrc_class;
131 gobject_class = (GObjectClass *) klass;
132 gstelement_class = (GstElementClass *) klass;
133 gstbasesrc_class = (GstBaseSrcClass *) klass;
134 gstpushsrc_class = (GstPushSrcClass *) klass;
136 gobject_class->set_property = gst_hdv1394src_set_property;
137 gobject_class->get_property = gst_hdv1394src_get_property;
138 gobject_class->dispose = gst_hdv1394src_dispose;
140 g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
141 g_param_spec_int ("port", "Port", "Port number (-1 automatic)",
142 -1, 16, DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
143 g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CHANNEL,
144 g_param_spec_int ("channel", "Channel", "Channel number for listening",
145 0, 64, DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
146 g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_USE_AVC,
147 g_param_spec_boolean ("use-avc", "Use AV/C", "Use AV/C VTR control",
148 DEFAULT_USE_AVC, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
149 g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GUID,
150 g_param_spec_uint64 ("guid", "GUID",
151 "select one of multiple DV devices by its GUID. use a hexadecimal "
152 "like 0xhhhhhhhhhhhhhhhh. (0 = no guid)", 0, G_MAXUINT64,
153 DEFAULT_GUID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
155 * GstHDV1394Src:device-name
157 * Descriptive name of the currently opened device
161 g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE_NAME,
162 g_param_spec_string ("device-name", "device name",
163 "user-friendly name of the device", "Default",
164 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
166 gstbasesrc_class->negotiate = NULL;
167 gstbasesrc_class->start = gst_hdv1394src_start;
168 gstbasesrc_class->stop = gst_hdv1394src_stop;
169 gstbasesrc_class->unlock = gst_hdv1394src_unlock;
171 gstpushsrc_class->create = gst_hdv1394src_create;
173 gst_element_class_add_pad_template (gstelement_class,
174 gst_static_pad_template_get (&src_factory));
176 gst_element_class_set_static_metadata (gstelement_class,
177 "Firewire (1394) HDV video source", "Source/Video",
178 "Source for MPEG-TS video data from firewire port",
179 "Edward Hervey <bilboed@bilboed.com>");
181 GST_DEBUG_CATEGORY_INIT (hdv1394src_debug, "hdv1394src", 0,
182 "MPEG-TS firewire source");
186 gst_hdv1394src_init (GstHDV1394Src * dv1394src)
188 GstPad *srcpad = GST_BASE_SRC_PAD (dv1394src);
190 gst_base_src_set_live (GST_BASE_SRC (dv1394src), TRUE);
191 gst_pad_use_fixed_caps (srcpad);
193 dv1394src->port = DEFAULT_PORT;
194 dv1394src->channel = DEFAULT_CHANNEL;
196 dv1394src->use_avc = DEFAULT_USE_AVC;
197 dv1394src->guid = DEFAULT_GUID;
198 dv1394src->uri = g_strdup_printf ("hdv://%d", dv1394src->port);
199 dv1394src->device_name = g_strdup_printf ("Default");
201 READ_SOCKET (dv1394src) = -1;
202 WRITE_SOCKET (dv1394src) = -1;
204 dv1394src->frame_sequence = 0;
208 gst_hdv1394src_dispose (GObject * object)
210 GstHDV1394Src *src = GST_HDV1394SRC (object);
215 g_free (src->device_name);
216 src->device_name = NULL;
218 G_OBJECT_CLASS (parent_class)->dispose (object);
222 gst_hdv1394src_set_property (GObject * object, guint prop_id,
223 const GValue * value, GParamSpec * pspec)
225 GstHDV1394Src *filter = GST_HDV1394SRC (object);
229 filter->port = g_value_get_int (value);
230 g_free (filter->uri);
231 filter->uri = g_strdup_printf ("hdv://%d", filter->port);
234 filter->channel = g_value_get_int (value);
237 filter->use_avc = g_value_get_boolean (value);
240 filter->guid = g_value_get_uint64 (value);
241 gst_hdv1394src_update_device_name (filter);
249 gst_hdv1394src_get_property (GObject * object, guint prop_id, GValue * value,
252 GstHDV1394Src *filter = GST_HDV1394SRC (object);
256 g_value_set_int (value, filter->port);
259 g_value_set_int (value, filter->channel);
262 g_value_set_boolean (value, filter->use_avc);
265 g_value_set_uint64 (value, filter->guid);
267 case PROP_DEVICE_NAME:
268 g_value_set_string (value, filter->device_name);
271 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
276 static GstHDV1394Src *
277 gst_hdv1394src_from_raw1394handle (raw1394handle_t handle)
279 iec61883_mpeg2_t mpeg2 = (iec61883_mpeg2_t) raw1394_get_userdata (handle);
280 return GST_HDV1394SRC (iec61883_mpeg2_get_callback_data (mpeg2));
283 /* Within one loop iteration (which may call _receive() many times), it seems
284 * as though '*data' will always be different.
286 * We can therefore assume that any '*data' given to us will stay allocated until
287 * the next loop iteration.
291 gst_hdv1394src_iec61883_receive (unsigned char *data, int len,
292 unsigned int dropped, void *cbdata)
294 GstHDV1394Src *dv1394src = GST_HDV1394SRC (cbdata);
296 GST_LOG ("data:%p, len:%d, dropped:%d", data, len, dropped);
298 /* error out if we don't have enough room ! */
299 if (G_UNLIKELY (dv1394src->outoffset > (2048 * 188 - len)))
302 if (G_LIKELY (len == IEC61883_MPEG2_TSP_SIZE)) {
303 memcpy ((guint8 *) dv1394src->outdata + dv1394src->outoffset, data, len);
304 dv1394src->outoffset += len;
306 dv1394src->frame_sequence++;
311 * When an ieee1394 bus reset happens, usually a device has been removed
312 * or added. We send a message on the message bus with the node count
313 * and whether the capture device used in this element connected, disconnected
316 * nodecount - integer with number of nodes on bus
317 * current-device-change - integer (1 if device connected, 0 if no change to
318 * current device status, -1 if device disconnected)
321 gst_hdv1394src_bus_reset (raw1394handle_t handle, unsigned int generation)
326 GstStructure *structure;
327 gint current_device_change;
330 src = gst_hdv1394src_from_raw1394handle (handle);
332 GST_INFO_OBJECT (src, "have bus reset");
334 /* update generation - told to do so by docs */
335 raw1394_update_generation (handle, generation);
336 nodecount = raw1394_get_nodecount (handle);
337 /* allocate memory for portinfo */
339 /* current_device_change is -1 if camera disconnected, 0 if other device
340 * connected or 1 if camera has now connected */
341 current_device_change = -1;
342 for (i = 0; i < nodecount; i++) {
343 if (src->guid == rom1394_get_guid (handle, i)) {
344 /* Camera is with us */
345 GST_DEBUG ("Camera is with us");
346 if (!src->connected) {
347 current_device_change = 1;
348 src->connected = TRUE;
350 current_device_change = 0;
353 if (src->connected && current_device_change == -1) {
354 GST_DEBUG ("Camera has disconnected");
355 src->connected = FALSE;
356 } else if (!src->connected && current_device_change == -1) {
357 GST_DEBUG ("Camera is still not with us");
358 current_device_change = 0;
361 structure = gst_structure_new ("ieee1394-bus-reset", "nodecount", G_TYPE_INT,
362 nodecount, "current-device-change", G_TYPE_INT, current_device_change,
364 message = gst_message_new_element (GST_OBJECT (src), structure);
365 gst_element_post_message (GST_ELEMENT (src), message);
371 gst_hdv1394src_create (GstPushSrc * psrc, GstBuffer ** buf)
373 GstHDV1394Src *dv1394src = GST_HDV1394SRC (psrc);
374 struct pollfd pollfds[2];
376 pollfds[0].fd = raw1394_get_fd (dv1394src->handle);
377 pollfds[0].events = POLLIN | POLLERR | POLLHUP | POLLPRI;
378 pollfds[1].fd = READ_SOCKET (dv1394src);
379 pollfds[1].events = POLLIN | POLLERR | POLLHUP | POLLPRI;
381 /* allocate a 2048 samples buffer */
382 dv1394src->outdata = g_malloc (2048 * 188);
383 dv1394src->outoffset = 0;
385 GST_DEBUG ("Create...");
388 int res = poll (pollfds, 2, -1);
390 GST_LOG ("res:%d", res);
392 if (G_UNLIKELY (res < 0)) {
393 if (errno == EAGAIN || errno == EINTR)
396 goto error_while_polling;
399 if (G_UNLIKELY (pollfds[1].revents)) {
402 if (pollfds[1].revents & POLLIN)
403 READ_COMMAND (dv1394src, command, res);
406 } else if (G_LIKELY (pollfds[0].revents & POLLIN)) {
409 pt = dv1394src->frame_sequence;
410 /* shouldn't block in theory */
411 GST_LOG ("Iterating ! (%d)", dv1394src->frame_sequence);
412 raw1394_loop_iterate (dv1394src->handle);
413 GST_LOG ("After iteration : %d (diff:%d)",
414 dv1394src->frame_sequence, dv1394src->frame_sequence - pt);
415 if (dv1394src->outoffset)
420 g_assert (dv1394src->outoffset);
422 GST_LOG ("We have some frames (%u bytes)", (guint) dv1394src->outoffset);
424 /* Create the buffer */
425 *buf = gst_buffer_new_wrapped (dv1394src->outdata, dv1394src->outoffset);
426 dv1394src->outdata = NULL;
427 dv1394src->outoffset = 0;
433 GST_ELEMENT_ERROR (dv1394src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
438 GST_DEBUG_OBJECT (dv1394src, "told to stop, shutting down");
439 return GST_FLOW_FLUSHING;
444 gst_hdv1394src_discover_avc_node (GstHDV1394Src * src)
448 int m = src->num_ports;
450 if (src->port >= 0) {
451 /* search on explicit port */
456 /* loop over all our ports */
457 for (; j < m && node == -1; j++) {
458 raw1394handle_t handle;
459 struct raw1394_portinfo pinf[16];
462 handle = raw1394_new_handle ();
464 GST_WARNING ("raw1394 - failed to get handle: %s.\n", strerror (errno));
467 if (raw1394_get_port_info (handle, pinf, 16) < 0) {
468 GST_WARNING ("raw1394 - failed to get port info: %s.\n",
473 /* tell raw1394 which host adapter to use */
474 if (raw1394_set_port (handle, j) < 0) {
475 GST_WARNING ("raw1394 - failed to set set port: %s.\n", strerror (errno));
479 /* now loop over all the nodes */
480 for (i = 0; i < raw1394_get_nodecount (handle); i++) {
481 /* are we looking for an explicit GUID ? */
482 if (src->guid != 0) {
483 if (src->guid == rom1394_get_guid (handle, i)) {
487 src->uri = g_strdup_printf ("dv://%d", src->port);
491 rom1394_directory rom_dir;
493 /* select first AV/C Tape Recorder Player node */
494 if (rom1394_get_directory (handle, i, &rom_dir) < 0) {
495 GST_WARNING ("error reading config rom directory for node %d\n", i);
498 if ((rom1394_get_node_type (&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
499 avc1394_check_subunit_type (handle, i, AVC1394_SUBUNIT_TYPE_VCR)) {
502 src->guid = rom1394_get_guid (handle, i);
504 src->uri = g_strdup_printf ("dv://%d", src->port);
505 g_free (src->device_name);
506 src->device_name = g_strdup (rom_dir.label);
509 rom1394_free_directory (&rom_dir);
513 raw1394_destroy_handle (handle);
519 gst_hdv1394src_start (GstBaseSrc * bsrc)
521 GstHDV1394Src *src = GST_HDV1394SRC (bsrc);
524 src->connected = FALSE;
526 if (socketpair (PF_UNIX, SOCK_STREAM, 0, control_sock) < 0)
529 READ_SOCKET (src) = control_sock[0];
530 WRITE_SOCKET (src) = control_sock[1];
532 fcntl (READ_SOCKET (src), F_SETFL, O_NONBLOCK);
533 fcntl (WRITE_SOCKET (src), F_SETFL, O_NONBLOCK);
535 src->handle = raw1394_new_handle ();
539 goto permission_denied;
540 else if (errno == ENOENT)
546 src->num_ports = raw1394_get_port_info (src->handle, src->pinfo, 16);
548 if (src->num_ports == 0)
551 if (src->use_avc || src->port == -1)
552 src->avc_node = gst_hdv1394src_discover_avc_node (src);
554 /* lets destroy handle and create one on port
555 this is more reliable than setting port on
556 the existing handle */
557 raw1394_destroy_handle (src->handle);
558 src->handle = raw1394_new_handle_on_port (src->port);
560 goto cannot_set_port;
562 raw1394_set_userdata (src->handle, src);
563 raw1394_set_bus_reset_handler (src->handle, gst_hdv1394src_bus_reset);
565 if ((src->iec61883mpeg2 =
566 iec61883_mpeg2_recv_init (src->handle,
567 gst_hdv1394src_iec61883_receive, src)) == NULL)
568 goto cannot_initialise_dv;
571 raw1394_set_iso_handler (src->handle, src->channel,
572 gst_hdv1394src_iso_receive);
575 GST_DEBUG_OBJECT (src, "successfully opened up 1394 connection");
576 src->connected = TRUE;
578 if (iec61883_mpeg2_recv_start (src->iec61883mpeg2, src->channel) != 0)
581 if (raw1394_start_iso_rcv (src->handle, src->channel) < 0)
586 raw1394handle_t avc_handle = raw1394_new_handle_on_port (src->port);
588 GST_LOG ("We have an avc_handle");
592 if (!avc1394_vcr_is_recording (avc_handle, src->avc_node)
593 && avc1394_vcr_is_playing (avc_handle, src->avc_node)
594 != AVC1394_VCR_OPERAND_PLAY_FORWARD) {
595 GST_LOG ("Calling avc1394_vcr_play()");
596 avc1394_vcr_play (avc_handle, src->avc_node);
598 raw1394_destroy_handle (avc_handle);
600 GST_WARNING_OBJECT (src, "Starting VCR via avc1394 failed: %s",
609 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL),
615 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM);
620 GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL), GST_ERROR_SYSTEM);
625 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
626 ("can't get raw1394 handle (%s)", g_strerror (errno)));
631 raw1394_destroy_handle (src->handle);
633 GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
634 ("no ports available for raw1394"));
639 GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
640 ("can't set 1394 port %d", src->port));
645 raw1394_destroy_handle (src->handle);
647 iec61883_mpeg2_close (src->iec61883mpeg2);
648 src->iec61883mpeg2 = NULL;
649 GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
650 ("can't start 1394 iso receive"));
653 cannot_initialise_dv:
655 raw1394_destroy_handle (src->handle);
657 GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
658 ("can't initialise iec61883 hdv"));
664 gst_hdv1394src_stop (GstBaseSrc * bsrc)
666 GstHDV1394Src *src = GST_HDV1394SRC (bsrc);
668 close (READ_SOCKET (src));
669 close (WRITE_SOCKET (src));
670 READ_SOCKET (src) = -1;
671 WRITE_SOCKET (src) = -1;
673 iec61883_mpeg2_close (src->iec61883mpeg2);
675 raw1394_stop_iso_rcv (src->handle, src->channel);
679 raw1394handle_t avc_handle = raw1394_new_handle_on_port (src->port);
681 /* pause and stop the VCR */
683 if (!avc1394_vcr_is_recording (avc_handle, src->avc_node)
684 && (avc1394_vcr_is_playing (avc_handle, src->avc_node)
685 != AVC1394_VCR_OPERAND_PLAY_FORWARD_PAUSE))
686 avc1394_vcr_pause (avc_handle, src->avc_node);
687 avc1394_vcr_stop (avc_handle, src->avc_node);
688 raw1394_destroy_handle (avc_handle);
690 GST_WARNING_OBJECT (src, "Starting VCR via avc1394 failed: %s",
695 raw1394_destroy_handle (src->handle);
701 gst_hdv1394src_unlock (GstBaseSrc * bsrc)
703 GstHDV1394Src *src = GST_HDV1394SRC (bsrc);
705 SEND_COMMAND (src, CONTROL_STOP);
711 gst_hdv1394src_update_device_name (GstHDV1394Src * src)
713 raw1394handle_t handle;
714 gint portcount, port, nodecount, node;
715 rom1394_directory directory;
717 g_free (src->device_name);
718 src->device_name = NULL;
720 GST_LOG_OBJECT (src, "updating device name for current GUID");
722 handle = raw1394_new_handle ();
725 goto gethandle_failed;
727 portcount = raw1394_get_port_info (handle, NULL, 0);
728 for (port = 0; port < portcount; port++) {
729 if (raw1394_set_port (handle, port) >= 0) {
730 nodecount = raw1394_get_nodecount (handle);
731 for (node = 0; node < nodecount; node++) {
732 if (src->guid == rom1394_get_guid (handle, node)) {
733 if (rom1394_get_directory (handle, node, &directory) >= 0) {
734 g_free (src->device_name);
735 src->device_name = g_strdup (directory.label);
736 rom1394_free_directory (&directory);
739 GST_WARNING ("error reading rom directory for node %d", node);
746 src->device_name = g_strdup ("Unknown"); /* FIXME: translate? */
750 raw1394_destroy_handle (handle);
756 GST_WARNING ("failed to get raw1394 handle: %s", g_strerror (errno));
757 src->device_name = g_strdup ("Unknown"); /* FIXME: translate? */
762 /*** GSTURIHANDLER INTERFACE *************************************************/
765 gst_hdv1394src_uri_get_type (GType type)
770 static const gchar *const *
771 gst_hdv1394src_uri_get_protocols (GType type)
773 static const gchar *protocols[] = { (char *) "hdv", NULL };
779 gst_hdv1394src_uri_get_uri (GstURIHandler * handler)
781 GstHDV1394Src *gst_hdv1394src = GST_HDV1394SRC (handler);
783 return gst_hdv1394src->uri;
787 gst_hdv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
790 gchar *protocol, *location;
792 GstHDV1394Src *gst_hdv1394src = GST_HDV1394SRC (handler);
794 protocol = gst_uri_get_protocol (uri);
795 if (strcmp (protocol, "hdv") != 0) {
797 g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
803 location = gst_uri_get_location (uri);
804 if (location && *location != '\0')
805 gst_hdv1394src->port = strtol (location, NULL, 10);
807 gst_hdv1394src->port = DEFAULT_PORT;
809 g_free (gst_hdv1394src->uri);
810 gst_hdv1394src->uri = g_strdup_printf ("hdv://%d", gst_hdv1394src->port);
816 gst_hdv1394src_uri_handler_init (gpointer g_iface, gpointer iface_data)
818 GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
820 iface->get_type = gst_hdv1394src_uri_get_type;
821 iface->get_protocols = gst_hdv1394src_uri_get_protocols;
822 iface->get_uri = gst_hdv1394src_uri_get_uri;
823 iface->set_uri = gst_hdv1394src_uri_set_uri;