--- libs/libmythtv/commercial_skip.cpp 2004-01-26 20:56:57.000000000 +0000 +++ libs/libmythtv/commercial_skip.cpp 2004-01-26 20:57:36.000000000 +0000 @@ -269,11 +269,9 @@ // this sub gets a list of suspect events then tries every combination // of black-bounded periods and checks the likelyhood of them being ads // based on their length and number of events in them - int fps = (int)frame_rate; QMap::Iterator it; QMap::Iterator last; QMap::Iterator first; -// QMap::Iterator itBlanks; QMap qmBlackestFrames; QMap qmScores; QMap::Iterator itScores; @@ -286,8 +284,8 @@ GetBlackestFrames(qmBlackestFrames); - blackLength = FindSignificantBlanks(sigScenes, totalFrames, fps); - FindSignificantScenes(sigScenes, fps, blackLength); + blackLength = FindSignificantBlanks(sigScenes, totalFrames); + FindSignificantScenes(sigScenes, blackLength); // cycle through each range using the blackframes as start // and end points for a possible adbreak @@ -299,7 +297,7 @@ // if the range is a decent length then count up the // number of sus events within it length = last.key() - first.key(); - if ((length > (fps * 60)) && (length < (fps * 5 * 60))) { + if ((length > (int)(frame_rate * 60)) && (length < (int)(frame_rate * 5 * 60))) { if (last != qmBlackestFrames.end()) { for (it = sigScenes.begin(); it != sigScenes.end(); ++it) { @@ -328,7 +326,7 @@ // the length to # events ration score = (float)qmLength[itLength.key()] / (float)qmScores[itLength.key()]; // these numbers are pretty arbitary, based on obsevations - if (score > (2.2 * fps) && score < (22 * fps)) { + if (score > (int)(2.2 * frame_rate) && score < (int)(22 * frame_rate)) { for (it = sigScenes.begin(); it != sigScenes.end(); ++it) { // if the range doesn't overlap with an existing one // then add it @@ -351,7 +349,7 @@ // make sure that any starting cuts are flush with start if (sigScenes.count() > 0) { it = sigScenes.begin(); - if ((it.key() < (fps * 60 * 5)) && (it.key() > 0)) + if ((it.key() < (int)(frame_rate * 60 * 5)) && (it.key() > 0)) { startsWithAds = 1; sigScenes[1] = it.key() + sigScenes[it.key()] - 1; @@ -361,7 +359,7 @@ if (sigScenes.count() > 0) { // trim off anything close to the end it = --sigScenes.end(); - if ((it.key() + sigScenes[it.key()]) > (totalFrames - (fps * 60 * 2))) + if ((it.key() + sigScenes[it.key()]) > (totalFrames - (int)(frame_rate * 60 * 2))) sigScenes.remove(it); } } @@ -435,7 +433,7 @@ } -int CommDetect::FindSignificantBlanks(QMap &pqmSigScenes, long long totalFrames, int fps) +int CommDetect::FindSignificantBlanks(QMap &pqmSigScenes, long long totalFrames) { QMap::Iterator it; QMap::Iterator next; @@ -456,7 +454,7 @@ else {break;} } - if ((blankCount > 3) && (blankCount < fps)) + if ((blankCount > 3) && (blankCount < frame_rate)) qmTemp[it.key()] = blankCount; it = ++blankFrameMap.find(i - 1); @@ -511,19 +509,19 @@ } } -void CommDetect::FindSignificantScenes(QMap &pqmSigScenes, int fps, int blackLength) +void CommDetect::FindSignificantScenes(QMap &pqmSigScenes, int blackLength) { QMap qmTemp; // first get a list of anything that has another scene change n * 10 secs away - FilterScenes(sceneChangeMap, qmTemp, fps, 0); + FilterScenes(sceneChangeMap, qmTemp, 0); // then do it again so that we're left with a list of scene changes that link // together in blocks of 10 secs - FilterScenes(qmTemp, pqmSigScenes, fps, blackLength); + FilterScenes(qmTemp, pqmSigScenes, blackLength); } -void CommDetect::FilterScenes(QMap &pqmScenes, QMap &pqmFiltered, int fps, int blackLength) +void CommDetect::FilterScenes(QMap &pqmScenes, QMap &pqmFiltered, int blackLength) { QMap::Iterator it; bool retainSceneChange; @@ -535,11 +533,11 @@ for (i = 1; i < 7; i++) { // check a bit before and after boundry for (x = -2; x < 3; x++) { - if (pqmScenes.contains(it.key() - blackLength + (i * 10 * fps) + x)) { + if (pqmScenes.contains(it.key() - blackLength + (int)(i * 10 * frame_rate) + x)) { // there is another scenechange at a ten-second boundry retainSceneChange = true; pqmFiltered[it.key()] = MARK_SCENE_CHANGE; - pqmFiltered[it.key() - blackLength + (i * 10 * fps) - x] = MARK_SCENE_CHANGE; + pqmFiltered[it.key() - blackLength + (int)(i * 10 * frame_rate) - x] = MARK_SCENE_CHANGE; break; } } --- libs/libmythtv/commercial_skip.h 2004-01-26 20:56:57.000000000 +0000 +++ libs/libmythtv/commercial_skip.h 2004-01-26 20:54:12.000000000 +0000 @@ -61,11 +61,11 @@ bool CheckFrameIsBlank(void); bool CheckSceneHasChanged(void); void ProcessSceneAlt(long long frameNum); - void GetBreakMapAlt(QMap &pqmBreakMap, long long totalFrames); - int FindSignificantBlanks(QMap &pqmSigScenes, long long totalFrames, int fps); - void FindSignificantScenes(QMap &pqmSigScenes, int fps, int blackLength); - void FilterScenes(QMap &pqmScenes, QMap &pqmFiltered, int fps, int blackLength); - void GetBlackestFrames(QMap &pqmBlackestFrames); + void GetBreakMapAlt(QMap &pqmBreakMap, long long totalFrames); + int FindSignificantBlanks(QMap &pqmSigScenes, long long totalFrames); + void FindSignificantScenes(QMap &pqmSigScenes, int blackLength); + void FilterScenes(QMap &pqmScenes, QMap &pqmFiltered, int blackLength); + void GetBlackestFrames(QMap &pqmBlackestFrames); int GetAvgBrightness(void);