Code style
This commit is contained in:
parent
a6aefcf477
commit
c0a2286dee
|
@ -30,10 +30,9 @@
|
|||
const int MAX_SLEEP_USEC = 1000000; // 1 sec
|
||||
|
||||
bool MonitorStream::checkSwapPath(const char *path, bool create_path) {
|
||||
|
||||
struct stat stat_buf;
|
||||
if ( stat(path, &stat_buf) < 0 ) {
|
||||
if ( create_path && errno == ENOENT ) {
|
||||
if ( create_path and (errno == ENOENT) ) {
|
||||
Debug(3, "Swap path '%s' missing, creating", path);
|
||||
if ( mkdir(path, 0755) ) {
|
||||
Error("Can't mkdir %s: %s", path, strerror(errno));
|
||||
|
@ -330,7 +329,6 @@ bool MonitorStream::sendFrame(const char *filepath, struct timeval *timestamp) {
|
|||
|
||||
if ( !send_raw ) {
|
||||
Image temp_image(filepath);
|
||||
|
||||
return sendFrame(&temp_image, timestamp);
|
||||
} else {
|
||||
int img_buffer_size = 0;
|
||||
|
@ -699,7 +697,6 @@ void MonitorStream::runStream() {
|
|||
// Send the next frame
|
||||
//
|
||||
ZMPacket *snap = &monitor->image_buffer[index];
|
||||
struct timeval *timestamp = snap->timestamp;
|
||||
|
||||
if ( !sendFrame(snap->image, snap->timestamp) ) {
|
||||
Debug(2, "sendFrame failed, quiting.");
|
||||
|
@ -707,7 +704,7 @@ void MonitorStream::runStream() {
|
|||
break;
|
||||
}
|
||||
// Perhaps we should use NOW instead.
|
||||
last_frame_timestamp = *timestamp;
|
||||
last_frame_timestamp = *(snap->timestamp);
|
||||
//frame_sent = true;
|
||||
//
|
||||
if ( frame_count == 0 ) {
|
||||
|
@ -765,7 +762,10 @@ void MonitorStream::runStream() {
|
|||
temp_image_buffer[temp_index].valid = true;
|
||||
}
|
||||
temp_image_buffer[temp_index].timestamp = monitor->shared_timestamps[index];
|
||||
monitor->image_buffer[index].image->WriteJpeg( temp_image_buffer[temp_index].file_name, config.jpeg_file_quality );
|
||||
monitor->image_buffer[index].image->WriteJpeg(
|
||||
temp_image_buffer[temp_index].file_name,
|
||||
config.jpeg_file_quality
|
||||
);
|
||||
temp_write_index = MOD_ADD(temp_write_index, 1, temp_image_buffer_count);
|
||||
if ( temp_write_index == temp_read_index ) {
|
||||
// Go back to live viewing
|
||||
|
@ -869,7 +869,7 @@ void MonitorStream::SingleImage(int scale) {
|
|||
"Content-Type: image/jpeg\r\n\r\n",
|
||||
img_buffer_size);
|
||||
fwrite(img_buffer, img_buffer_size, 1, stdout);
|
||||
}
|
||||
} // end void MonitorStream::SingleImage(int scale)
|
||||
|
||||
void MonitorStream::SingleImageRaw(int scale) {
|
||||
Image scaled_image;
|
||||
|
@ -890,7 +890,7 @@ void MonitorStream::SingleImageRaw(int scale) {
|
|||
"Content-Type: image/x-rgb\r\n\r\n",
|
||||
snap_image->Size());
|
||||
fwrite(snap_image->Buffer(), snap_image->Size(), 1, stdout);
|
||||
}
|
||||
} // end void MonitorStream::SingleImageRaw(int scale)
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
void MonitorStream::SingleImageZip(int scale) {
|
||||
|
@ -916,5 +916,5 @@ void MonitorStream::SingleImageZip(int scale) {
|
|||
"Content-Type: image/x-rgbz\r\n\r\n",
|
||||
img_buffer_size);
|
||||
fwrite(img_buffer, img_buffer_size, 1, stdout);
|
||||
}
|
||||
} // end void MonitorStream::SingleImageZip(int scale)
|
||||
#endif // HAVE_ZLIB_H
|
||||
|
|
Loading…
Reference in New Issue