Changeset 1890


Ignore:
Timestamp:
06/02/12 02:37:43 (12 months ago)
Author:
philmoz
Message:

Fixes for 'motion detect' module handling:

  • stops MD module being loaded when any script is run (not just MD scripts)
  • unloads MD module when script ends.
Location:
trunk/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui.c

    r1874 r1890  
    19831983        { 
    19841984            --show_md_grid; 
    1985             if (module_mdetect_load()) 
     1985            // If motion detect library loaded then display the MD grid 
     1986            // Don't call 'module_mdetect_load' here as we don't want to load 
     1987            // the module, just see if it was already loaded. 
     1988            if (libmotiondetect) 
    19861989                libmotiondetect->md_draw_grid(); 
    19871990        } 
  • trunk/core/modules.c

    r1810 r1890  
    164164} 
    165165 
     166void module_mdetect_unload() 
     167{ 
     168        if (libmotiondetect) 
     169    { 
     170        module_unload(MODULE_NAME_MDETECT);   
     171        libmotiondetect = 0; 
     172    } 
     173} 
     174 
    166175 
    167176/************* DYNAMIC LIBRARY ZEBRA ******/ 
  • trunk/core/motion_detector.h

    r1693 r1890  
    119119        extern struct libmotiondetect_sym* libmotiondetect; 
    120120    extern struct libmotiondetect_sym* module_mdetect_load();           // 0fail, addr-ok 
     121    extern void module_mdetect_unload(); 
    121122#else 
    122123        // This section is for module 
  • trunk/core/script.c

    r1722 r1890  
    612612            break; 
    613613        case AS_MOTION_DETECTOR: 
    614             if (module_mdetect_load()) 
     614            // If motion detect module loaded then run the MD code 
     615            // Don't call module_mdetect_load here as it may cause the 
     616            // module to be re-loaded after the script is interrupted 
     617            if (libmotiondetect) 
    615618            { 
    616619                if (libmotiondetect->md_detect_motion()==0) 
     
    717720    } 
    718721    // If motion detect library loaded then shut down motion detector 
    719     // Don't call 'module_mdetect_load' here as we don't want to load 
    720     // the module, just see if it was already loaded. 
    721     if (libmotiondetect) 
    722         libmotiondetect->md_close_motion_detector(); 
     722    module_mdetect_unload(); 
     723 
    723724        shot_histogram_set(0); 
    724725    kbd_key_release_all(); 
Note: See TracChangeset for help on using the changeset viewer.