summaryrefslogtreecommitdiffstats
blob: b1756b9ef2ae21638ffcf2a052337665ae26e8af (plain)
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
/*
 * Copyright (c) 2012 Yoann Blein
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#pragma once

#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Base/IDGenerator.h>

#include <boost/shared_ptr.hpp>

namespace Swift {
	class JingleSession;
	class JingleRawUDPTransportPayload;
	class UDPSocketFactory;
	class UDPSocket;

	class ScreenSharing {
		public:
			typedef boost::shared_ptr<ScreenSharing> ref;

			enum SCState {
				Canceled,
				Failed,
				Finished,
				Negotiating,
				Connecting,
				BroadCasting,
				Receiving,
				WaitingForStart,
				WaitingForAccept,
			};

		public:
			ScreenSharing(boost::shared_ptr<JingleSession> session, UDPSocketFactory* udpSocketFactory);
			virtual ~ScreenSharing();

			virtual void cancel() = 0;

		public:
			boost::signal<void (SCState)> onStateChange;

		protected:
			bool addBestCandidate(boost::shared_ptr<JingleRawUDPTransportPayload> transport);

		protected:
			IDGenerator idGenerator;
			boost::shared_ptr<UDPSocket> serverSocket;
			boost::shared_ptr<UDPSocket> clientSocket;

			boost::shared_ptr<JingleSession> session;
			UDPSocketFactory* udpSocketFactory;

	};
}