00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef OPAL_H224_H281HANDLER_H
00027 #define OPAL_H224_H281HANDLER_H
00028
00029 #ifdef P_USE_PRAGMA
00030 #pragma interface
00031 #endif
00032
00033 #ifndef _PTLIB_H
00034 #include <ptlib.h>
00035 #endif
00036
00037 #include <opal/buildopts.h>
00038
00039
00040 #include <h224/h281.h>
00041
00042
00043
00047 class H281VideoSource : public PObject
00048 {
00049 PCLASSINFO(H281VideoSource, PObject);
00050
00051 public:
00052
00053 H281VideoSource();
00054 ~H281VideoSource();
00055
00056 PBoolean IsEnabled() const { return isEnabled; }
00057 void SetEnabled(PBoolean flag) { isEnabled = flag; }
00058
00059 BYTE GetVideoSourceNumber() const { return (firstOctet >> 4) & 0x0f; }
00060 void SetVideoSourceNumber(BYTE number);
00061
00062 PBoolean CanMotionVideo() const { return (firstOctet >> 2) & 0x01; }
00063 void SetCanMotionVideo(PBoolean flag);
00064
00065 PBoolean CanNormalResolutionStillImage() const { return (firstOctet >> 1) & 0x01; }
00066 void SetCanNormalResolutionStillImage(PBoolean flag);
00067
00068 PBoolean CanDoubleResolutionStillImage() const { return (firstOctet & 0x01); }
00069 void SetCanDoubleResolutionStillImage(PBoolean flag);
00070
00071 PBoolean CanPan() const { return (secondOctet >> 7) & 0x01; }
00072 void SetCanPan(PBoolean flag);
00073
00074 PBoolean CanTilt() const { return (secondOctet >> 6) & 0x01; }
00075 void SetCanTilt(PBoolean flag);
00076
00077 PBoolean CanZoom() const { return (secondOctet >> 5) & 0x01; }
00078 void SetCanZoom(PBoolean flag);
00079
00080 PBoolean CanFocus() const { return (secondOctet >> 4) & 0x01; }
00081 void SetCanFocus(PBoolean flag);
00082
00083 void Encode(BYTE *data) const;
00084 PBoolean Decode(const BYTE *data);
00085
00086 protected:
00087
00088 PBoolean isEnabled;
00089 BYTE firstOctet;
00090 BYTE secondOctet;
00091
00092 };
00093
00096 class OpalH281Handler : public PObject
00097 {
00098 PCLASSINFO(OpalH281Handler, PObject);
00099
00100 public:
00101
00102 OpalH281Handler();
00103 ~OpalH281Handler();
00104
00105 enum VideoSource {
00106 CurrentVideoSource = 0x00,
00107 MainCamera = 0x01,
00108 AuxiliaryCamera = 0x02,
00109 DocumentCamera = 0x03,
00110 AuxiliaryDocumentCamera = 0x04,
00111 VideoPlaybackSource = 0x05
00112 };
00113
00114 PBoolean GetRemoteHasH281() const { return remoteHasH281; }
00115 void SetRemoteHasH281(PBoolean flag) { remoteHasH281 = flag; }
00116
00117 BYTE GetLocalNumberOfPresets() const { return localNumberOfPresets; }
00118 void SetLocalNumberOfPresets(BYTE presets) { localNumberOfPresets = presets; }
00119
00120 BYTE GetRemoteNumberOfPresets() const { return remoteNumberOfPresets; }
00121
00122 H281VideoSource & GetLocalVideoSource(VideoSource source);
00123 H281VideoSource & GetRemoteVideoSource(VideoSource source);
00124
00128 void StartAction(H281_Frame::PanDirection panDirection,
00129 H281_Frame::TiltDirection tiltDirection,
00130 H281_Frame::ZoomDirection zoomDireciton,
00131 H281_Frame::FocusDirection focusDirection);
00132
00135 void StopAction();
00136
00141 void SelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
00142
00146 void StoreAsPreset(BYTE presetNumber);
00147
00150 void ActivatePreset(BYTE presetNumber);
00151
00157 void SendExtraCapabilities() const;
00158
00161 void OnReceivedExtraCapabilities(const BYTE *capabilities, PINDEX size);
00162 void OnReceivedMessage(const H281_Frame & message);
00163
00164
00165
00166
00167
00168
00169
00172 virtual void OnRemoteCapabilitiesUpdated();
00173
00176 virtual void OnStartAction(H281_Frame::PanDirection panDirection,
00177 H281_Frame::TiltDirection tiltDirection,
00178 H281_Frame::ZoomDirection zoomDirection,
00179 H281_Frame::FocusDirection focusDirection);
00180
00183 virtual void OnStopAction();
00184
00187 virtual void OnSelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
00188
00191 virtual void OnStoreAsPreset(BYTE presetNumber);
00192
00195 virtual void OnActivatePreset(BYTE presetNumber);
00196
00197 protected:
00198
00199 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, ContinueAction);
00200 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, StopActionLocally);
00201
00202
00203 PBoolean remoteHasH281;
00204 BYTE localNumberOfPresets;
00205 BYTE remoteNumberOfPresets;
00206 H281VideoSource localVideoSources[6];
00207 H281VideoSource remoteVideoSources[6];
00208
00209 H281_Frame transmitFrame;
00210 PTimer transmitTimer;
00211
00212 H281_Frame::PanDirection requestedPanDirection;
00213 H281_Frame::TiltDirection requestedTiltDirection;
00214 H281_Frame::ZoomDirection requestedZoomDirection;
00215 H281_Frame::FocusDirection requestedFocusDirection;
00216 PTimer receiveTimer;
00217 };
00218
00219 #endif // OPAL_H224_H281HANDLER_H
00220