Ticket #5689: programs_mythcommflag-uninit.patch

File programs_mythcommflag-uninit.patch, 7.6 KB (added by Erik Hovland <erik@…>, 13 years ago)

initiliazes member variables in ctors

  • 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, 
    131131                                         const QDateTime& startedAt_in,
    132132                                         const QDateTime& stopsAt_in,
    133133                                         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)
    146156{
    147 
    148     stillRecording = recordingStopsAt > QDateTime::currentDateTime();
    149    
    150157    commDetectBorder =
    151158        gContext->GetNumSetting("CommDetectBorder", 20);
    152159    commDetectBlankFrameMaxDiff =
    ClassicCommDetector::ClassicCommDetector(SkipType commDetectMethod_in, 
    171178    skipAllBlanks = !!gContext->GetNumSetting("CommSkipAllBlanks", 1);
    172179    commDetectBlankCanHaveLogo =
    173180        !!gContext->GetNumSetting("CommDetectBlankCanHaveLogo", 1);
    174 
    175181}
    176182
    177183void 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; 
    2424
    2525
    2626ClassicLogoDetector::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)
    3643{
    3744    commDetectLogoSamplesNeeded =
    3845        gContext->GetNumSetting("CommDetectLogoSamplesNeeded", 240);
    3946    commDetectLogoSampleSpacing =
    4047        gContext->GetNumSetting("CommDetectLogoSampleSpacing", 2);
     48    commDetectLogoSecondsNeeded = commDetectLogoSamplesNeeded *
     49                                  commDetectLogoSampleSpacing;
    4150    commDetectLogoGoodEdgeThreshold =
    4251        gContext->GetSetting("CommDetectLogoGoodEdgeThreshold", "0.75")
    4352        .toDouble();
    4453    commDetectLogoBadEdgeThreshold =
    4554        gContext->GetSetting("CommDetectLogoBadEdgeThreshold", "0.85")
    4655        .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;
    5956}
    6057
    6158unsigned 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( 
    336336    , sendBreakMapUpdates(false)
    337337    , breakMapUpdateRequested(false)
    338338    , finished(false)
     339    , currentFrameNumber(0)
    339340    , logoFinder(NULL)
    340341    , logoMatcher(NULL)
    341342    , 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, 
    333333    , pgmConverter(pgmc)
    334334    , edgeDetector(ed)
    335335    , templateFinder(tf)
     336    , tmpl(0)
    336337    , tmplrow(-1)
    337338    , tmplcol(-1)
    338339    , tmplwidth(-1)