Ticket #5689: programs_mythcommflag-uninit.patch
| File programs_mythcommflag-uninit.patch, 7.6 KB (added by , 18 years ago) |
|---|
-
mythtv/programs/mythcommflag/ClassicCommDetector.cpp
Fixes initialization defects in mythcommflag. From: Erik Hovland <erik@hovland.org> --- .../programs/mythcommflag/ClassicCommDetector.cpp | 38 +++++++++++-------- .../programs/mythcommflag/ClassicLogoDetector.cpp | 39 +++++++++----------- mythtv/programs/mythcommflag/CommDetector2.cpp | 1 + mythtv/programs/mythcommflag/TemplateMatcher.cpp | 1 + 4 files changed, 42 insertions(+), 37 deletions(-) diff --git a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp index fe941a0..3b2d195 100644
a b ClassicCommDetector::ClassicCommDetector(SkipType commDetectMethod_in, 131 131 const QDateTime& startedAt_in, 132 132 const QDateTime& stopsAt_in, 133 133 const QDateTime& recordingStartedAt_in, 134 const QDateTime& recordingStopsAt_in) : 135 commDetectMethod(commDetectMethod_in), 136 showProgress(showProgress_in), 137 fullSpeed(fullSpeed_in), 138 nvp(nvp_in), 139 startedAt(startedAt_in), 140 stopsAt(stopsAt_in), 141 recordingStartedAt(recordingStartedAt_in), 142 recordingStopsAt(recordingStopsAt_in), 143 framesProcessed(0),preRoll(0),postRoll(0), 144 logoDetector(0), 145 sceneChangeDetector(0) 134 const QDateTime& recordingStopsAt_in) 135 : commDetectMethod(commDetectMethod_in), showProgress(showProgress_in), 136 fullSpeed(fullSpeed_in), nvp(nvp_in), 137 startedAt(startedAt_in), stopsAt(stopsAt_in), 138 recordingStartedAt(recordingStartedAt_in), recordingStopsAt(recordingStopsAt_in), 139 stillRecording(recordingStopsAt > QDateTime::currentDateTime()), 140 commBreakMapUpdateRequested(false), sendCommBreakMapUpdates(false), 141 aggressiveDetection(false), verboseDebugging(false), 142 lastFrameNumber(0), curFrameNumber(0), 143 width(0), height(0), 144 horizSpacing(0), vertSpacing(0), 145 fps(0.0), fpm(0.0), 146 blankFramesOnly(false), blankFrameCount(0), 147 currentAspect(0), framesProcessed(0), 148 preRoll(0), postRoll(0), 149 totalMinBrightness(0), detectBlankFrames(false), 150 detectSceneChanges(false), detectStationLogo(false), 151 logoInfoAvailable(false), logoDetector(0), 152 framePtr(0), frameIsBlank(false), 153 sceneHasChanged(false), stationLogoPresent(false), 154 lastFrameWasBlank(false), lastFrameWasSceneChange(false), 155 decoderFoundAspectChanges(false), sceneChangeDetector(0) 146 156 { 147 148 stillRecording = recordingStopsAt > QDateTime::currentDateTime();149 150 157 commDetectBorder = 151 158 gContext->GetNumSetting("CommDetectBorder", 20); 152 159 commDetectBlankFrameMaxDiff = … … ClassicCommDetector::ClassicCommDetector(SkipType commDetectMethod_in, 171 178 skipAllBlanks = !!gContext->GetNumSetting("CommSkipAllBlanks", 1); 172 179 commDetectBlankCanHaveLogo = 173 180 !!gContext->GetNumSetting("CommDetectBlankCanHaveLogo", 1); 174 175 181 } 176 182 177 183 void ClassicCommDetector::Init() -
mythtv/programs/mythcommflag/ClassicLogoDetector.cpp
diff --git a/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp b/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp index 52938ba..f2e5e91 100644
a b EdgeMaskEntry; 24 24 25 25 26 26 ClassicLogoDetector::ClassicLogoDetector(ClassicCommDetector* commdetector, 27 unsigned int w, unsigned int h, unsigned int commdetectborder_in, 28 unsigned int xspacing_in, unsigned int yspacing_in): 29 LogoDetectorBase(w,h), 30 commDetector(commdetector), 31 frameNumber(0), 32 previousFrameWasSceneChange(false), 33 xspacing(xspacing_in), 34 yspacing(yspacing_in), 35 commDetectBorder(commdetectborder_in) 27 unsigned int w, unsigned int h, 28 unsigned int commdetectborder_in, 29 unsigned int xspacing_in, 30 unsigned int yspacing_in) 31 : LogoDetectorBase(w,h), 32 commDetector(commdetector), frameNumber(0), 33 previousFrameWasSceneChange(false), 34 xspacing(xspacing_in), yspacing(yspacing_in), 35 commDetectBorder(commdetectborder_in), edgeMask(new EdgeMaskEntry[width * height]), 36 logoMaxValues(new unsigned char[width * height]), logoMinValues(new unsigned char[width * height]), 37 logoFrame(new unsigned char[width * height]), logoMask(new unsigned char[width * height]), 38 logoCheckMask(new unsigned char[width * height]), tmpBuf(new unsigned char[width * height]), 39 logoEdgeDiff(0), logoFrameCount(0), 40 logoMinX(0), logoMaxX(0), 41 logoMinY(0), logoMaxY(0), 42 logoInfoAvailable(false) 36 43 { 37 44 commDetectLogoSamplesNeeded = 38 45 gContext->GetNumSetting("CommDetectLogoSamplesNeeded", 240); 39 46 commDetectLogoSampleSpacing = 40 47 gContext->GetNumSetting("CommDetectLogoSampleSpacing", 2); 48 commDetectLogoSecondsNeeded = commDetectLogoSamplesNeeded * 49 commDetectLogoSampleSpacing; 41 50 commDetectLogoGoodEdgeThreshold = 42 51 gContext->GetSetting("CommDetectLogoGoodEdgeThreshold", "0.75") 43 52 .toDouble(); 44 53 commDetectLogoBadEdgeThreshold = 45 54 gContext->GetSetting("CommDetectLogoBadEdgeThreshold", "0.85") 46 55 .toDouble(); 47 commDetectLogoSecondsNeeded = commDetectLogoSamplesNeeded *48 commDetectLogoSampleSpacing;49 50 edgeMask = new EdgeMaskEntry[width * height];51 logoFrame = new unsigned char[width * height];52 logoMask = new unsigned char[width * height];53 logoCheckMask = new unsigned char[width * height];54 logoMaxValues = new unsigned char[width * height];55 logoMinValues = new unsigned char[width * height];56 tmpBuf = new unsigned char[width * height];57 58 logoFrameCount = 0;59 56 } 60 57 61 58 unsigned int ClassicLogoDetector::getRequiredAvailableBufferForSearch() -
mythtv/programs/mythcommflag/CommDetector2.cpp
diff --git a/mythtv/programs/mythcommflag/CommDetector2.cpp b/mythtv/programs/mythcommflag/CommDetector2.cpp index 0d77abd..e899b48 100644
a b CommDetector2::CommDetector2( 336 336 , sendBreakMapUpdates(false) 337 337 , breakMapUpdateRequested(false) 338 338 , finished(false) 339 , currentFrameNumber(0) 339 340 , logoFinder(NULL) 340 341 , logoMatcher(NULL) 341 342 , blankFrameDetector(NULL) -
mythtv/programs/mythcommflag/TemplateMatcher.cpp
diff --git a/mythtv/programs/mythcommflag/TemplateMatcher.cpp b/mythtv/programs/mythcommflag/TemplateMatcher.cpp index 01eb856..ddad52c 100644
a b TemplateMatcher::TemplateMatcher(PGMConverter *pgmc, EdgeDetector *ed, 333 333 , pgmConverter(pgmc) 334 334 , edgeDetector(ed) 335 335 , templateFinder(tf) 336 , tmpl(0) 336 337 , tmplrow(-1) 337 338 , tmplcol(-1) 338 339 , tmplwidth(-1)
