--- dvgrab.cc-origin Mon Apr 8 22:37:27 2002 +++ dvgrab.cc Wed Apr 17 22:17:09 2002 @@ -79,6 +79,7 @@ int g_autosplit; int g_timestamp; +int g_timesys; int g_card; int g_channel; int g_file_format; @@ -114,6 +115,7 @@ g_autosplit = false; g_timestamp = false; + g_timesys =false; g_card = 0; g_channel = 63; g_file_format = AVI_DV1_FORMAT; @@ -129,6 +131,8 @@ g_autosplit = true; } else if (strcmp("--timestamp", argv[i]) == 0) { g_timestamp = true; + } else if (strcmp("--timesys", argv[i]) == 0) { + g_timesys = true; } else if ((strcmp("--format", argv[i]) == 0) && (i < argc)) { i++; if (strcmp("dv1", argv[i]) == 0) { @@ -192,6 +196,7 @@ printf(" Default is autosplit when file is slightly less than\n"); printf(" 1 GByte.\n"); printf(" --timestamp put the date and time of recording into the file name.\n"); + printf(" --timesys take the time/date from the system instead of the device\n"); printf(" --format dv1 save as a 'Type 1' DV AVI file. %s\n", g_file_format == AVI_DV1_FORMAT ? "This is the default." : " "); printf(" --format dv2 save as a 'Type 2' DV AVI file. %s\n", g_file_format == AVI_DV2_FORMAT ? "This is the default." : " "); printf(" --format raw save only the raw DV information.\n"); @@ -310,7 +315,13 @@ file_count++; if (g_timestamp == true) { struct tm recDate; - frame->GetRecordingDate(recDate); + time_t *timesys; + if (g_timesys == true) { + time(timesys); + memcpy(&recDate,localtime(timesys),sizeof(struct tm)); + } else { + frame->GetRecordingDate(recDate); + } sprintf(filename, "%s%4.4d.%2.2d.%2.2d_%2.2d-%2.2d-%2.2d.avi", g_dst_file_name, recDate.tm_year + 1900, recDate.tm_mon + 1, recDate.tm_mday, recDate.tm_hour, recDate.tm_min, recDate.tm_sec); @@ -349,9 +360,15 @@ TimeCode timeCode; struct tm recDate; + time_t *timesys; frame->GetTimeCode(timeCode); - frame->GetRecordingDate(recDate); + if (g_timesys == true) { + time(timesys); + memcpy(&recDate,localtime(timesys),sizeof(struct tm)); + } else { + frame->GetRecordingDate(recDate); + } printf("%s: buffer underrun near: timecode %2.2d:%2.2d:%2.2d.%2.2d date %4.4d.%2.2d.%2.2d %2.2d:%2.2d:%2.2d\n", filename, timeCode.hour, timeCode.min, timeCode.sec, timeCode.frame, recDate.tm_year + 1900, recDate.tm_mon + 1, recDate.tm_mday, @@ -366,9 +383,15 @@ TimeCode timeCode; struct tm recDate; + time_t *timesys; frame->GetTimeCode(timeCode); - frame->GetRecordingDate(recDate); + if (g_timesys == true) { + time(timesys); + memcpy(&recDate,localtime(timesys),sizeof(struct tm)); + } else { + frame->GetRecordingDate(recDate); + } printf("%s: frame dropped: timecode %2.2d:%2.2d:%2.2d.%2.2d date %4.4d.%2.2d.%2.2d %2.2d:%2.2d:%2.2d\n", filename, timeCode.hour, timeCode.min, timeCode.sec, timeCode.frame, recDate.tm_year + 1900, recDate.tm_mon + 1, recDate.tm_mday,