Videodump reading now also works in Windows

master
Stefan Jahn 3 years ago
parent d7786fa8b1
commit 12c144a77a

@ -121,7 +121,7 @@ int VideoDev_Dumpfile::Open() {
} }
filesize = s.st_size; filesize = s.st_size;
if ((fd = open(fname.c_str(), O_RDONLY)) == -1) { if ((fd = open(fname.c_str(), O_RDONLY | O_BINARY)) == -1) {
printf ("%s:%d could not open file '%s' error:%s\n", __FILE__, __LINE__, fname.c_str(), strerror(errno)); printf ("%s:%d could not open file '%s' error:%s\n", __FILE__, __LINE__, fname.c_str(), strerror(errno));
return VDEV_STATUS_ERROR; return VDEV_STATUS_ERROR;
} }
@ -267,9 +267,8 @@ int VideoDev_Dumpfile::ReadFrame() {
// //
// read frame // read frame
if (read (fd, inbuf, 4*2) != 4*2) { if (read (fd, inbuf, 4*2) != 4*2) {
printf ("%s:%d could not read frame header\n", __FILE__, __LINE__); printf ("%s:%d could not read frame header: %s\n", __FILE__, __LINE__, strerror(errno));
Close(); Close();
} }
filepos += (4*2); filepos += (4*2);
inframe_size = ntohl(inbuf[0]); inframe_size = ntohl(inbuf[0]);
@ -291,9 +290,8 @@ int VideoDev_Dumpfile::ReadFrame() {
printf ("%s:%d cloud not allocate enought memory\n", __FILE__, __LINE__); printf ("%s:%d cloud not allocate enought memory\n", __FILE__, __LINE__);
return VDEV_CBSTATUS_ERROR; return VDEV_CBSTATUS_ERROR;
} }
if (read (fd, inframe, inframe_size) != inframe_size) { if (read (fd, inframe, inframe_size) != inframe_size) {
printf ("%s:%d could not read frame\n", __FILE__, __LINE__); printf ("%s:%d could not read frame: %s\n", __FILE__, __LINE__, strerror(errno));
Close(); Close();
} }
filepos += inframe_size; filepos += inframe_size;

Loading…
Cancel
Save