#include "avitools.h" using namespace std; const int ImageWidth = 720; const int ImageHeight = 480; int CFRED[32]; int CFGREEN[32]; int CFBLUE[32]; enum { RED = 0, GREEN = 1, BLUE = 2 }; enum { TIMESTAMP, RECORDTIME, FRAMESTAMP, RELTIMESTAMP, DRAWREGIONS, DARKEN, LAST }; enum { LEFT, RIGHT, UP, DOWN }; enum { A, B, C, D, E, F, G }; enum { QFS, //quadrant framestamp QTS, //quadrant timestamp QRT, //quadrant recordtime QRL, //quadrant reltimestamp QLAST }; bool options[LAST]; #define MINPIXPERREGION 16 // Files FILE *f_ximage; FILE *f_yimage; FILE *f_xblobsize; FILE *f_yblobsize; FILE *f_mark_type; FILE *f_timestamp; FILE *f_reltimestamp; FILE *f_framestamp; FILE *f_recordtime; FILE *f_area; FILE *f_color; int segmentsize = 5; unsigned char *frameDataRGB; int pointerX, pointerY; int loc ( int x, int y ) { return ImageWidth * 3 * y + 3 * x; } void pointerMove ( int dir ) { switch ( dir ) { case LEFT: pointerX -= 6 + segmentsize; break; case RIGHT: pointerX += 6 + segmentsize; break; case DOWN: pointerY += 7 + segmentsize * 2; break; case UP: pointerY -= 7 + segmentsize * 2; break; } } void pointerHome ( int dir ) { switch ( dir ) { case LEFT: pointerX = 0; break; case RIGHT: pointerX = ImageWidth; break; case DOWN: pointerY = ImageHeight; break; case UP: pointerY = 0; break; } } void dimCharSquare ( ) { int x, y, l; for ( x = pointerX; x < pointerX + 6 + segmentsize; x++ ) { for ( y = pointerY; y < pointerY + 7 + segmentsize * 2; y++ ) { l = loc ( x, y ); frameDataRGB[l + RED] = frameDataRGB[l + RED] / 2; frameDataRGB[l + GREEN] = frameDataRGB[l + GREEN] / 2; frameDataRGB[l + BLUE] = frameDataRGB[l + BLUE] / 2; } } } void drawHorLine ( int x1, int x2, int y, int r, int g, int b ) { int l; for ( ; x1 <= x2; x1++ ) { l = loc ( x1, y ); frameDataRGB[l + RED] = r; frameDataRGB[l + GREEN] = g; frameDataRGB[l + BLUE] = b; } } void drawVerLine ( int y1, int y2, int x, int r, int g, int b ) { int l; for ( ; y1 <= y2; y1++ ) { l = loc ( x, y1 ); frameDataRGB[l + RED] = r; frameDataRGB[l + GREEN] = g; frameDataRGB[l + BLUE] = b; } } void light ( int seg ) { switch ( seg ) { case A: drawHorLine ( pointerX + 3, pointerX + 3 + segmentsize, pointerY + 2, 200, 200, 200 ); break; case B: drawVerLine ( pointerY + 3, pointerY + 3 + segmentsize, pointerX + 3 + segmentsize, 200, 200, 200 ); break; case C: drawVerLine ( pointerY + 4 + segmentsize, pointerY + 4 + segmentsize * 2, pointerX + 3 + segmentsize, 200, 200, 200 ); break; case D: drawHorLine ( pointerX + 3, pointerX + 3 + segmentsize, pointerY + 4 + segmentsize * 2, 200, 200, 200 ); break; case E: drawVerLine ( pointerY + 4 + segmentsize, pointerY + 4 + segmentsize * 2, pointerX + 2, 200, 200, 200 ); break; case F: drawVerLine ( pointerY + 3, pointerY + 3 + segmentsize, pointerX + 2, 200, 200, 200 ); break; case G: drawHorLine ( pointerX + 3, pointerX + 3 + segmentsize, pointerY + 3 + segmentsize, 200, 200, 200 ); break; } } void drawChar ( char in ) { dimCharSquare ( ); switch ( in ) { case '0': light ( A ); light ( B ); light ( C ); light ( D ); light ( E ); light ( F ); break; case '1': light ( B ); light ( C ); break; case '2': light ( A ); light ( B ); light ( G ); light ( E ); light ( D ); break; case '3': light ( A ); light ( B ); light ( G ); light ( C ); light ( D ); break; case '4': light ( F ); light ( G ); light ( B ); light ( C ); break; case '5': light ( A ); light ( F ); light ( G ); light ( C ); light ( D ); break; case '6': light ( A ); light ( F ); light ( G ); light ( E ); light ( D ); light ( C ); break; case '7': light ( A ); light ( B ); light ( C ); break; case '8': light ( A ); light ( B ); light ( C ); light ( D ); light ( E ); light ( F ); light ( G ); break; case '9': light ( A ); light ( B ); light ( C ); light ( D ); light ( F ); light ( G ); break; case 't': case 'T': light ( B ); light ( C ); light ( G ); break; case 'f': case 'F': light ( A ); light ( F ); light ( G ); light ( E ); break; case 'r': case 'R': light ( E ); light ( G ); break; case 'l': case 'L': light ( F ); light ( E ); light ( D ); break; case ' ': ; } } int main ( int argc, char *argv[] ) { AVIHandler inputAVI; AVIHandler outputAVI; Frame inputFrame; Frame outputFrame; // command line options char *input_avi; char *color_config; char *btf_folder; char *output_avi; int start_frame = 0; int end_frame = 2000000000; bool q_1[QLAST]; bool q_2[QLAST]; bool q_3[QLAST]; bool q_4[QLAST]; char *tmp; int c; bool ret; int errors = 0; // zeroing options for ( c = 0; c < LAST; c++ ) options[c] = false; for ( c = 0; c < QLAST; c++ ) q_1[c] = false; for ( c = 0; c < QLAST; c++ ) q_2[c] = false; for ( c = 0; c < QLAST; c++ ) q_3[c] = false; for ( c = 0; c < QLAST; c++ ) q_4[c] = false; /* PARSE COMMAND LINE ARGUMENTS */ if ( argc < 4 ) { printf ( "%s USAGE:\n", argv[0] ); printf ( "%s input_avi btf_folder output_avi [OPTIONS]\n\n", argv[0] ); printf ( "Quadrants: \n" ); printf ( " 2 | 1 \n" ); printf ( "---+---\n" ); printf ( " 3 | 4 \n\n" ); printf ( "%s OPTIONS: (# is a number, x is a filename, $ is a quadrant)\n", argv[0] ); printf ( "-sf #\t--startframe #\t\t//Frame to start processing on\n" ); printf ( "-ef #\t--endframe #\t\t//Frame to end processing on\n" ); printf ( "-ts $\t--timestamp $\t\t//Timestamp\n" ); printf ( "-rts $\t--reltimestamp $\t\t//Relative timestamp\n" ); printf ( "-fs $\t--framestamp $\t\t//Framestamp\n" ); printf ( "-rt $\t--recordtime $\t\t//Time of recording\n" ); printf ( "-dr x\t--drawregions x\t\t//Draw the rectangular regions using color config file x\n" ); printf ( "-d\t--darken\t\t//Cuts the brightness of an image in half\n" ); printf ( "-ss #\t--segmentsize #\t\t//Size of a font segment, default 5\n" ); exit ( EXIT_FAILURE ); } input_avi = argv[1]; btf_folder = argv[2]; output_avi = argv[3]; int qtemp; for ( c = 4; c < argc; c++ ) { if ( strcmp ( "-sf", argv[c] ) == 0 || strcmp ( "--startframe", argv[c] ) == 0 ) { // need to set start frame c++; start_frame = atoi ( argv[c] ); } else if ( strcmp ( "-ef", argv[c] ) == 0 || strcmp ( "--endframe", argv[c] ) == 0 ) { c++; end_frame = atoi ( argv[c] ); } else if ( strcmp ( "-ss", argv[c] ) == 0 || strcmp ( "--segmentsize", argv[c] ) == 0 ) { c++; segmentsize = atoi ( argv[c] ); } else if ( strcmp ( "-ts", argv[c] ) == 0 || strcmp ( "--timestamp", argv[c] ) == 0 ) { options[TIMESTAMP] = true; c++; qtemp = atoi ( argv[c] ); switch ( qtemp ) { case 1: q_1[QTS] = true; break; case 2: q_2[QTS] = true; break; case 3: q_3[QTS] = true; break; case 4: q_4[QTS] = true; break; default: fprintf ( stderr, "\nInvalid quadrant: %d\n", qtemp ); } } else if ( strcmp ( "-rts", argv[c] ) == 0 || strcmp ( "--reltimestamp", argv[c] ) == 0 ) { options[RELTIMESTAMP] = true; c++; qtemp = atoi ( argv[c] ); switch ( qtemp ) { case 1: q_1[QRL] = true; break; case 2: q_2[QRL] = true; break; case 3: q_3[QRL] = true; break; case 4: q_4[QRL] = true; break; default: fprintf ( stderr, "\nInvalid quadrant: %d\n", qtemp ); } } else if ( strcmp ( "-rt", argv[c] ) == 0 || strcmp ( "--recordtime", argv[c] ) == 0 ) { options[RECORDTIME] = true; c++; qtemp = atoi ( argv[c] ); switch ( qtemp ) { case 1: q_1[QRT] = true; break; case 2: q_2[QRT] = true; break; case 3: q_3[QRT] = true; break; case 4: q_4[QRT] = true; break; default: fprintf ( stderr, "\nInvalid quadrant: %d\n", qtemp ); } } else if ( strcmp ( "-fs", argv[c] ) == 0 || strcmp ( "--framestamp", argv[c] ) == 0 ) { options[FRAMESTAMP] = true; c++; qtemp = atoi ( argv[c] ); switch ( qtemp ) { case 1: q_1[QFS] = true; break; case 2: q_2[QFS] = true; break; case 3: q_3[QFS] = true; break; case 4: q_4[QFS] = true; break; default: fprintf ( stderr, "\nInvalid quadrant: %d\n", qtemp ); } } else if ( strcmp ( "-dr", argv[c] ) == 0 || strcmp ( "--drawregions", argv[c] ) == 0 ) { options[DRAWREGIONS] = true; c++; color_config = argv[c]; } else if ( strcmp ( "-d", argv[c] ) == 0 || strcmp ( "--darken", argv[c] ) == 0 ) { options[DARKEN] = true; } else printf ( "Unrecognized option: %s\n", argv[c] ); } /************************************************************ * Verify Options * ************************************************************/ SYSPRINTF ( ( "Opening Input AVI file: %s ... ", input_avi ) ); // open input AVI file ret = inputAVI.Open ( input_avi ); if ( ret == true ) { inputAVI.GetFrame ( inputFrame, 1 ); frameDataRGB = new unsigned char[ImageWidth * ImageHeight * 3]; // obtain first frame from input AVI file and initialize output sample frame inputFrame.ExtractRGB ( frameDataRGB ); SYSPRINTF ( ( "Success!\n" ) ); } else { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } // Make btf directory SYSPRINTF ( ( "Opening BTF folder: %s ... \n", btf_folder ) ); char *prepath = new char[500]; char *fullpath = new char[500]; prepath[0] = '\0'; fullpath[0] = '\0'; strcat ( prepath, btf_folder ); strcat ( prepath, "/" ); if ( options[DRAWREGIONS] == true ) { //color SYSPRINTF ( ( "\tOpening %s ... ", color_config ) ); if ( ( f_color = fopen ( color_config, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); fscanf ( f_color, "%*s\n" ); int tr, tg, tb; for ( c = 0; fscanf ( f_color, "(%d, %d, %d) %*s %*s %*s\n", &tr, &tg, &tb ) != 0; c++ ) { CFRED[c] = tr; CFGREEN[c] = tg; CFBLUE[c] = tb; } } //ximage strcpy ( fullpath, prepath ); strcat ( fullpath, "ximage.btf" ); SYSPRINTF ( ( "\tOpening %s ... ", fullpath ) ); if ( ( f_ximage = fopen ( fullpath, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } //yimage strcpy ( fullpath, prepath ); strcat ( fullpath, "yimage.btf" ); SYSPRINTF ( ( "\tOpening %s ... ", fullpath ) ); if ( ( f_yimage = fopen ( fullpath, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } //xblobsize strcpy ( fullpath, prepath ); strcat ( fullpath, "xblobsize.btf" ); SYSPRINTF ( ( "\tOpening %s ... ", fullpath ) ); if ( ( f_xblobsize = fopen ( fullpath, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } //yblobsize strcpy ( fullpath, prepath ); strcat ( fullpath, "yblobsize.btf" ); SYSPRINTF ( ( "\tOpening %s ... ", fullpath ) ); if ( ( f_yblobsize = fopen ( fullpath, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } //mark_type strcpy ( fullpath, prepath ); strcat ( fullpath, "mark_type.btf" ); SYSPRINTF ( ( "\tOpening %s ... ", fullpath ) ); if ( ( f_mark_type = fopen ( fullpath, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } } if ( options[TIMESTAMP] == true ) { //timestamp strcpy ( fullpath, prepath ); strcat ( fullpath, "timestamp.btf" ); SYSPRINTF ( ( "\tOpening %s ... ", fullpath ) ); if ( ( f_timestamp = fopen ( fullpath, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } } if ( options[RECORDTIME] == true ) { strcpy ( fullpath, prepath ); strcat ( fullpath, "recordtime.btf" ); SYSPRINTF ( ( "\tOpening %s ... ", fullpath ) ); if ( ( f_recordtime = fopen ( fullpath, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } } if ( /*options[FRAMESTAMP] == */ true ) { strcpy ( fullpath, prepath ); strcat ( fullpath, "framestamp.btf" ); SYSPRINTF ( ( "\tOpening %s ... ", fullpath ) ); if ( ( f_framestamp = fopen ( fullpath, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } } if ( options[RELTIMESTAMP] == true ) { strcpy ( fullpath, prepath ); strcat ( fullpath, "reltimestamp.btf" ); SYSPRINTF ( ( "\tOpening %s ... ", fullpath ) ); if ( ( f_reltimestamp = fopen ( fullpath, "r" ) ) == NULL ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } } outputFrame.EncodeRGB ( frameDataRGB ); outputAVI.SetSampleFrame ( outputFrame ); SYSPRINTF ( ( "Opening Output AVI file: %s ...", output_avi ) ); ret = outputAVI.Create ( output_avi ); if ( ret == false ) { SYSPRINTF ( ( "Failure!\n" ) ); errors++; } else { SYSPRINTF ( ( "Success!\n" ) ); } if ( errors > 0 ) { SYSPRINTF ( ( "There where critical errors. Halting\n" ) ); exit ( EXIT_FAILURE ); } if ( start_frame != 0 ) { SYSPRINTF ( ( "Start Frame = %d\n", start_frame ) ); } if ( end_frame != 2000000000 ) { SYSPRINTF ( ( "End Frame = %d\n", end_frame ) ); } // intiialize sample frame and create output AVI // iterate through all of the frames from startframe to startframe + totalframes int tf; if ( inputAVI.GetTotalFrames ( ) < end_frame ) { tf = inputAVI.GetTotalFrames ( ) - start_frame; } else { tf = end_frame - start_frame; } int tfl = 1; char s_f_frameread[100]; char s_f_framecur[100]; char s_f_timestamp[100]; char s_f_reltimestamp[100]; char s_f_recordtime[100]; char s_temp[100]; char s_framestamp_draw[100]; char s_timestamp_draw[100]; char s_reltimestamp_draw[100]; char s_recordtime_draw[100]; s_f_frameread[0] = '\0'; s_f_framecur[0] = '\0'; s_f_timestamp[0] = '\0'; s_f_reltimestamp[0] = '\0'; s_f_recordtime[0] = '\0'; int switch_count = 0; int rem_count; fpos_t fp_framestamp; fpos_t fp_timestamp; fpos_t fp_reltimestamp; fpos_t fp_recordtime; fpos_t fp_ximage; fpos_t fp_yimage; fpos_t fp_xblobsize; fpos_t fp_yblobsize; fpos_t fp_mark_type; int curframe = -1; // advance to the first frame while ( curframe < start_frame ) { fgetpos ( f_framestamp, &fp_framestamp ); fscanf ( f_framestamp, "%d\n", &curframe ); SYSPRINTF(("LOOPING: Updated Curframe = %d\n", curframe)); if ( options[TIMESTAMP] == true ) { fgetpos ( f_timestamp, &fp_timestamp ); fscanf ( f_timestamp, "%s\n", s_f_timestamp ); } if ( options[RELTIMESTAMP] == true ) { fgetpos ( f_reltimestamp, &fp_reltimestamp ); fscanf ( f_reltimestamp, "%s\n", s_f_reltimestamp ); } if ( options[RECORDTIME] == true ) { fgetpos ( f_recordtime, &fp_recordtime ); fscanf ( f_recordtime, "%s\n", s_f_recordtime ); } if ( options[DRAWREGIONS] == true ) { fgetpos ( f_ximage, &fp_ximage ); fscanf ( f_ximage, "%*s\n" ); fgetpos ( f_yimage, &fp_yimage ); fscanf ( f_yimage, "%*s\n" ); fgetpos ( f_xblobsize, &fp_xblobsize ); fscanf ( f_xblobsize, "%*s\n" ); fgetpos ( f_yblobsize, &fp_yblobsize ); fscanf ( f_yblobsize, "%*s\n" ); fgetpos ( f_mark_type, &fp_mark_type ); fscanf ( f_mark_type, "%*s\n" ); } } // at this point we overshot the first frame by one line, lets back up... fsetpos ( f_framestamp, &fp_framestamp ); if ( options[TIMESTAMP] == true ) { fsetpos ( f_timestamp, &fp_timestamp ); } if ( options[RELTIMESTAMP] == true ) { fsetpos ( f_reltimestamp, &fp_reltimestamp ); } if ( options[RECORDTIME] == true ) { fsetpos ( f_recordtime, &fp_recordtime ); } if ( options[DRAWREGIONS] == true ) { fsetpos ( f_ximage, &fp_ximage ); fsetpos ( f_yimage, &fp_yimage ); fsetpos ( f_xblobsize, &fp_xblobsize ); fsetpos ( f_yblobsize, &fp_yblobsize ); fsetpos ( f_mark_type, &fp_mark_type ); } SYSPRINTF ( ( "Processing %d frames\nFrame [%8d / %8d]", tf, 0, tf ) ); bool work; int eofcheck; for ( int f = start_frame; f < inputAVI.GetTotalFrames ( ) && f < end_frame; f++ ) { SYSPRINTF ( ( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b%8d / %8d]", tfl, tf ) ); inputAVI.GetFrame ( inputFrame, f ); inputFrame.ExtractRGB ( frameDataRGB ); /***********************************************************\ * BEGIN FRAME PROCESSING * \***********************************************************/ if ( options[DARKEN] == true ) { for ( c = 0; c < ImageWidth * ImageHeight * 3; c++ ) { frameDataRGB[c + RED] = frameDataRGB[c + RED] / 2; frameDataRGB[c + GREEN] = frameDataRGB[c + GREEN] / 2; frameDataRGB[c + BLUE] = frameDataRGB[c + BLUE] / 2; } } fgetpos ( f_framestamp, &fp_framestamp ); fscanf ( f_framestamp, "%s\n", s_f_framecur ); fsetpos ( f_framestamp, &fp_framestamp ); work = true; while ( work ) { //SYSPRINTF(("IN WORK LOOP\n")); // get the strings from files /* if ( strcmp(s_f_framecur, "") == 0){ // need to get first line of file fscanf(f_framestamp, "%s\n", s_f_framecur); } // need to advance till switch switch_count = 0; strcpy(s_f_framecur, s_f_framenext); int scan_res; do { scan_res = fscanf(f_framestamp, "%s\n", s_temp); switch_count++; } while ( strcmp(s_temp, s_f_framenext) == 0 && scan_res != EOF); strcpy(s_f_framenext, s_temp); */ eofcheck = fscanf ( f_framestamp, "%s\n", s_f_frameread ); if ( eofcheck == 0 || eofcheck == EOF ) break; if(options[TIMESTAMP]){ fscanf(f_timestamp, "%s\n", s_f_timestamp); } if(options[RELTIMESTAMP]){ fscanf(f_reltimestamp, "%s\n", s_f_reltimestamp); } if(options[RECORDTIME]){ fscanf(f_recordtime, "%s\n", s_f_recordtime); } if ( strcmp ( s_f_framecur, s_f_frameread ) != 0 ) { strcpy ( s_framestamp_draw, "f " ); strcat ( s_framestamp_draw, s_f_framecur ); if ( options[TIMESTAMP] == true ) { strcpy ( s_timestamp_draw, "t " ); strcat ( s_timestamp_draw, s_f_timestamp ); // printf("s_f_timestamp_draw = '%s'\n", s_timestamp_draw); } if ( options[RELTIMESTAMP] == true ) { strcpy ( s_reltimestamp_draw, "l " ); strcat ( s_reltimestamp_draw, s_f_reltimestamp ); } if ( options[RECORDTIME] == true ) { strcpy ( s_recordtime_draw, "r " ); strcat ( s_recordtime_draw, s_f_recordtime ); } /* pointerX, pointerY * +---------------------------------+ * | 0,0 720,0| * | | * | | * | | * |0,480 720,480| * +---------------------------------+ */ // Draw the top right (quad 2) pointerHome ( LEFT ); pointerHome ( UP ); if ( q_2[QFS] == true ) { pointerHome ( LEFT ); for ( c = 0; s_framestamp_draw[c] != '\0'; c++ ) { drawChar ( s_framestamp_draw[c] ); pointerMove ( RIGHT ); } pointerMove ( DOWN ); } if ( q_2[QRL] == true ) { pointerHome ( LEFT ); for ( c = 0; s_reltimestamp_draw[c] != '\0'; c++ ) { drawChar ( s_reltimestamp_draw[c] ); pointerMove ( RIGHT ); } pointerMove ( DOWN ); } if ( q_2[QRT] == true ) { pointerHome ( LEFT ); for ( c = 0; s_recordtime_draw[c] != '\0'; c++ ) { drawChar ( s_recordtime_draw[c] ); pointerMove ( RIGHT ); } pointerMove ( DOWN ); } if ( q_2[QTS] == true ) { pointerHome ( LEFT ); for ( c = 0; s_timestamp_draw[c] != '\0'; c++ ) { drawChar ( s_timestamp_draw[c] ); pointerMove ( RIGHT ); } pointerMove ( DOWN ); } // Draw the top left (quad 1) pointerHome ( RIGHT ); pointerHome ( UP ); if ( q_1[QFS] == true ) { pointerHome ( RIGHT ); for ( c = strlen ( s_framestamp_draw ); c != 0; c-- ) { pointerMove ( LEFT ); drawChar ( s_framestamp_draw[c - 1] ); } pointerMove ( DOWN ); } if ( q_1[QRL] == true ) { pointerHome ( RIGHT ); for ( c = strlen ( s_reltimestamp_draw ); c != '\0'; c-- ) { pointerMove ( LEFT ); drawChar ( s_reltimestamp_draw[c - 1] ); } pointerMove ( DOWN ); } if ( q_1[QRT] == true ) { pointerHome ( RIGHT ); for ( c = strlen ( s_recordtime_draw ); c != '\0'; c-- ) { pointerMove ( LEFT ); drawChar ( s_recordtime_draw[c - 1] ); } pointerMove ( DOWN ); } if ( q_1[QTS] == true ) { pointerHome ( RIGHT ); for ( c = strlen ( s_timestamp_draw ); c != '\0'; c-- ) { pointerMove ( LEFT ); drawChar ( s_timestamp_draw[c - 1] ); } pointerMove ( DOWN ); } // Draw Bottom Right (quad 3) pointerHome ( LEFT ); pointerHome ( DOWN ); pointerMove ( UP ); if ( q_3[QFS] == true ) { pointerHome ( LEFT ); for ( c = 0; s_framestamp_draw[c] != '\0'; c++ ) { drawChar ( s_framestamp_draw[c] ); pointerMove ( RIGHT ); } pointerMove ( UP ); } if ( q_3[QRL] == true ) { pointerHome ( LEFT ); for ( c = 0; s_reltimestamp_draw[c] != '\0'; c++ ) { drawChar ( s_reltimestamp_draw[c] ); pointerMove ( RIGHT ); } pointerMove ( UP ); } if ( q_3[QRT] == true ) { pointerHome ( LEFT ); for ( c = 0; s_recordtime_draw[c] != '\0'; c++ ) { drawChar ( s_recordtime_draw[c] ); pointerMove ( RIGHT ); } pointerMove ( UP ); } if ( q_3[QTS] == true ) { pointerHome ( LEFT ); for ( c = 0; s_timestamp_draw[c] != '\0'; c++ ) { drawChar ( s_timestamp_draw[c] ); pointerMove ( RIGHT ); } pointerMove ( UP ); } // Draw the bottom left (quad 4) pointerHome ( RIGHT ); pointerHome ( DOWN ); pointerMove ( UP ); if ( q_4[QFS] == true ) { pointerHome ( RIGHT ); for ( c = strlen ( s_framestamp_draw ); c != 0; c-- ) { pointerMove ( LEFT ); drawChar ( s_framestamp_draw[c - 1] ); } pointerMove ( UP ); } if ( q_4[QRL] == true ) { pointerHome ( RIGHT ); for ( c = strlen ( s_reltimestamp_draw ); c != '\0'; c-- ) { pointerMove ( LEFT ); drawChar ( s_reltimestamp_draw[c - 1] ); } pointerMove ( UP ); } if ( q_4[QRT] == true ) { pointerHome ( RIGHT ); for ( c = strlen ( s_recordtime_draw ); c != '\0'; c-- ) { pointerMove ( LEFT ); drawChar ( s_recordtime_draw[c - 1] ); } pointerMove ( UP ); } if ( q_4[QTS] == true ) { pointerHome ( RIGHT ); for ( c = strlen ( s_timestamp_draw ); c != '\0'; c-- ) { pointerMove ( LEFT ); drawChar ( s_timestamp_draw[c - 1] ); } pointerMove ( UP ); } work = false; } if ( options[TIMESTAMP] == true ) { // need to advance till switch for ( rem_count = switch_count; rem_count > 0; rem_count-- ) { fscanf ( f_timestamp, "%s\n", s_temp ); } strcpy ( s_f_timestamp, s_temp ); } if ( options[RELTIMESTAMP] == true ) { // need to advance till switch for ( rem_count = switch_count; rem_count > 0; rem_count-- ) { fscanf ( f_reltimestamp, "%s\n", s_temp ); } strcpy ( s_f_reltimestamp, s_temp ); } if ( options[RECORDTIME] == true ) { // need to advance till switch for ( rem_count = switch_count; rem_count > 0; rem_count-- ) { fscanf ( f_recordtime, "%s\n", s_temp ); } strcpy ( s_f_recordtime, s_temp ); } if ( options[DRAWREGIONS] == true ) { int xblobsize, yblobsize, ximage, yimage, marktype; fscanf ( f_xblobsize, "%d\n", &xblobsize ); fscanf ( f_yblobsize, "%d\n", &yblobsize ); fscanf ( f_ximage, "%d\n", &ximage ); fscanf ( f_yimage, "%d\n", &yimage ); fscanf ( f_mark_type, "%d\n", &marktype ); drawHorLine ( ximage - xblobsize, ximage + xblobsize, yimage - yblobsize, CFRED[marktype], CFGREEN[marktype], CFBLUE[marktype] ); drawHorLine ( ximage - xblobsize, ximage + xblobsize, yimage + yblobsize, CFRED[marktype], CFGREEN[marktype], CFBLUE[marktype] ); drawVerLine ( yimage - yblobsize, yimage + yblobsize, ximage - xblobsize, CFRED[marktype], CFGREEN[marktype], CFBLUE[marktype] ); drawVerLine ( yimage - yblobsize, yimage + yblobsize, ximage + xblobsize, CFRED[marktype], CFGREEN[marktype], CFBLUE[marktype] ); } if ( strcmp ( s_f_framecur, s_f_frameread ) != 0 ) { outputFrame.EncodeRGB ( frameDataRGB ); outputAVI.Write ( outputFrame ); } } /***********************************************************\ * END FRAME PROCESSING * \***********************************************************/ tfl++; } SYSPRINTF ( ( "\n" ) ); if ( output_avi != NULL ) outputAVI.Close ( ); delete[]frameDataRGB; return 0; }