2 * AtmoPacketQueue.h: works as connection between the framegrabber (color-preprocessor)
3 * and the live output thread. It works as a FIFO for the colorpackets - helps also
4 * to synchronize between grabber and liveview threads.
5 * especially if the grabber has another framerate as the liveview (25fps)
7 * See the README.txt file for copyright information and how to reach the author(s).
12 #ifndef _AtmoPacketQueue_
13 #define _AtmoPacketQueue_
16 #include "AtmoThread.h"
18 #if defined(_ATMO_VLC_PLUGIN_)
19 # include <vlc_common.h>
20 # include <vlc_threads.h>
22 # include "AtmoPacketQueueStatus.h"
26 struct ColorPacketItem {
28 #if defined(_ATMO_VLC_PLUGIN_)
33 ColorPacketItem *next;
35 typedef ColorPacketItem* pColorPacketItem;
39 class CAtmoPacketQueue
42 #if defined(_ATMO_VLC_PLUGIN_)
45 CAtmoPacketQueue(CAtmoPacketQueueStatus *statusMonitor);
47 ~CAtmoPacketQueue(void);
57 #if !defined(_ATMO_VLC_PLUGIN_)
58 CAtmoPacketQueueStatus *m_StatusMonitor;
62 volatile pColorPacketItem m_first;
63 volatile pColorPacketItem m_last;
65 #if defined(_ATMO_VLC_PLUGIN_)
66 vlc_cond_t m_PacketArrivedCond;
67 vlc_mutex_t m_PacketArrivedLock;
68 volatile ATMO_BOOL m_PacketArrived;
71 CRITICAL_SECTION m_lock;
72 HANDLE m_hPacketArrivedEvent;
82 pColorPacket GetNextPacket();
83 pColorPacketItem GetNextPacketContainer();
86 void AddPacket(pColorPacket newPacket);
88 // timecode = GetTickCount() - framedelay;
89 #if defined(_ATMO_VLC_PLUGIN_)
90 void ShowQueueStatus(atmo_thread_t *p_this);
91 pColorPacket GetNextPacket(mtime_t timecode, ATMO_BOOL withWait, atmo_thread_t *p_this, mtime_t &packet_time );
93 pColorPacket GetNextPacket(DWORD timecode, ATMO_BOOL withWait, DWORD &packet_time );
98 ATMO_BOOL WaitForNextPacket(DWORD timeout);