void AVC1394Control::play() { //printf("AVC1394Control::play(): 1\n"); device_lock->lock("AVC1394Control::play"); avc1394_vcr_play(handle, device); device_lock->unlock(); }
static gboolean gst_hdv1394src_start (GstBaseSrc * bsrc) { GstHDV1394Src *src = GST_HDV1394SRC (bsrc); int control_sock[2]; src->connected = FALSE; if (socketpair (PF_UNIX, SOCK_STREAM, 0, control_sock) < 0) goto socket_pair; READ_SOCKET (src) = control_sock[0]; WRITE_SOCKET (src) = control_sock[1]; if (fcntl (READ_SOCKET (src), F_SETFL, O_NONBLOCK) < 0) GST_ERROR_OBJECT (src, "failed to make read socket non-blocking: %s", g_strerror (errno)); if (fcntl (WRITE_SOCKET (src), F_SETFL, O_NONBLOCK) < 0) GST_ERROR_OBJECT (src, "failed to make write socket non-blocking: %s", g_strerror (errno)); src->handle = raw1394_new_handle (); if (!src->handle) { if (errno == EACCES) goto permission_denied; else if (errno == ENOENT) goto not_found; else goto no_handle; } src->num_ports = raw1394_get_port_info (src->handle, src->pinfo, 16); if (src->num_ports == 0) goto no_ports; if (src->use_avc || src->port == -1) src->avc_node = gst_hdv1394src_discover_avc_node (src); /* lets destroy handle and create one on port this is more reliable than setting port on the existing handle */ raw1394_destroy_handle (src->handle); src->handle = raw1394_new_handle_on_port (src->port); if (!src->handle) goto cannot_set_port; 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) goto cannot_initialise_dv; #if 0 raw1394_set_iso_handler (src->handle, src->channel, gst_hdv1394src_iso_receive); #endif GST_DEBUG_OBJECT (src, "successfully opened up 1394 connection"); src->connected = TRUE; if (iec61883_mpeg2_recv_start (src->iec61883mpeg2, src->channel) != 0) goto cannot_start; #if 0 if (raw1394_start_iso_rcv (src->handle, src->channel) < 0) goto cannot_start; #endif if (src->use_avc) { raw1394handle_t avc_handle = raw1394_new_handle_on_port (src->port); GST_LOG ("We have an avc_handle"); /* start the VCR */ if (avc_handle) { if (!avc1394_vcr_is_recording (avc_handle, src->avc_node) && avc1394_vcr_is_playing (avc_handle, src->avc_node) != AVC1394_VCR_OPERAND_PLAY_FORWARD) { GST_LOG ("Calling avc1394_vcr_play()"); avc1394_vcr_play (avc_handle, src->avc_node); } raw1394_destroy_handle (avc_handle); } else { GST_WARNING_OBJECT (src, "Starting VCR via avc1394 failed: %s", g_strerror (errno)); } } return TRUE; socket_pair: { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL), GST_ERROR_SYSTEM); return FALSE; } permission_denied: { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM); return FALSE; } not_found: { GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL), GST_ERROR_SYSTEM); return FALSE; } no_handle: { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), ("can't get raw1394 handle (%s)", g_strerror (errno))); return FALSE; } no_ports: { raw1394_destroy_handle (src->handle); src->handle = NULL; GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL), ("no ports available for raw1394")); return FALSE; } cannot_set_port: { GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL), ("can't set 1394 port %d", src->port)); return FALSE; } cannot_start: { raw1394_destroy_handle (src->handle); src->handle = NULL; iec61883_mpeg2_close (src->iec61883mpeg2); src->iec61883mpeg2 = NULL; GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), ("can't start 1394 iso receive")); return FALSE; } cannot_initialise_dv: { raw1394_destroy_handle (src->handle); src->handle = NULL; GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), ("can't initialise iec61883 hdv")); return FALSE; } }