diff --git a/comskip.c b/comskip.c index cf31fe6..6e54ffa 100644 --- a/comskip.c +++ b/comskip.c @@ -33,6 +33,10 @@ #include "comskip.h" +// dummy init relys on improper linkage of iHD driver without whole-archive +int __vaDriverInit_1_5(void *ctx) { + return -1; +} // Define detection methods #define BLACK_FRAME 1 @@ -597,6 +601,7 @@ bool intelligent_brightness = false; double logo_threshold = 0.80; double logo_percentage_threshold = 0.25; double logo_max_percentage_of_screen = 0.12; +double logo_min_percentage_of_screen = 0.00; int logo_filter = 0; int non_uniformity = 500; int brightness_jump = 200; @@ -8221,7 +8226,7 @@ bool IsStandardCommercialLength(double length, double tolerance, bool strict) length_count = 22; } #else - int standard_length[] = { 10, 15, 20, 25, 30, 45, 60, 90, 120, 150, 180, 5, 35, 40, 50, 70, 75}; + int standard_length[] = { 10, 15, 20, 25, 30, 45, 60, 90, 120, 150, 180, 35, 40, 50, 70, 75, 105}; if (strict) { length_count = 11; @@ -8581,6 +8586,7 @@ void LoadIniFile() if ((tmp = FindNumber(data, "give_up_logo_search=", (double) giveUpOnLogoSearch)) > -1) giveUpOnLogoSearch = (int)tmp; if ((tmp = FindNumber(data, "delay_logo_search=", (double) delay_logo_search)) > -1) delay_logo_search = (int)tmp; if ((tmp = FindNumber(data, "logo_max_percentage_of_screen=", (double) logo_max_percentage_of_screen)) > -1) logo_max_percentage_of_screen = (double)tmp; + if ((tmp = FindNumber(data, "logo_min_percentage_of_screen=", (double) logo_min_percentage_of_screen)) > -1) logo_min_percentage_of_screen = (double)tmp; if ((tmp = FindNumber(data, "ticker_tape=", (double) ticker_tape)) > -1) ticker_tape = (int)tmp; if ((tmp = FindNumber(data, "ticker_tape_percentage=", (double) ticker_tape_percentage)) > -1) ticker_tape_percentage = (int)tmp; if ((tmp = FindNumber(data, "top_ticker_tape=", (double) top_ticker_tape)) > -1) top_ticker_tape = (int)tmp; @@ -11898,6 +11904,15 @@ bool SearchForLogoEdges(void) ); // logoInfoAvailable = false; } + else if (logo_min_percentage_of_screen > 0 && logoPercentageOfScreen < logo_min_percentage_of_screen) + { + Debug( + 3, + "Edge count - %i\tPercentage of screen - %.2f%% TOO SMALL, CAN'T BE A LOGO.\n", + i, + logoPercentageOfScreen * 100 + ); + } else { Debug(3, "Edge count - %i\tPercentage of screen - %.2f%%, Check: %i\n", i, logoPercentageOfScreen * 100,doublCheckLogoCount); @@ -13862,7 +13877,7 @@ void OutputFrameArray(bool screenOnly) Debug(1, "Could not open raw output file.\n"); return; } - fprintf(raw, "sep=,\nframe,brightness,scene_change,logo,uniform,sound,minY,MaxY,ar_ratio,goodEdge,isblack,cutscene, MinX, MaxX, hasBright, Dimcount,PTS,%d",(int)(fps*100+0.5)); + fprintf(raw, "sep=,\nframe,brightness,scene_change,logo,uniform,sound,minY,MaxY,ar_ratio,goodEdge,isblack,cutscene, MinX, MaxX, hasBright, Dimcount,PTS,%f",fps); // for (k = 0; k < 32; k++) { // fprintf(raw, ",b%3i", k); // } @@ -13880,10 +13895,12 @@ void OutputFrameArray(bool screenOnly) } else { - fprintf(raw, "%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%f,%i,%i", + fprintf(raw, "%i,%i,%i,%i,%i,%i,%i,%i,%f,%f,%i,%i,%i,%i,%i,%i,%f,%i,%i", i, frame[i].brightness, frame[i].schange_percent*5, frame[i].logo_present, - frame[i].uniform, frame[i].volume, frame[i].minY,frame[i].maxY,(int)((frame[i].ar_ratio)*100), - (int)(frame[i].currentGoodEdge * 500), frame[i].isblack,(int)frame[i].cutscenematch, frame[i].minX,frame[i].maxX,frame[i].hasBright,frame[i].dimCount, frame[i].pts, frame[i].cur_segment, frame[i].audio_channels + frame[i].uniform, frame[i].volume, frame[i].minY,frame[i].maxY,frame[i].ar_ratio, + frame[i].currentGoodEdge, frame[i].isblack,frame[i].cutscenematch, + frame[i].minX, frame[i].maxX, frame[i].hasBright, frame[i].dimCount, frame[i].pts, + frame[i].cur_segment, frame[i].audio_channels ); #ifdef FRAME_WITH_HISTOGRAM for (k = 0; k < 32; k++) @@ -14123,12 +14140,24 @@ void ProcessCSV(FILE *in_file) fps = t * 1.00000000000001; if (strlen(line) > 131) { - t = ((double)strtol(&line[131], NULL, 10))/100; - if (t > 99) - t = t / 10.0; + t = strtod(&line[131], NULL); + + // Handle backward compatibility + if (strchr(&line[131], '.') == NULL) { + t /= 100.0; + if (t > 99) { + t /= 10.0; + } + + if (t>0) { + fps = t * 1.00000000000001; + } + } else { + if (t > 0) { + fps = t; + } + } } - if (t>0) - fps = t * 1.00000000000001; InitComSkip(); frame_count = 1; while (fgets(line, sizeof(line), in_file) != NULL) @@ -14198,10 +14227,18 @@ void ProcessCSV(FILE *in_file) if (maxmaxY < frame[frame_count].maxY) maxmaxY = frame[frame_count].maxY; break; case 8: - frame[frame_count].ar_ratio = ((double)strtol(split, NULL, 10))/100; + frame[frame_count].ar_ratio = strtod(split, NULL); + // Handle files that are before the values was written as a double + if (strchr(split, '.') == NULL) { + frame[frame_count].ar_ratio /= 100; + } break; case 9: - frame[frame_count].currentGoodEdge = ((double)strtol(split, NULL, 10))/500; + frame[frame_count].currentGoodEdge = strtod(split, NULL); + // Handle files that are before the values was written as a double + if (strchr(split, '.') == NULL) { + frame[frame_count].currentGoodEdge /= 500; + } break; case 10: frame[frame_count].isblack = strtol(split, NULL, 10); diff --git a/mpeg2dec.c b/mpeg2dec.c index 1be9fa3..c56ba8b 100755 --- a/mpeg2dec.c +++ b/mpeg2dec.c @@ -2569,9 +2569,9 @@ int main (int argc, char ** argv) SetThreadExecutionState(ES_CONTINUOUS); #endif -#ifdef _WIN32 - exit (result); -#else +//#ifdef _WIN32 +// exit (result); +//#else exit (!result); -#endif +//#endif } diff --git a/video_out_dx.c b/video_out_dx.c index 3524a39..b32407d 100644 --- a/video_out_dx.c +++ b/video_out_dx.c @@ -73,8 +73,8 @@ int xPos,yPos,lMouseDown; * DirectDraw GUIDs. * Defining them here allows us to get rid of the dxguid library during link. */ -DEFINE_GUID (IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56); -DEFINE_GUID (IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27); +//DEFINE_GUID (IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56); +//DEFINE_GUID (IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27); #define FOURCC_YV12 0x32315659