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
00027
00028
00029
00030
00031
00032
00033 #ifndef __OPAL_H281HANDLER_H
00034 #define __OPAL_H281HANDLER_H
00035
00036 #ifdef P_USE_PRAGMA
00037 #pragma interface
00038 #endif
00039
00040 #include <ptlib.h>
00041 #include <h224handler.h>
00042 #include <h281.h>
00043
00044 #ifdef _MSC_VER
00045 #pragma warning(disable : 4244)
00046 #endif
00047
00048 class OpalH224Handler;
00049
00053 class H281VideoSource : public PObject
00054 {
00055 PCLASSINFO(H281VideoSource, PObject);
00056
00057 public:
00058
00059 H281VideoSource();
00060 ~H281VideoSource();
00061
00062 BOOL IsEnabled() const { return isEnabled; }
00063 void SetEnabled(BOOL flag) { isEnabled = flag; }
00064
00065 BYTE GetVideoSourceNumber() const { return (firstOctet >> 4) & 0x0f; }
00066 void SetVideoSourceNumber(BYTE number);
00067
00068 BOOL CanMotionVideo() const { return (firstOctet >> 2) & 0x01; }
00069 void SetCanMotionVideo(BOOL flag);
00070
00071 BOOL CanNormalResolutionStillImage() const { return (firstOctet >> 1) & 0x01; }
00072 void SetCanNormalResolutionStillImage(BOOL flag);
00073
00074 BOOL CanDoubleResolutionStillImage() const { return (firstOctet & 0x01); }
00075 void SetCanDoubleResolutionStillImage(BOOL flag);
00076
00077 BOOL CanPan() const { return (secondOctet >> 7) & 0x01; }
00078 void SetCanPan(BOOL flag);
00079
00080 BOOL CanTilt() const { return (secondOctet >> 6) & 0x01; }
00081 void SetCanTilt(BOOL flag);
00082
00083 BOOL CanZoom() const { return (secondOctet >> 5) & 0x01; }
00084 void SetCanZoom(BOOL flag);
00085
00086 BOOL CanFocus() const { return (secondOctet >> 4) & 0x01; }
00087 void SetCanFocus(BOOL flag);
00088
00089 void Encode(BYTE *data) const;
00090 BOOL Decode(const BYTE *data);
00091
00092 protected:
00093
00094 BOOL isEnabled;
00095 BYTE firstOctet;
00096 BYTE secondOctet;
00097
00098 };
00099
00102 class OpalH281Handler : public PObject
00103 {
00104 PCLASSINFO(OpalH281Handler, PObject);
00105
00106 public:
00107
00108 OpalH281Handler(OpalH224Handler & h224Handler);
00109 ~OpalH281Handler();
00110
00111 enum VideoSource {
00112 CurrentVideoSource = 0x00,
00113 MainCamera = 0x01,
00114 AuxiliaryCamera = 0x02,
00115 DocumentCamera = 0x03,
00116 AuxiliaryDocumentCamera = 0x04,
00117 VideoPlaybackSource = 0x05
00118 };
00119
00120 BOOL GetRemoteHasH281() const { return remoteHasH281; }
00121 void SetRemoteHasH281(BOOL flag) { remoteHasH281 = flag; }
00122
00123 BYTE GetLocalNumberOfPresets() const { return localNumberOfPresets; }
00124 void SetLocalNumberOfPresets(BYTE presets) { localNumberOfPresets = presets; }
00125
00126 BYTE GetRemoteNumberOfPresets() const { return remoteNumberOfPresets; }
00127
00128 H281VideoSource & GetLocalVideoSource(VideoSource source);
00129 H281VideoSource & GetRemoteVideoSource(VideoSource source);
00130
00134 void StartAction(H281_Frame::PanDirection panDirection,
00135 H281_Frame::TiltDirection tiltDirection,
00136 H281_Frame::ZoomDirection zoomDireciton,
00137 H281_Frame::FocusDirection focusDirection);
00138
00141 void StopAction();
00142
00147 void SelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
00148
00152 void StoreAsPreset(BYTE presetNumber);
00153
00156 void ActivatePreset(BYTE presetNumber);
00157
00163 void SendExtraCapabilities() const;
00164
00167 void OnReceivedExtraCapabilities(const BYTE *capabilities, PINDEX size);
00168 void OnReceivedMessage(const H281_Frame & message);
00169
00170
00171
00172
00173
00174
00175
00178 virtual void OnRemoteCapabilitiesUpdated();
00179
00182 virtual void OnStartAction(H281_Frame::PanDirection panDirection,
00183 H281_Frame::TiltDirection tiltDirection,
00184 H281_Frame::ZoomDirection zoomDirection,
00185 H281_Frame::FocusDirection focusDirection);
00186
00189 virtual void OnStopAction();
00190
00193 virtual void OnSelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
00194
00197 virtual void OnStoreAsPreset(BYTE presetNumber);
00198
00201 virtual void OnActivatePreset(BYTE presetNumber);
00202
00203 protected:
00204
00205 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, ContinueAction);
00206 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, StopActionLocally);
00207
00208 OpalH224Handler & h224Handler;
00209 BOOL remoteHasH281;
00210 BYTE localNumberOfPresets;
00211 BYTE remoteNumberOfPresets;
00212 H281VideoSource localVideoSources[6];
00213 H281VideoSource remoteVideoSources[6];
00214
00215 H281_Frame transmitFrame;
00216 PTimer transmitTimer;
00217
00218 H281_Frame::PanDirection requestedPanDirection;
00219 H281_Frame::TiltDirection requestedTiltDirection;
00220 H281_Frame::ZoomDirection requestedZoomDirection;
00221 H281_Frame::FocusDirection requestedFocusDirection;
00222 PTimer receiveTimer;
00223 };
00224
00225 #endif // __OPAL_H281HANDLER_H
00226