OPAL
Version 3.10.4
|
00001 /* 00002 * h281handler.h 00003 * 00004 * H.281 protocol handler implementation for the OpenH323 Project. 00005 * 00006 * Copyright (c) 2006 Network for Educational Technology, ETH Zurich. 00007 * Written by Hannes Friederich. 00008 * 00009 * The contents of this file are subject to the Mozilla Public License 00010 * Version 1.0 (the "License"); you may not use this file except in 00011 * compliance with the License. You may obtain a copy of the License at 00012 * http://www.mozilla.org/MPL/ 00013 * 00014 * Software distributed under the License is distributed on an "AS IS" 00015 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00016 * the License for the specific language governing rights and limitations 00017 * under the License. 00018 * 00019 * Contributor(s): ______________________________________. 00020 * 00021 * $Revision: 24178 $ 00022 * $Author: rjongbloed $ 00023 * $Date: 2010-04-05 19:10:56 -0500 (Mon, 05 Apr 2010) $ 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 #include <h224/h224handler.h> 00040 #include <h224/h281.h> 00041 00042 class OpalH224Handler; 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 OpalH224Client 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 00115 virtual BYTE GetClientID() const { return OpalH224Client::H281ClientID; } 00116 virtual PBoolean HasExtraCapabilities() const { return true; } 00117 00119 virtual void OnReceivedExtraCapabilities(const BYTE *capabilities, PINDEX size); 00120 virtual void OnReceivedMessage(const H224_Frame & message); 00121 00122 BYTE GetLocalNumberOfPresets() const { return localNumberOfPresets; } 00123 void SetLocalNumberOfPresets(BYTE presets) { localNumberOfPresets = presets; } 00124 00125 BYTE GetRemoteNumberOfPresets() const { return remoteNumberOfPresets; } 00126 00127 H281VideoSource & GetLocalVideoSource(VideoSource source); 00128 H281VideoSource & GetRemoteVideoSource(VideoSource source); 00129 00133 void StartAction(H281_Frame::PanDirection panDirection, 00134 H281_Frame::TiltDirection tiltDirection, 00135 H281_Frame::ZoomDirection zoomDireciton, 00136 H281_Frame::FocusDirection focusDirection); 00137 00140 void StopAction(); 00141 00146 void SelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode); 00147 00151 void StoreAsPreset(BYTE presetNumber); 00152 00155 void ActivatePreset(BYTE presetNumber); 00156 00162 void SendExtraCapabilities() const; 00163 00164 /* 00165 * methods that subclasses can override. 00166 * The default handler does not implement FECC on the local side. 00167 * Thus, the default behaviour is to do nothing. 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 BYTE localNumberOfPresets; 00203 BYTE remoteNumberOfPresets; 00204 H281VideoSource localVideoSources[6]; 00205 H281VideoSource remoteVideoSources[6]; 00206 00207 H281_Frame transmitFrame; 00208 PTimer transmitTimer; 00209 00210 H281_Frame::PanDirection requestedPanDirection; 00211 H281_Frame::TiltDirection requestedTiltDirection; 00212 H281_Frame::ZoomDirection requestedZoomDirection; 00213 H281_Frame::FocusDirection requestedFocusDirection; 00214 PTimer receiveTimer; 00215 }; 00216 00217 #endif // OPAL_H224_H281HANDLER_H 00218