File: XnLinkInputStreamsMgr.h

package info (click to toggle)
openni2 2.2.0.33%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 22,216 kB
  • sloc: cpp: 111,197; ansic: 35,511; sh: 10,542; python: 1,313; java: 952; makefile: 575; xml: 12
file content (69 lines) | stat: -rw-r--r-- 1,869 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef __LINKINPUTSTREAMSMGR_H__
#define __LINKINPUTSTREAMSMGR_H__

#include "XnLinkDefs.h"
#include "XnLinkProtoLibDefs.h"
#include "XnLinkProtoUtils.h"
#include "XnLinkInputStream.h"
#include <XnStatus.h>
#include <XnHash.h>

namespace xn
{

class LinkControlEndpoint;
class IConnection;

class LinkInputStreamsMgr
{

public:
	LinkInputStreamsMgr();
	~LinkInputStreamsMgr();

	XnStatus Init();
	void Shutdown();

	void RegisterStreamOfType(XnStreamType streamType, const XnChar* strCreationInfo, XnUInt16 nStreamID);
	XnBool UnregisterStream(XnUInt16 nStreamID); // returns true if the unregistered stream was the last one
	XnBool HasStreamOfType(XnStreamType streamType, const XnChar* strCreationInfo, XnUInt16& nStreamID);

	XnStatus InitInputStream(LinkControlEndpoint* pLinkControlEndpoint, 
	                         XnStreamType streamType,
                             XnUInt16 nStreamID, 
                             IConnection* pConnection);

	void ShutdownInputStream(XnUInt16 nStreamID);
	XnStatus HandleData(const void* pData, XnUInt32 nSize);
	const LinkInputStream* GetInputStream(XnUInt16 nStreamID) const;
	LinkInputStream* GetInputStream(XnUInt16 nStreamID);

	XnBool HasStreams() const;

private:
	void HandlePacket(const LinkPacketHeader* pLinkPacketHeader);
	int FindStreamByType(XnStreamType streamType, const XnChar* strCreationInfo); //returns found streamId, or -1

	static const XnUInt32 FRAG_FLAGS_ALLOWED_CHANGES[4][4];
	static const XnUInt16 INITIAL_PACKET_ID;

	struct StreamInfo
	{
		XnUInt16 nNextPacketID;
		XnUInt16 nMsgType;
		XnLinkFragmentation prevFragmentation;
		XnStreamFragLevel streamFragLevel;
		LinkInputStream* pInputStream;
		XnBool packetLoss;

		XnStreamType streamType;
		const XnChar* strCreationInfo;
		int refCount;
	};

	StreamInfo m_streamInfos[XN_LINK_MAX_STREAMS];
};

}

#endif // __LINKINPUTSTREAMSMGR_H__