summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/decoder.cc11
-rw-r--r--src/info_gui.cc2
-rw-r--r--src/network.cc23
-rw-r--r--src/socket.cc8
4 files changed, 38 insertions, 6 deletions
diff --git a/src/decoder.cc b/src/decoder.cc
index db95fe8..ec3f695 100644
--- a/src/decoder.cc
+++ b/src/decoder.cc
@@ -39,6 +39,11 @@
/*
* $Log$
+ * Revision 1.30 2005/06/02 15:03:23 deva
+ *
+ * Fixed crash in network.cc if socket not connected.
+ * Added option to skop ecery second frame in player
+ *
* Revision 1.29 2005/05/25 13:11:42 deva
*
* Made unfreeze close connection, when no recording is done.
@@ -80,6 +85,8 @@
#include <errno.h>
*/
+#include "miav_config.h"
+
#include <time.h>
// Use libdv
@@ -131,6 +138,8 @@ void Decoder::decode()
bool local_record = false;
bool old_record;
+ bool skip_frames = config->readInt("player_skip_frames");
+
dv1394 dv_stream = dv1394(info); // Use default port and channel.
while(*running) {
@@ -174,7 +183,7 @@ void Decoder::decode()
}
static int showframe = 1;
- // showframe = 1 - showframe;
+ if(skip_frames != 0) showframe = 1 - showframe;
if(showframe) {
Frame *pframe = new Frame(ptr, DVPACKAGE_SIZE);
pframe->shoot = local_shoot;
diff --git a/src/info_gui.cc b/src/info_gui.cc
index b084b00..4865ae0 100644
--- a/src/info_gui.cc
+++ b/src/info_gui.cc
@@ -46,7 +46,7 @@
bool InfoEventHandler::eventFilter( QObject *o, QEvent *e )
{
if ( e->type() == TYPE_SHOW_MESSAGEBOX ) {
- fprintf(stderr, "Custom event!\n"); fflush(stderr);
+ // fprintf(stderr, "Custom event!\n"); fflush(stderr);
MessageBox *msgbox = ((ShowMessageEvent*)e)->messagebox();
msgbox->exec();
delete msgbox;
diff --git a/src/network.cc b/src/network.cc
index 05835c0..d21b8fe 100644
--- a/src/network.cc
+++ b/src/network.cc
@@ -31,6 +31,11 @@
/*
* $Log$
+ * Revision 1.5 2005/06/02 15:03:23 deva
+ *
+ * Fixed crash in network.cc if socket not connected.
+ * Added option to skop ecery second frame in player
+ *
* Revision 1.4 2005/05/03 08:31:59 deva
* Removed the error object, and replaced it with a more generic info object.
*
@@ -59,8 +64,8 @@ Network::~Network()
int Network::write(void *buf, int size)
{
if(!s->isConnected()) {
- info->error("Write attempted to a socket not connected!");
- return 0;
+ // info->error("Write attempted to a socket not connected!");
+ return -1;
}
int n = send(s->ssocket, buf, size, MSG_WAITALL);
@@ -74,8 +79,8 @@ int Network::write(void *buf, int size)
int Network::read(void *buf, int size)
{
if(!s->isConnected()) {
- info->error("Read attempted from a socket not connected!");
- return 0;
+ // info->error("Read attempted from a socket not connected!");
+ return -1;
}
int n = recv(s->ssocket, buf, size, MSG_WAITALL);
@@ -103,6 +108,11 @@ int Network::sendPackage(n_header *h, void* buf, int bufsz)
struct msghdr msg;
struct iovec iovecs[2];
+ if(!s->isConnected()) {
+ // info->error("Write attempted to a socket not connected!");
+ return -1;
+ }
+
memset(&msg, 0, sizeof(msg));
msg.msg_iov = iovecs;
@@ -128,6 +138,11 @@ int Network::recvPackage(n_header *h, void* buf, int bufsz)
struct msghdr msg;
struct iovec iovecs[2];
+ if(!s->isConnected()) {
+ // info->error("Read attempted to a socket not connected!");
+ return -1;
+ }
+
memset(&msg, 0, sizeof(msg));
iovecs[0].iov_base = h;
diff --git a/src/socket.cc b/src/socket.cc
index c01e31d..c5a2575 100644
--- a/src/socket.cc
+++ b/src/socket.cc
@@ -31,6 +31,11 @@
/*
* $Log$
+ * Revision 1.6 2005/06/02 15:03:23 deva
+ *
+ * Fixed crash in network.cc if socket not connected.
+ * Added option to skop ecery second frame in player
+ *
* Revision 1.5 2005/05/03 17:13:25 deva
* Fixed some missong Info object references.
*
@@ -120,6 +125,7 @@ Socket Socket::slisten()
(socklen_t*)&csalen);
if (s.ssocket < 0) {
+ s.connected = false;
err = 1;
info->error("Socket: accept() failed! %s", strerror(errno));
return s;
@@ -134,6 +140,7 @@ Socket Socket::slisten()
int Socket::sconnect(char *ip)
{
if(err) {
+ connected = false;
info->error("Socket: No socket present!");
return err;
}
@@ -144,6 +151,7 @@ int Socket::sconnect(char *ip)
err = connect(ssocket, (struct sockaddr*)&socketaddr, sizeof(socketaddr));
if (err) {
+ connected = false;
info->error("Socket: connect() failed! %s", strerror(errno));
return err;
}