]> git.sesse.net Git - vlc/blob - modules/video_filter/atmo/AtmoThread.h
Factorized a bit colorthres code.
[vlc] / modules / video_filter / atmo / AtmoThread.h
1 /*
2  * AtmoThread.h: Base thread class for all threads inside AtmoWin
3  *
4  *
5  * See the README.txt file for copyright information and how to reach the author(s).
6  *
7  * $Id$
8  */
9 #ifndef _AtmoThread_h_
10 #define _AtmoThread_h_
11
12 #include "AtmoDefs.h"
13
14 #if defined(_ATMO_VLC_PLUGIN_)
15 // use threading stuff from videolan!
16 #   include <vlc_common.h>
17 #   include <vlc_threads.h>
18
19     typedef struct
20     {
21       VLC_COMMON_MEMBERS
22       void *p_thread; /* cast to CThread * */
23     } atmo_thread_t;
24
25 #else
26 #   include <windows.h>
27 #endif
28
29 class CThread
30 {
31 protected:
32
33 #if defined(_ATMO_VLC_PLUGIN_)
34
35     atmo_thread_t *m_pAtmoThread;
36     vlc_mutex_t  m_TerminateLock;
37     vlc_cond_t   m_TerminateCond;
38     vlc_object_t *m_pOwner;
39
40 #else
41
42     HANDLE m_hThread;
43         DWORD m_dwThreadID;
44         HANDLE m_hTerminateEvent;
45
46 #endif
47
48     volatile ATMO_BOOL m_bTerminated;
49
50 private:
51
52 #if defined(_ATMO_VLC_PLUGIN_)
53     static void *ThreadProc(vlc_object_t *);
54 #else
55         static DWORD WINAPI ThreadProc(LPVOID lpParameter);
56 #endif
57
58 protected:
59         virtual DWORD Execute(void);
60         ATMO_BOOL ThreadSleep(DWORD millisekunden);
61
62 public:
63 #if defined(_ATMO_VLC_PLUGIN_)
64         CThread(vlc_object_t *pOwner);
65 #else
66         CThread(void);
67 #endif
68
69     virtual ~CThread(void);
70
71     void Terminate(void);
72     void Run();
73
74 };
75
76 #endif
77