OPAL Version 3.10.4

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

h281handler.h
Go to the documentation of this file.
1 /*
2 * h281handler.h
3 *
4 * H.281 protocol handler implementation for the OpenH323 Project.
5 *
6 * Copyright (c) 2006 Network for Educational Technology, ETH Zurich.
7 * Written by Hannes Friederich.
8 *
9 * The contents of this file are subject to the Mozilla Public License
10 * Version 1.0 (the "License"); you may not use this file except in
11 * compliance with the License. You may obtain a copy of the License at
12 * http://www.mozilla.org/MPL/
13 *
14 * Software distributed under the License is distributed on an "AS IS"
15 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16 * the License for the specific language governing rights and limitations
17 * under the License.
18 *
19 * Contributor(s): ______________________________________.
20 *
21 * $Revision: 24178 $
22 * $Author: rjongbloed $
23 * $Date: 2010-04-05 19:10:56 -0500 (Mon, 05 Apr 2010) $
24 */
25
26 #ifndef OPAL_H224_H281HANDLER_H
27 #define OPAL_H224_H281HANDLER_H
28
29 #ifdef P_USE_PRAGMA
30 #pragma interface
31 #endif
32
33 #ifndef _PTLIB_H
34 #include <ptlib.h>
35 #endif
36
37 #include <opal/buildopts.h>
38
39 #include <h224/h224handler.h>
40 #include <h224/h281.h>
41
42 class OpalH224Handler;
43
47 class H281VideoSource : public PObject
48 {
49 PCLASSINFO(H281VideoSource, PObject);
50
51 public:
52
53 H281VideoSource();
54 ~H281VideoSource();
55
56 PBoolean IsEnabled() const { return isEnabled; }
57 void SetEnabled(PBoolean flag) { isEnabled = flag; }
58
59 BYTE GetVideoSourceNumber() const { return (firstOctet >> 4) & 0x0f; }
60 void SetVideoSourceNumber(BYTE number);
61
62 PBoolean CanMotionVideo() const { return (firstOctet >> 2) & 0x01; }
63 void SetCanMotionVideo(PBoolean flag);
64
65 PBoolean CanNormalResolutionStillImage() const { return (firstOctet >> 1) & 0x01; }
66 void SetCanNormalResolutionStillImage(PBoolean flag);
67
68 PBoolean CanDoubleResolutionStillImage() const { return (firstOctet & 0x01); }
69 void SetCanDoubleResolutionStillImage(PBoolean flag);
70
71 PBoolean CanPan() const { return (secondOctet >> 7) & 0x01; }
72 void SetCanPan(PBoolean flag);
73
74 PBoolean CanTilt() const { return (secondOctet >> 6) & 0x01; }
75 void SetCanTilt(PBoolean flag);
76
77 PBoolean CanZoom() const { return (secondOctet >> 5) & 0x01; }
78 void SetCanZoom(PBoolean flag);
79
80 PBoolean CanFocus() const { return (secondOctet >> 4) & 0x01; }
81 void SetCanFocus(PBoolean flag);
82
83 void Encode(BYTE *data) const;
84 PBoolean Decode(const BYTE *data);
85
86 protected:
87
88 PBoolean isEnabled;
89 BYTE firstOctet;
90 BYTE secondOctet;
91
92 };
93
96 class OpalH281Handler : public OpalH224Client
97 {
98 PCLASSINFO(OpalH281Handler, PObject);
99
100 public:
101
102 OpalH281Handler();
103 ~OpalH281Handler();
104
105 enum VideoSource {
106 CurrentVideoSource = 0x00,
107 MainCamera = 0x01,
108 AuxiliaryCamera = 0x02,
109 DocumentCamera = 0x03,
110 AuxiliaryDocumentCamera = 0x04,
111 VideoPlaybackSource = 0x05
112 };
113
115 virtual BYTE GetClientID() const { return OpalH224Client::H281ClientID; }
116 virtual PBoolean HasExtraCapabilities() const { return true; }
117
119 virtual void OnReceivedExtraCapabilities(const BYTE *capabilities, PINDEX size);
120 virtual void OnReceivedMessage(const H224_Frame & message);
121
122 BYTE GetLocalNumberOfPresets() const { return localNumberOfPresets; }
123 void SetLocalNumberOfPresets(BYTE presets) { localNumberOfPresets = presets; }
124
125 BYTE GetRemoteNumberOfPresets() const { return remoteNumberOfPresets; }
126
127 H281VideoSource & GetLocalVideoSource(VideoSource source);
128 H281VideoSource & GetRemoteVideoSource(VideoSource source);
129
133 void StartAction(H281_Frame::PanDirection panDirection,
134 H281_Frame::TiltDirection tiltDirection,
135 H281_Frame::ZoomDirection zoomDireciton,
136 H281_Frame::FocusDirection focusDirection);
137
140 void StopAction();
141
146 void SelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
147
151 void StoreAsPreset(BYTE presetNumber);
152
155 void ActivatePreset(BYTE presetNumber);
156
162 void SendExtraCapabilities() const;
163
164 /*
165 * methods that subclasses can override.
166 * The default handler does not implement FECC on the local side.
167 * Thus, the default behaviour is to do nothing.
168 */
169
172 virtual void OnRemoteCapabilitiesUpdated();
173
176 virtual void OnStartAction(H281_Frame::PanDirection panDirection,
177 H281_Frame::TiltDirection tiltDirection,
178 H281_Frame::ZoomDirection zoomDirection,
179 H281_Frame::FocusDirection focusDirection);
180
183 virtual void OnStopAction();
184
187 virtual void OnSelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
188
191 virtual void OnStoreAsPreset(BYTE presetNumber);
192
195 virtual void OnActivatePreset(BYTE presetNumber);
196
197 protected:
198
199 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, ContinueAction);
200 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, StopActionLocally);
201
202 BYTE localNumberOfPresets;
203 BYTE remoteNumberOfPresets;
204 H281VideoSource localVideoSources[6];
205 H281VideoSource remoteVideoSources[6];
206
207 H281_Frame transmitFrame;
208 PTimer transmitTimer;
209
210 H281_Frame::PanDirection requestedPanDirection;
211 H281_Frame::TiltDirection requestedTiltDirection;
212 H281_Frame::ZoomDirection requestedZoomDirection;
213 H281_Frame::FocusDirection requestedFocusDirection;
214 PTimer receiveTimer;
215 };
216
217 #endif // OPAL_H224_H281HANDLER_H
218