Code: Select all
--- src/zm_event.cpp.orig 2004-10-30 22:24:22.956803372 +0400
+++ src/zm_event.cpp 2004-10-30 23:03:42.118404007 +0400
@@ -32,6 +32,12 @@
#include "zmf.h"
+#if 0
+#define SHOW_PROGRESS_BAR (bool)config.Item( ZM_PROGRESS_BAR )
+#else
+#define SHOW_PROGRESS_BAR true
+#endif
+
bool Event::initialised = false;
bool Event::timestamp_on_capture;
int Event::bulk_frame_interval;
@@ -482,7 +488,7 @@
static char filepath[PATH_MAX];
snprintf( filepath, sizeof(filepath), capture_file_format, eventpath, id );
- if ( scale == 100 )
+ if (( scale == 100 ) && !SHOW_PROGRESS_BAR )
{
if ( (fdj = fopen( filepath, "r" )) )
{
@@ -498,7 +504,10 @@
{
Image image( filepath );
- image.Scale( scale );
+ if ( scale != 100 )
+ image.Scale( scale );
+ if ( SHOW_PROGRESS_BAR )
+ image.ProgressBar( id, frames );
image.EncodeJpeg( buffer, &n_bytes );
}
@@ -628,6 +637,8 @@
{
image.Scale( scale );
}
+ if ( SHOW_PROGRESS_BAR )
+ image.ProgressBar( id, frames );
double temp_delta = ((id-last_id)*(db_delta-last_delta))/(db_id-last_id);
delta_ms = (unsigned int)((last_delta+temp_delta)*1000);
--- src/zm_image.cpp.orig 2004-10-30 18:33:22.580609987 +0400
+++ src/zm_image.cpp 2004-10-30 23:11:21.149957644 +0400
@@ -1049,3 +1049,16 @@
buffer = new JSAMPLE[size];
memcpy( buffer, scale_buffer, size );
}
+
+void Image::ProgressBar( const unsigned int current, const unsigned int maximum )
+{
+ unsigned int wc = width * colours;
+ for ( unsigned int y = height-4; y < height; y++ ) {
+ unsigned int posc = width * current / (maximum?maximum:1) * colours;
+ if ((y == height-3) || (y == height-2)) {
+ memset( &buffer[y*wc], WHITE, posc );
+ } else {
+ memset( &buffer[y*wc], BLACK, posc );
+ }
+ }
+}
--- src/zm_image.h.orig 2004-10-30 18:33:16.510321348 +0400
+++ src/zm_image.h 2004-10-30 23:12:02.951089226 +0400
@@ -224,6 +224,8 @@
void Rotate( int angle );
void Scale( unsigned int factor );
+
+ void ProgressBar( const unsigned int current, const unsigned int maximum );
};
#endif // ZM_IMAGE_H