• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 /*
19 * ==============================================================================
20 *  Name        : pv_2way_basic_types
21 *  Part of     :
22 *  Interface   :
23 *  Description : Basic / low-level enums and types used by PV2Way engine
24 *  Version     : (see RELEASE field in copyright header above)
25 *
26 * ==============================================================================
27 */
28 
29 #ifndef PV_2WAY_BASIC_TYPES_H_INCLUDED
30 #define PV_2WAY_BASIC_TYPES_H_INCLUDED
31 
32 #ifndef PVMF_FORMAT_TYPE_H_INCLUDED
33 #include "pvmf_format_type.h"
34 #endif
35 
36 #ifndef OSCL_VECTOR_H_INCLUDED
37 #include "oscl_vector.h"
38 #endif
39 
40 #ifndef OSCL_MEM_H_INCLUDED
41 #include "oscl_mem.h"
42 #endif
43 
44 // CONSTANTS
45 /** The starting error code for 2way specific errors **/
46 const int PV2WayErrorStatusStart = (-10500);
47 /** There was an error dispatching muxed data to the downstream node **/
48 const int PV2WayDispatchError = PV2WayErrorStatusStart - 1;
49 /** The request was rejected by the peer **/
50 const int PV2WayErrorRejected = PV2WayErrorStatusStart - 5;
51 /** Signals replacement of an existing resource **/
52 const int PV2WayErrReplaced = PV2WayErrorStatusStart - 6;
53 
54 // DATA TYPES
55 /**
56  *  TPVTerminalType enum
57  *  TPVTerminalType enumerates the possible 2-way protocols
58  **/
59 typedef enum TPVTerminalType
60 {
61     PV_323,/* based on H.323 */
62     PV_324M, /* based on H.324m */
63     PV_SIP, /* based on SIP */
64     PV_TERMINAL_TYPE_NONE
65 } PV2WayTerminalType;
66 
67 /**
68  * TPVLoopbackMode Enum
69  *
70  * TPVLoopbackMode emumerates the possible loopback options that can be used with the pv2way SDK
71  **/
72 typedef enum TPVLoopbackMode
73 {
74     PV_LOOPBACK_NONE,
75     PV_LOOPBACK_COMM, /* Loops back from Comm source to Comm sink */
76     PV_LOOPBACK_ENGINE, /* Loops back media at the engine level, no mux involved */
77     PV_LOOPBACK_MUX /* Loops back at the output of the mux */
78 } PV2WayLoopbackMode;
79 
80 /**
81  * TPVDirection Enum
82  *
83  * TPVDirection emumerates the direction of the track.
84  **/
85 typedef enum TPVDirection
86 {
87     PV_DIRECTION_NONE = 0,
88     INCOMING = 1,
89     OUTGOING = 2,
90     PV_DIRECTION_BOTH = 3
91 } PV2WayDirection;
92 
93 /**
94 Enumeration of high level media types supported by the SDK
95  **/
96 typedef enum TPVMediaType_t
97 {
98     PV_MEDIA_NONE = 0,
99     PV_CONTROL = 1,
100     PV_AUDIO = 2,
101     PV_VIDEO = 4,
102     PV_DATA = 8,
103     PV_USER_INPUT = 16,
104     PV_MULTIPLEXED = 32,
105     PV_MEDIA_ALL = 0xFFFF
106 } PV2WayMediaType;
107 
108 /**
109  * PVTrackId uniquely identifies a track for transferring audio/video in a particular direction -
110  * receive or transmit.
111  *
112  **/
113 typedef unsigned int PVTrackId;
114 
115 /**
116  * TPV2WayState Class
117  *
118  * An enumeration of the major states of the pv2way engine.
119  **/
120 typedef enum
121 {
122     /**
123         The state immediately after the pv2way instance has been successfully created or instantiated.
124         No resources have been allocated yet.
125     **/
126     EIdle = 0,
127     /**
128         The pv2way is in this state when it is initializing from the EIdle to the ESetup state.  The terminal queries the
129         available device capabilities (encode, decode, mux), acquires resources to make a two-way call (codecs, formats, memory etc)
130         and transitions to the ESetup state when it will be ready to accept setup parameters and Connect.
131         If initializing fails, the pv2way relinquishes the resources and reverts to the EIdle state.
132     **/
133     EInitializing,
134     /**
135         The state where the pv2way instance is in the process of receiving setup parameters from the application, for encoding,
136         multiplexing, capturing and rendering.  Each time a new set of parameters is passed in, validation will take place and a
137         status will be returned accordingly.  A valid data source and data sink for the communications port are to be added to the
138         terminal in this state before it can be transitioned to the Econnecting state.  Media sources and sinks can also be added
139         at this time.
140     **/
141     ESetup,
142     /**
143         The state where the pv2way instance has received a call to start connecting.  It starts communication with the remote terminal
144         to exchange media capabilities and channel configuration in preparation for the establishment of media channels.
145     **/
146     EConnecting,
147     /**
148         The state after all control signaling is completed.  The terminal is now able to open media tracks for audio and video.
149     **/
150     EConnected,
151     /**
152         The state where the terminal is shutting down all tracks and the multiplex.
153     **/
154     EDisconnecting,
155     /**
156         The state where the terminal is releasing all resources and transitioning to the EIdle state.
157     **/
158     EResetting
159 } PV2WayState;
160 
161 /**
162  * TPVTIndicationType enum
163  *
164  *  Enumeration of unsolicited indications from pv2way.
165  *
166  **/
167 enum TPVTIndicationType
168 {
169 
170     /**
171      * Indicates that the peer terminal has established an incoming track.  The
172      * local buffer specifies the media type associated with the track.
173      * The first octet of the local buffer indicates the media type.
174      * The second,third and fourth octets are reserved.
175      * The four octets from five to eight are to be interpreted as a unique track id.
176      * The format type and additional capabilities are indicated using the PV2WayTrackInfoInterface extension interface.
177      **/
178     PVT_INDICATION_INCOMING_TRACK,
179     /**
180      * Indicates that the local terminal has established an outgoing track that is
181      * acceptable to the peer.  The local buffer specifies the media type associated with the track.
182      * The first octet of the local buffer indicates the media type.
183      * The second,third and fourth octets are reserved.
184      * The four octets from five to eight are to be interpreted as a unique track id.
185      * The format type and additional capabilities are indicated using the PV2WayTrackInfoInterface extension interface.
186      **/
187     PVT_INDICATION_OUTGOING_TRACK,
188     /**
189      * Indicates that 2way engine has ended the current telephony session.  The app
190      * can now either reset the engine or make a subsequent call.
191      *
192      **/
193     PVT_INDICATION_DISCONNECT,
194     /**
195      * Indicates the start of unsolicited closure of an incoming/outgoing track.  The PVT_INDICATION_CLOSE_TRACK
196      * indication will be sent when the track is completely close.
197      * The first octet of the local buffer indicates the direction of the track.
198      * The second and third octets indicates the track id.
199      **/
200     PVT_INDICATION_CLOSING_TRACK,
201     /**
202      * Indicates an unsolicited closure of an incoming/outgoing track.  Any media sink/source
203      * associated with this will be stopped and returned to the application.
204      * The first octet of the local buffer indicates the media type of the track.
205      * The second octet indicates the direction.
206      * The third octet indicates whether there is a replacement for this track available.  If true,
207      * the application may add data source/sink for this track again.
208      **/
209     PVT_INDICATION_CLOSE_TRACK,
210     /**
211      * Indicates that the remote terminal has paused an incoming track.  Any media sink
212      * associated with this will be stopped.
213      *
214      **/
215 
216     PVT_INDICATION_PAUSE_TRACK,
217     /**
218      * Indicates that the remote terminal has resumed an incoming track.  Any media sink
219      * associated with this will be restarted.
220      *
221      **/
222     PVT_INDICATION_RESUME_TRACK,
223     /**
224      * Indicates an internal error in the pv2way engine.  The derived class provides
225      * further information about the actual error.
226      *
227      **/
228     PVT_INDICATION_INTERNAL_ERROR,
229 };
230 
231 
232 // CLASS DECLARATION
233 
234 /**
235 * PV2WayInitInfo Class
236 *
237 * PV2WayInitInfo is an interface required
238 * for protocols specific classes pass to the PV2WayInterface's
239 * InitL() method
240 *
241 **/
242 class PV2WayInitInfo
243 {
244     public:
245         /**
246         *  pure virtual method that must be overridden to return
247         *  the classname of the actual subclass
248          **/
249         virtual void GetInitInfoClassName(OSCL_wString& aClassName) = 0;
250 
~PV2WayInitInfo()251         virtual ~PV2WayInitInfo() { }
252 
253         /**
254         *  The list of audio formats that can be transmitted
255          **/
256         Oscl_Vector<const char*, OsclMemAllocator> iOutgoingAudioFormats;
257 
258         /**
259         *  The list of video formats that can be transmitted
260          **/
261         Oscl_Vector<const char*, OsclMemAllocator> iOutgoingVideoFormats;
262 
263         /**
264         *  The list of audio formats that can be received
265          **/
266         Oscl_Vector<const char*, OsclMemAllocator> iIncomingAudioFormats;
267 
268         /**
269         *  The list of video formats that can be received
270          **/
271         Oscl_Vector<const char*, OsclMemAllocator> iIncomingVideoFormats;
272 
273 };
274 
275 
276 /**
277 * PV2WayConnectOptions Class
278  *
279 * PV2WayConnectOptions class contains options to be specified during connect
280  **/
281 class PV2WayConnectOptions
282 {
283     public:
284         /**
285          * Default Constructor
286          **/
PV2WayConnectOptions()287         PV2WayConnectOptions()
288                 : iLoopbackMode(PV_LOOPBACK_NONE),
289                 iLocalId(NULL),
290                 iLocalIdSize(0),
291                 iRemoteId(NULL),
292                 iRemoteIdSize(0) {}
293 
294         /**
295          * Constructor
296          * @param aLoopbackMode
297          *         The loopback mode to used during Connect
298          * @param aLocalId, aLocalIdSize
299          *         A unique octet string identifying the local terminal
300          * @param aRemoteId, aRemoteIdSize
301          *         A unique octet string identifying the peer (Used only in 2-Stage dialling)
302          * @returns void
303          *
304          **/
PV2WayConnectOptions(TPVLoopbackMode aLoopbackMode,uint8 * aLocalId,uint32 aLocalIdSize,uint8 * aRemoteId,uint32 aRemoteIdSize)305         PV2WayConnectOptions(TPVLoopbackMode aLoopbackMode,
306                              uint8* aLocalId, uint32 aLocalIdSize,
307                              uint8* aRemoteId, uint32 aRemoteIdSize)
308                 : iLoopbackMode(aLoopbackMode),
309                 iLocalId(aLocalId),
310                 iLocalIdSize(aLocalIdSize),
311                 iRemoteId(aRemoteId),
312                 iRemoteIdSize(aRemoteIdSize)
313         {}
314 
315         /**
316         * Pure virtual method that must be overridden.  Retrieves class name
317         *
318         * @param aClassName
319         *         A reference to an OSCL_wString, which is to hold the subclass
320         *          name
321         * @returns void
322         **/
323         virtual void GetConnectInfoClassName(OSCL_wString &aClassName) = 0;
324 
325         /**
326         *  The loopback mode
327         **/
328         TPVLoopbackMode iLoopbackMode;
329 
330         /**
331         *  The id of the local terminal
332         **/
333         uint8* iLocalId;
334         /**
335         *  The size of the local id
336         **/
337         uint32 iLocalIdSize;
338 
339         /**
340         *  The id of the peer
341         **/
342         uint8* iRemoteId;
343         /**
344         *  The size of the remote id
345         **/
346         uint32 iRemoteIdSize;
347 };
348 #endif
349