summaryrefslogtreecommitdiff
path: root/src/dv1394.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dv1394.cc')
-rw-r--r--src/dv1394.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/dv1394.cc b/src/dv1394.cc
index 339d192..d4912e4 100644
--- a/src/dv1394.cc
+++ b/src/dv1394.cc
@@ -69,6 +69,7 @@ static int raw_reader( raw1394handle_t handle, int channel, size_t length, quadl
if(!framedata)
{
// We're fucked
+ // errobj->pushError("Were fucked: %s.\n", strerror( errno ) );
exit(1);
}
}
@@ -112,24 +113,24 @@ dv1394::dv1394(Error *e, int port, int channel)
// Get handle to firewire channels
handle = raw1394_new_handle();
if(!handle) {
- // errobj->pushError("");
- fprintf( stderr, "raw1394 - failed to get handle: %s.\n", strerror( errno ) );
- exit( EXIT_FAILURE );
+ errobj->pushError("raw1394 - failed to get handle: %s.", strerror( errno ) );
+ return;
}
// how many adapters are hooked in?
if((n_ports = raw1394_get_port_info(handle, pinf, 16)) < 0 ) {
- // errobj->pushError("");
- fprintf( stderr, "raw1394 - failed to get port info: %s.\n", strerror( errno ) );
- raw1394_destroy_handle( handle );
- exit( EXIT_FAILURE );
+ errobj->pushError("raw1394 - failed to get port info: %s.", strerror( errno ) );
+ raw1394_destroy_handle(handle);
+ handle = NULL;
+ return;
}
// Tell raw1394 which host adapter to use
if(raw1394_set_port(handle, port) < 0 ) {
- // errobj->pushError("");
- fprintf( stderr, "raw1394 - failed to set port: %s.\n", strerror( errno ) );
- exit( EXIT_FAILURE );
+ errobj->pushError("raw1394 - failed to set port: %s.", strerror( errno ) );
+ raw1394_destroy_handle(handle);
+ handle = NULL;
+ return;
}
raw1394_set_iso_handler( handle, channel, raw_reader);
@@ -146,6 +147,9 @@ dv1394::~dv1394()
unsigned char *dv1394::readFrame()
{
+ // Firewiare port not correctly opened.
+ if(!handle) return NULL;
+
unsigned char *ptr;
while(1) {
raw1394_loop_iterate(handle);