|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __CXPSPACKETSUPPLIER_H__ |
|
23 #define __CXPSPACKETSUPPLIER_H__ |
|
24 |
|
25 |
|
26 #include <e32base.h> |
|
27 #include "CXPSPacket.h" |
|
28 #include "CXPSPktSinkObserver.h" |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 // |
|
35 // Class CXPSPacketSink |
|
36 // eXternal Packet Sink provides the functionality to rendering RTP media data |
|
37 // along with the MMF controller. MMF Controller is used for control signals and |
|
38 // packet sink is used for RTP media data communication. |
|
39 // |
|
40 // CXPSPacketSink provides APIs for media description and for sending packets |
|
41 // to the playback engine. |
|
42 // |
|
43 // |
|
44 class CXPSPacketSink : public CBase |
|
45 { |
|
46 |
|
47 public: |
|
48 |
|
49 // |
|
50 // Creates packet sink |
|
51 // |
|
52 // Returns NULL on memory error |
|
53 // |
|
54 static CXPSPacketSink* New(); |
|
55 |
|
56 // |
|
57 // Virtual destructor |
|
58 // |
|
59 virtual ~CXPSPacketSink(); |
|
60 |
|
61 // |
|
62 // Creates the symbian server with the specified name and |
|
63 // waits for client connection. |
|
64 // |
|
65 // Parameters: |
|
66 // ServerName : Name of the server to be created. |
|
67 // pObserver : Observer for packet sink callbacks |
|
68 // |
|
69 // Returns KErrNone on success or system wide error otherwise |
|
70 // |
|
71 // |
|
72 TInt Init(const TDesC& ServerName, MXPSPktSinkObserver* pObserver); |
|
73 |
|
74 // |
|
75 // AuthenticateClient sets the minimum capability that a client SHALL |
|
76 // possess for connecting to the server. |
|
77 // |
|
78 // Note: |
|
79 // AuthenticateClient SHALL be invoked before the application |
|
80 // issues a open URL on the MMF controller. OpenURL on controller |
|
81 // will result in a connect. |
|
82 // |
|
83 // Init SHALL be called prior to this API invocation |
|
84 // |
|
85 // Parameters: |
|
86 // aSecurityPolicy : Security policy |
|
87 // |
|
88 // Returns KErrNone on success or system wide error otherwise |
|
89 // |
|
90 // |
|
91 // |
|
92 TInt AuthenticateClient(TSecurityPolicy& aSecurityPolicy); |
|
93 |
|
94 // |
|
95 // Sets the SDP info into the server. |
|
96 // |
|
97 // Optional xps related sdp attributes |
|
98 // Session Level Attribute |
|
99 // XpsStreamSyncOffset: Inter stream synchronization offset value |
|
100 // in msec. This makes sure that XPS packet |
|
101 // reading between streams can be offset only |
|
102 // by specified value. Default: 1000 msec |
|
103 // |
|
104 // DisableVideoClock: Flag to disable clock source for video playback. |
|
105 // |
|
106 // Media Level Attribute |
|
107 // XpsHdrBufSize: XPS transport Header buffer size between XPS server |
|
108 // & XPS client. Default: 512 bytes |
|
109 // XpsPyldBufSize: XPS transport payload buffer size between XPS server |
|
110 // & XPS client. Default: 4096 bytes |
|
111 // |
|
112 // |
|
113 // Note: |
|
114 // SetSessionDescription SHALL be invoked before the application |
|
115 // issues a open URL on the MMF controller. OpenURL on controller |
|
116 // will result in a connect and query for SDP by the client |
|
117 // |
|
118 // Init SHALL be called prior to this API invocation |
|
119 // |
|
120 // The stream number is based on the order of the streams (m=mediatype) in the |
|
121 // SDP file. Currently only m=audio and m=video would be valid streams and id |
|
122 // would be assigned in increasing order starting with zero. |
|
123 // |
|
124 // Parameters: |
|
125 // aSDPDesc : Session description protocol message |
|
126 // unNumStreams: Number of streams |
|
127 // |
|
128 // Returns KErrNone on success or system wide error otherwise |
|
129 // |
|
130 // |
|
131 // |
|
132 TInt SetSessionDescription(TDesC8& aSDPDesc, TUint unNumStreams); |
|
133 |
|
134 // |
|
135 // Sets the session's output device mode. |
|
136 // Audio, Video or other streams will use the bit mask to make a decision |
|
137 // on routing to external devices (eg., Bluetooth, TV-Out,etc) |
|
138 // |
|
139 // Note: |
|
140 // SetSecureOutputMode is an optional API and SHALL be invoked while |
|
141 // playing protected content. Default behaviour is allow all ie., |
|
142 // no restrictions applied in routing streams to output devices. |
|
143 // |
|
144 // Init SHALL be called prior to this API invocation |
|
145 // |
|
146 // SetSecureOutputMode can be called anytime after Init. If it is called |
|
147 // after playback started then the Secure output settings will take effect |
|
148 // at the presentation time of the first packet enqueued after SetSecureOutputMode |
|
149 // is called. |
|
150 // |
|
151 // Parameters: |
|
152 // ulSecureOutBitMask : 32-Bit mask representing the secure output mode |
|
153 // All bits zero will result in BLOCKING of unsecure |
|
154 // output devices. (0x0) (eg. TV-Out will be blocked) |
|
155 // All bits one will result in allowing streams to |
|
156 // render to both secure and unsecure output devices. |
|
157 // (0xFFFFFFFF) Rest of the bit mask combinations |
|
158 // are reserved for future use. |
|
159 // |
|
160 // Returns KErrNone on success or system wide error otherwise |
|
161 // |
|
162 // |
|
163 // |
|
164 TInt SetSecureOutputMode(TUint32 ulSecureOutBitMask); |
|
165 |
|
166 |
|
167 // |
|
168 // Enqueues the packet on the packet sink. |
|
169 // |
|
170 // Parameters: |
|
171 // unStreamId : Stream identifier |
|
172 // CXPSPacket : transferred packet, XPS takes over ownership |
|
173 // |
|
174 // Returns KErrNone on success or system wide error otherwise. |
|
175 // Packet overflow scenario will result in KErrOverflow. |
|
176 // Application SHALL stop supplying more packets on receiving KErrOverflow. |
|
177 // Packet supply can be resumed after the callback from the packet sink. |
|
178 // MXPSPacketSinkObserver::ResumePacketSupply API will be used to notify. |
|
179 // |
|
180 // NOTE: |
|
181 // KErrOverflow return indicates that the slots are filled out. Current packet |
|
182 // has been enqueued and there are no slots for more packets. Packet supply |
|
183 // SHALL be resumed after observer callback (MXPSPktSinkObserver::RestorePacketSupply). |
|
184 // KErrNotReady will be returned if packets are enqueued after overflow and before |
|
185 // resume callback |
|
186 // |
|
187 // |
|
188 TInt Enqueue(TUint unStreamNumber, CXPSPacket* pPacket); |
|
189 |
|
190 // |
|
191 // Enqueues the packet on the packet sink. |
|
192 // |
|
193 // Parameters: |
|
194 // unStreamId : Stream identifier |
|
195 // aHeaderInfo : RTP header of the packet |
|
196 // aPayloadData: RTP payload |
|
197 // |
|
198 // Returns KErrNone on success or system wide error otherwise. |
|
199 // Packet overflow scenario will result in KErrOverflow. |
|
200 // Application SHALL stop supplying more packets on receiving KErrOverflow. |
|
201 // Packet supply can be resumed after the callback from the packet sink. |
|
202 // MXPSPacketSinkObserver::ResumePacketSupply API will be used to notify. |
|
203 // |
|
204 // NOTE: |
|
205 // KErrOverflow return indicates that the slots are filled out. Current packet |
|
206 // has been enqueued and there are no slots for more packets. Packet supply |
|
207 // SHALL be resumed after observer callback (MXPSPktSinkObserver::RestorePacketSupply). |
|
208 // KErrNotReady will be returned if packets are enqueued after overflow and before |
|
209 // resume callback |
|
210 // |
|
211 // |
|
212 TInt Enqueue(TUint unStreamId, const TRtpRecvHeader& aHeaderInfo, const TDesC8& aPayloadData); |
|
213 |
|
214 // |
|
215 // StreamEnd indicates the end of given stream |
|
216 // |
|
217 // Paramaters: |
|
218 // unStreamId : Stream identifier |
|
219 // |
|
220 // Returns KErrNone on success or system wide error otherwise |
|
221 // |
|
222 // |
|
223 TInt StreamEnd(TUint unStreamId); |
|
224 |
|
225 // |
|
226 // Configures the stream's buffering capability. Sets the |
|
227 // queue to the size specified. |
|
228 // |
|
229 // Note: |
|
230 // This API is optional. Packet sink will start with default values |
|
231 // |
|
232 // Paramaters: |
|
233 // unStreamId : Stream identifier |
|
234 // unNumSlots : Maximum number of packets that may be bufferred in |
|
235 // packet sink for the given stream |
|
236 // |
|
237 // Returns KErrNone on success or system wide error otherwise |
|
238 // |
|
239 // Warning: It is strongly recommended to use ConfigStreamBySize() |
|
240 // instead of ConfigStream() |
|
241 // |
|
242 TInt ConfigStream(TUint unStreamId, TUint unNumSlots); |
|
243 |
|
244 // |
|
245 // Configures the stream's buffering capability. Sets the |
|
246 // queue to the heap size specified. |
|
247 // |
|
248 // Note: |
|
249 // This API is optional. Packet sink will start with default values |
|
250 // This API could be called during runtime to re-adjust the queue size |
|
251 // |
|
252 // Paramaters: |
|
253 // unStreamId : Stream identifier |
|
254 // unQueueSiezInBytes : Maximum number of heap size that may be |
|
255 // bufferred in packet sink for the given stream |
|
256 // |
|
257 // Returns KErrNone on success or system wide error otherwise |
|
258 // |
|
259 TInt ConfigStreamBySize(TUint unStreamId, TUint32 unQueueSiezInBytes); |
|
260 |
|
261 // |
|
262 // Resets the packet sink. Releases all the packets stored in packet sink |
|
263 // Does not affect the SDP or intialization attributes. It only cleans up the |
|
264 // bufferred packets on the packet sink |
|
265 // |
|
266 // Returns KErrNone on success or system wide error otherwise |
|
267 // |
|
268 // |
|
269 TInt Reset(); |
|
270 |
|
271 // |
|
272 // SetOverflowAutoManage instructs XPS whether to do buffer overflow control or not |
|
273 // |
|
274 // Paramaters: |
|
275 // bIsOverflowAutoManaged: |
|
276 // ETrue: if XPS has no packet for one stream, and Helix is demanding |
|
277 // for it, XPS will drop 1 packet from any stream whose queue |
|
278 // is full. It allows XPS client to push further packets into XPS |
|
279 // in the hope that required stream packet could come to XPS |
|
280 // eventually. This process repeats till XPS receives deired packet. |
|
281 // EFalse:XPS dose not do buffer management described above |
|
282 // |
|
283 // Note: If XPS client has single queue implementation, it is better to |
|
284 // let XPS handle the overflow situation. |
|
285 // |
|
286 // Default: ETrue |
|
287 // |
|
288 // Returns: the previous status of Overflow Management |
|
289 // |
|
290 // |
|
291 TBool SetOverflowAutoManage(TBool bIsOverflowAutoManaged); |
|
292 |
|
293 private: |
|
294 // private member functions |
|
295 |
|
296 CXPSPacketSink(); |
|
297 |
|
298 |
|
299 |
|
300 private: |
|
301 // private data members |
|
302 |
|
303 |
|
304 |
|
305 }; |
|
306 |
|
307 #endif // End of __CXPSPACKETSUPPLIER_H__ |
|
308 |