AtmoDynData.cpp 1.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
 * AtmoDynData.cpp: class for holding all variable data - which may be
 * passed between function calls, into threads instead of the use
 * of global variables
 *
 * See the README.txt file for copyright information and how to reach the author(s).
 *
 * $Id$
 */

#include "AtmoDynData.h"

#if defined(_ATMO_VLC_PLUGIN_)
CAtmoDynData::CAtmoDynData(vlc_object_t *p_atmo_filter, CAtmoConfig *pAtmoConfig) {
    this->p_atmo_filter     = p_atmo_filter;
    this->m_pAtmoConfig     = pAtmoConfig;
    this->m_pAtmoConnection = NULL;
    this->m_pCurrentEffectThread = NULL;

20
    vlc_mutex_init( &m_lock );
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

}
#else
CAtmoDynData::CAtmoDynData(HINSTANCE hInst, CAtmoConfig *pAtmoConfig, CAtmoDisplays *pAtmoDisplays) {
    this->m_pAtmoConfig     = pAtmoConfig;
    this->m_pAtmoDisplays   = pAtmoDisplays;
    this->m_pAtmoConnection = NULL;
    this->m_pCurrentEffectThread = NULL;
    this->m_hInst = hInst;
    InitializeCriticalSection(&m_RemoteCallCriticalSection);
}
#endif

CAtmoDynData::~CAtmoDynData(void)
{
#if defined(_ATMO_VLC_PLUGIN_)
    vlc_mutex_destroy( &m_lock );
#else
    DeleteCriticalSection(&m_RemoteCallCriticalSection);
#endif
}

void CAtmoDynData::LockCriticalSection() {
#if defined(_ATMO_VLC_PLUGIN_)
    vlc_mutex_lock( &m_lock );
#else
    EnterCriticalSection(&m_RemoteCallCriticalSection);
#endif
}

void CAtmoDynData::UnLockCriticalSection() {
#if defined(_ATMO_VLC_PLUGIN_)
    vlc_mutex_unlock( &m_lock );
#else
    LeaveCriticalSection(&m_RemoteCallCriticalSection);
#endif
}