Mercurial > pt1
diff arib25/src/td.c @ 123:ec7c87854f2f b25
updated to arib25 0.2.5
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 15 Feb 2012 11:09:02 +0900 |
parents | 080414aa8f21 |
children |
line wrap: on
line diff
--- a/arib25/src/td.c Wed Nov 18 13:12:44 2009 +0900 +++ b/arib25/src/td.c Wed Feb 15 11:09:02 2012 +0900 @@ -14,6 +14,7 @@ #define __STDC_FORMAT_MACROS #include <inttypes.h> #include <unistd.h> + #include <sys/time.h> #endif #include "arib_std_b25.h" @@ -36,7 +37,7 @@ { int n; OPTION opt; - + #if defined(WIN32) _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT ); @@ -53,7 +54,9 @@ exit(EXIT_FAILURE); } - test_arib_std_b25(argv[n+0], argv[n+1], &opt); + for(;n<=(argc-2);n+=2){ + test_arib_std_b25(argv[n+0], argv[n+1], &opt); + } #if defined(WIN32) _CrtDumpMemoryLeaks(); @@ -64,8 +67,8 @@ static void show_usage() { - fprintf(stderr, "b25 - ARIB STD-B25 test program ver. 0.2.4 (2009, 4/18)\n"); - fprintf(stderr, "usage: b25 [options] src.m2t dst.m2t\n"); + fprintf(stderr, "b25 - ARIB STD-B25 test program ver. 0.2.5 (2012, 2/13)\n"); + fprintf(stderr, "usage: b25 [options] src.m2t dst.m2t [more pair ..]\n"); fprintf(stderr, "options:\n"); fprintf(stderr, " -r round (integer, default=4)\n"); fprintf(stderr, " -s strip\n"); @@ -154,13 +157,20 @@ int64_t total; int64_t offset; +#if defined(WIN32) + unsigned long tick,tock; +#else + struct timeval tick,tock; + double millisec; +#endif + double mbps; ARIB_STD_B25 *b25; B_CAS_CARD *bcas; ARIB_STD_B25_PROGRAM_INFO pgrm; - uint8_t data[8*1024]; + uint8_t data[64*1024]; ARIB_STD_B25_BUFFER sbuf; ARIB_STD_B25_BUFFER dbuf; @@ -175,7 +185,7 @@ fprintf(stderr, "error - failed on _open(%s) [src]\n", src); goto LAST; } - + _lseeki64(sfd, 0, SEEK_END); total = _telli64(sfd); _lseeki64(sfd, 0, SEEK_SET); @@ -229,6 +239,11 @@ } offset = 0; +#if defined(WIN32) + tock = GetTickCount(); +#else + gettimeofday(&tock, NULL); +#endif while( (n = _read(sfd, data, sizeof(data))) > 0 ){ sbuf.data = data; sbuf.size = n; @@ -252,11 +267,29 @@ goto LAST; } } - + offset += sbuf.size; if(opt->verbose != 0){ m = (int)(10000*offset/total); - fprintf(stderr, "\rprocessing: %2d.%02d%% ", m/100, m%100); + mbps = 0.0; +#if defined(WIN32) + tick = GetTickCount(); + if (tick-tock > 100) { + mbps = offset; + mbps /= 1024; + mbps /= (tick-tock); + } +#else + gettimeofday(&tick, NULL); + millisec = (tick.tv_sec - tock.tv_sec) * 1000; + millisec += (tick.tv_usec - tock.tv_usec) / 1000; + if(millisec > 100.0) { + mbps = offset; + mbps /= 1024; + mbps /= millisec; + } +#endif + fprintf(stderr, "\rprocessing: %2d.%02d%% [%6.2f MB/sec]", m/100, m%100, mbps); } } @@ -265,7 +298,7 @@ fprintf(stderr, "error - failed on ARIB_STD_B25::flush() : code=%d\n", code); goto LAST; } - + code = b25->get(b25, &dbuf); if(code < 0){ fprintf(stderr, "error - failed on ARIB_STD_B25::get() : code=%d\n", code); @@ -281,7 +314,25 @@ } if(opt->verbose != 0){ - fprintf(stderr, "\rprocessing: finish \n"); + mbps = 0.0; +#if defined(WIN32) + tick = GetTickCount(); + if (tick-tock > 100) { + mbps = offset; + mbps /= 1024; + mbps /= (tick-tock); + } +#else + gettimeofday(&tick, NULL); + millisec = (tick.tv_sec - tock.tv_sec) * 1000; + millisec += (tick.tv_usec - tock.tv_usec) / 1000; + if(millisec > 100.0) { + mbps = offset; + mbps /= 1024; + mbps /= millisec; + } +#endif + fprintf(stderr, "\rprocessing: finish [%6.2f MB/sec]\n", mbps); fflush(stderr); fflush(stdout); }