summaryrefslogtreecommitdiff
path: root/src/dv1394.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dv1394.cc')
-rw-r--r--src/dv1394.cc31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/dv1394.cc b/src/dv1394.cc
index 4a2d4f7..270da2e 100644
--- a/src/dv1394.cc
+++ b/src/dv1394.cc
@@ -107,9 +107,21 @@ static int raw_reader( raw1394handle_t handle, int channel, size_t length, quadl
return 0;
}
-dv1394::dv1394(Info *ginfo, int port, int channel)
+dv1394::dv1394(Info *i, int p, int c)
+{
+ info = i;
+ port = p;
+ channel = c;
+}
+
+dv1394::~dv1394()
+{
+ // Close firewire connection.
+ if(handle) raw1394_destroy_handle(handle);
+}
+
+bool dv1394::connect()
{
- info = ginfo;
int n_ports;
struct raw1394_portinfo pinf[ 16 ];
@@ -117,7 +129,7 @@ dv1394::dv1394(Info *ginfo, int port, int channel)
handle = raw1394_new_handle();
if(!handle) {
info->error("raw1394 - failed to get handle: %s.", strerror( errno ) );
- return;
+ return false;
}
// how many adapters are hooked in?
@@ -125,7 +137,7 @@ dv1394::dv1394(Info *ginfo, int port, int channel)
info->error("raw1394 - failed to get port info: %s.", strerror( errno ) );
raw1394_destroy_handle(handle);
handle = NULL;
- return;
+ return false;
}
// Tell raw1394 which host adapter to use
@@ -133,19 +145,14 @@ dv1394::dv1394(Info *ginfo, int port, int channel)
info->error("raw1394 - failed to set port: %s.", strerror( errno ) );
raw1394_destroy_handle(handle);
handle = NULL;
- return;
+ return false;
}
raw1394_set_iso_handler( handle, channel, raw_reader);
raw1394_set_userdata( handle, ( void* ) NULL);
raw1394_start_iso_rcv( handle, channel);
-
-}
-
-dv1394::~dv1394()
-{
- // Close firewire connection.
- if(handle) raw1394_destroy_handle(handle);
+
+ return true;
}
unsigned char *dv1394::readFrame()