]> git.sesse.net Git - vlc/blob - modules/video_filter/atmo/AtmoConnection.cpp
Use var_InheritString for --decklink-video-connection.
[vlc] / modules / video_filter / atmo / AtmoConnection.cpp
1 /*
2  * AtmoConnection.cpp: generic/abstract class defining all methods for the
3  * communication with the hardware
4  *
5  * See the README.txt file for copyright information and how to reach the author(s).
6  *
7  * $Id$
8  */
9 #include <string.h>
10 #include "AtmoConnection.h"
11
12
13 CAtmoConnection::CAtmoConnection(CAtmoConfig *cfg)
14 {
15          this->m_pAtmoConfig = cfg;     
16      m_ChannelAssignment = NULL;
17      m_NumAssignedChannels = 0;
18
19 #if defined(_ATMO_VLC_PLUGIN_)
20      vlc_mutex_init( &m_AccessConnection );
21 #else
22      InitializeCriticalSection( &m_AccessConnection );
23 #endif
24 }
25
26 CAtmoConnection::~CAtmoConnection(void)
27 {
28   if(isOpen())
29      CloseConnection();
30
31 #if defined(_ATMO_VLC_PLUGIN_)
32      vlc_mutex_destroy( &m_AccessConnection );
33 #else
34      DeleteCriticalSection( &m_AccessConnection );
35 #endif
36 }
37
38 void CAtmoConnection::SetChannelAssignment(CAtmoChannelAssignment *ca)
39 {
40   if(ca)
41   {
42       Lock();
43       delete m_ChannelAssignment;
44       m_ChannelAssignment = ca->getMapArrayClone(m_NumAssignedChannels);
45       Unlock();
46   }
47 }
48
49 #if !defined(_ATMO_VLC_PLUGIN_)
50 ATMO_BOOL CAtmoConnection::ShowConfigDialog(HINSTANCE hInst, HWND parent, CAtmoConfig *cfg)
51 {
52     MessageBox(parent, "This device doesn't have a special config dialog", "Info", 0);
53     return ATMO_FALSE;
54 }
55 #endif
56
57
58 void CAtmoConnection::Lock()
59 {
60 #if defined(_ATMO_VLC_PLUGIN_)
61     vlc_mutex_lock( &m_AccessConnection );
62 #else
63     EnterCriticalSection( &m_AccessConnection );
64 #endif
65 }
66 void CAtmoConnection::Unlock()
67 {
68 #if defined(_ATMO_VLC_PLUGIN_)
69     vlc_mutex_unlock( &m_AccessConnection );
70 #else
71     LeaveCriticalSection( &m_AccessConnection );
72 #endif
73 }