27 #include <libraw1394/raw1394.h>
28 #include <libavc1394/avc1394.h>
29 #include <libavc1394/rom1394.h>
30 #include <libiec61883/iec61883.h>
36 #define THREADS HAVE_PTHREADS
42 #define MOTDCT_SPEC_ID 0x00005068
43 #define IEC61883_AUTO 0
45 #define IEC61883_HDV 2
99 int complete,
void *callback_data)
126 packet->
len = length;
128 memcpy(packet->
buf, data, length);
158 while ((result = poll(&dv->
raw1394_poll, 1, 200)) < 0) {
159 if (!(errno == EAGAIN || errno == EINTR)) {
168 raw1394_loop_iterate(dv->
raw1394);
200 packet->
buf, packet->
len, -1);
236 struct raw1394_portinfo pinf[16];
237 rom1394_directory rom_dir;
250 dv->
raw1394 = raw1394_new_handle();
257 if ((nb_ports = raw1394_get_port_info(dv->
raw1394, pinf, 16)) < 0) {
262 inport = strtol(context->
filename, &endptr, 10);
263 if (endptr != context->
filename && *endptr ==
'\0') {
266 nb_ports = inport + 1;
267 }
else if (strcmp(context->
filename,
"auto")) {
269 "\"auto\" for auto-detection, or the port number.\n", context->
filename);
274 if (sscanf(dv->
device_guid,
"%llx", (
long long unsigned int *)&guid) != 1) {
281 for (; j < nb_ports && port==-1; ++j) {
282 raw1394_destroy_handle(dv->
raw1394);
284 if (!(dv->
raw1394 = raw1394_new_handle_on_port(j))) {
289 for (i=0; i<raw1394_get_nodecount(dv->
raw1394); ++i) {
294 if (guid == rom1394_get_guid(dv->
raw1394, i)) {
303 if (rom1394_get_directory(dv->
raw1394, i, &rom_dir) < 0)
305 if (((rom1394_get_node_type(&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
306 avc1394_check_subunit_type(dv->
raw1394, i, AVC1394_SUBUNIT_TYPE_VCR)) ||
308 rom1394_free_directory(&rom_dir);
313 rom1394_free_directory(&rom_dir);
325 iec61883_cmp_normalize_output(dv->
raw1394, 0xffc0 | dv->
node);
330 response = avc1394_transaction(dv->
raw1394, dv->
node,
331 AVC1394_CTYPE_STATUS |
332 AVC1394_SUBUNIT_TYPE_TAPE_RECORDER |
333 AVC1394_SUBUNIT_ID_0 |
334 AVC1394_VCR_COMMAND_OUTPUT_SIGNAL_MODE |
336 response = AVC1394_GET_OPERAND0(response);
337 dv->
type = (response == 0x10 || response == 0x90 || response == 0x1A || response == 0x9A) ?
344 raw1394_get_local_id(dv->
raw1394),
384 dv->
raw1394_poll.events = POLLIN | POLLERR | POLLHUP | POLLPRI;
403 raw1394_destroy_handle(dv->
raw1394);
463 raw1394_get_local_id(dv->
raw1394),
466 raw1394_destroy_handle(dv->
raw1394);
472 {
"dvtype",
"override autodetection of DV/HDV", offsetof(
struct iec61883_data,
type),
AV_OPT_TYPE_INT, {.i64 =
IEC61883_AUTO},
IEC61883_AUTO,
IEC61883_HDV,
AV_OPT_FLAG_DECODING_PARAM,
"dvtype" },