helix_ren/helix_stub/external_packet_source_api/src/CXPSPacketSink.cpp
changeset 0 d7e778ce6e8e
equal deleted inserted replaced
-1:000000000000 0:d7e778ce6e8e
       
     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 #include <e32math.h>
       
    21 #include <RtpHeader.h>
       
    22 
       
    23 #include "CXPSPacketSink.h"
       
    24 
       
    25 #include "CXPSPacket.h"
       
    26 
       
    27 
       
    28 
       
    29 //
       
    30 // Creates packet sink
       
    31 //
       
    32 // Returns NULL on memory error
       
    33 // 
       
    34 CXPSPacketSink* CXPSPacketSink::New()
       
    35 {
       
    36     return NULL ;
       
    37 }
       
    38 
       
    39 
       
    40 //
       
    41 //  Constructor
       
    42 //
       
    43 CXPSPacketSink::CXPSPacketSink() 
       
    44                     
       
    45 {
       
    46    //do nothing
       
    47 }
       
    48 
       
    49 //
       
    50 //  Destructor
       
    51 //
       
    52 CXPSPacketSink::~CXPSPacketSink()
       
    53 {
       
    54     // do nothing
       
    55 }
       
    56 
       
    57 
       
    58 
       
    59 //
       
    60 //  Creates the symbian server with the specified name and 
       
    61 //  waits for client connection.
       
    62 //
       
    63 //  Parameters:
       
    64 //		ServerName	: Name of the server to be created.
       
    65 //		pObserver	: Observer for packet sink callbacks
       
    66 //
       
    67 //  Returns KErrNone on success or system wide error otherwise
       
    68 // 
       
    69 //
       
    70 TInt CXPSPacketSink::Init(const TDesC& /*ServerName*/, MXPSPktSinkObserver* /*pObserver*/)
       
    71 {
       
    72    
       
    73     return KErrNotSupported;
       
    74 }
       
    75 
       
    76 
       
    77 //
       
    78 // Sets the SDP info into the server.
       
    79 //
       
    80 // Note: 
       
    81 //		SetSessionDescription SHALL be invoked before the application
       
    82 //		issues a open URL on the MMF controller. OpenURL on controller 
       
    83 //		will result in a connect and query for SDP by the client
       
    84 //
       
    85 //		Init SHALL be called prior to this API invocation
       
    86 //
       
    87 // Parameters:
       
    88 //		aSDPDesc	: Session description protocol message
       
    89 //		unNumStreams: Number of streams
       
    90 // 
       
    91 // Returns KErrNone on success or system wide error otherwise
       
    92 //
       
    93 //
       
    94 //
       
    95 TInt CXPSPacketSink::SetSessionDescription(TDesC8& /*aSDPDesc*/, TUint /* uNumStreams*/)
       
    96 {
       
    97     
       
    98     return KErrNotSupported;
       
    99 }
       
   100 
       
   101 //
       
   102 // Sets the session's output device mode. 
       
   103 // Audio, Video or other streams will use the bit mask to make a decision
       
   104 // on routing to external devices (eg., Bluetooth, TV-Out,etc)
       
   105 //
       
   106 // Note: 
       
   107 //      SetSecureOutputMode is an optional API and SHALL be invoked while
       
   108 //      playing protected content. Default behaviour is allow all ie., 
       
   109 //      no restrictions applied in routing streams to output devices.
       
   110 //
       
   111 //		SetSecureOutputMode SHALL be invoked before the application
       
   112 //		issues a OpenURL on the MMF controller. 
       
   113 //
       
   114 //		Init SHALL be called prior to this API invocation
       
   115 //
       
   116 // Parameters:
       
   117 //		ulSecureOutBitMask	: 32-Bit mask representing the secure output mode
       
   118 //                            All bits zero will result in BLOCKING of unsecure 
       
   119 //                            output devices. (0x0) (eg. TV-Out will be blocked)
       
   120 //                            All bits one will result in allowing streams to 
       
   121 //                            render to both secure and unsecure output devices. 
       
   122 //                            (0xFFFFFFFF) Rest of the bit mask combinations 
       
   123 //                            are reserved for future use.
       
   124 // 
       
   125 // Returns KErrNone on success or system wide error otherwise
       
   126 //
       
   127 //
       
   128 //
       
   129 TInt CXPSPacketSink::SetSecureOutputMode(TUint32 /* ulSecureOutBitMask */)
       
   130 {
       
   131     return KErrNotSupported;
       
   132 }
       
   133 
       
   134 //
       
   135 // AuthenticateClient sets the minimum capability that a client SHALL 
       
   136 // possess for connecting to the server.
       
   137 //
       
   138 // Note: 
       
   139 //		AuthenticateClient SHALL be invoked before the application
       
   140 //		issues a open URL on the MMF controller. OpenURL on controller 
       
   141 //		will result in a connect.
       
   142 //
       
   143 //		Init SHALL be called prior to this API invocation
       
   144 //
       
   145 // Parameters:
       
   146 //		aSDPDesc	: Session description protocol message
       
   147 // 
       
   148 // Returns KErrNone on success or system wide error otherwise
       
   149 //
       
   150 //
       
   151 //
       
   152 TInt CXPSPacketSink::AuthenticateClient(TSecurityPolicy& /* aSecurityPolicy*/)
       
   153 {
       
   154     return KErrNotSupported;
       
   155 }
       
   156 
       
   157     //
       
   158     // Enqueues the packet on the packet sink. 
       
   159     // 
       
   160     // Parameters:
       
   161     //		unStreamId	: Stream identifier
       
   162     //		CXPSPacket	: transferred packet, XPS takes over ownership
       
   163     //
       
   164     // Returns KErrNone on success or system wide error otherwise. 
       
   165     //			Packet overflow scenario will result in KErrOverflow.
       
   166     //		    Application SHALL stop supplying more packets on receiving KErrOverflow. 
       
   167     //			Packet supply can be resumed after the callback from the packet sink.
       
   168     //          MXPSPacketSinkObserver::ResumePacketSupply API will be used to notify. 
       
   169     //
       
   170     //  NOTE:
       
   171     //      KErrOverflow return indicates that the slots are filled out. Current packet 
       
   172     //      has been enqueued and there are no slots for more packets. Packet supply 
       
   173     //      SHALL be resumed after observer callback (MXPSPktSinkObserver::RestorePacketSupply).
       
   174     //      KErrNotReady will be returned if packets are enqueued after overflow and before
       
   175     //      resume callback
       
   176     //			
       
   177     // 
       
   178 TInt CXPSPacketSink::Enqueue(TUint /* unStreamNumber*/, CXPSPacket* /*pPacket*/)
       
   179 {
       
   180     return KErrNotSupported;
       
   181 }
       
   182 
       
   183 //
       
   184 // Enqueues the packet on the packet sink. 
       
   185 // 
       
   186 // Parameters:
       
   187 //		unStreamId	: Stream identifier
       
   188 //		aHeaderInfo	: RTP header of the packet
       
   189 //		aPayloadData: RTP payload
       
   190 //
       
   191 // Returns KErrNone on success or system wide error otherwise. 
       
   192 //			Packet overflow scenario will result in KErrOverflow.
       
   193 //		    Application SHALL stop supplying more packets on receiving KErrOverflow. 
       
   194 //			Packet supply can be resumed after the callback from the packet sink.
       
   195 //          MXPSPacketSinkObserver::ResumePacketSupply API will be used to notify. 
       
   196 //			
       
   197 // 
       
   198 TInt CXPSPacketSink::Enqueue(TUint /*unStreamId*/, const TRtpRecvHeader& /*aHeaderInfo*/, 
       
   199                              const TDesC8& /*aPayloadData*/)
       
   200 {
       
   201     return KErrNotSupported;
       
   202 }
       
   203 
       
   204 //
       
   205 // StreamEnd indicates the end of given stream
       
   206 //
       
   207 // Paramaters:
       
   208 //		unStreamId	: Stream identifier
       
   209 //
       
   210 // Returns KErrNone on success or system wide error otherwise
       
   211 //
       
   212 // 
       
   213 TInt CXPSPacketSink::StreamEnd(TUint /*unStreamNumber*/)
       
   214 {
       
   215    return KErrNotSupported;
       
   216 }
       
   217 
       
   218 
       
   219 
       
   220 //
       
   221 // Configures the stream's buffering capability. Sets the 
       
   222 // queue to the size specified.
       
   223 //
       
   224 // Note:
       
   225 //		This API is optional. Packet sink will start with default values
       
   226 //
       
   227 // Paramaters:
       
   228 //		unStreamId	: Stream identifier
       
   229 //		unNumSlots	: Maximum number of packets that may be bufferred in
       
   230 //					  packet sink for the given stream
       
   231 //
       
   232 // Returns KErrNone on success or system wide error otherwise
       
   233 //
       
   234 TInt CXPSPacketSink::ConfigStream(TUint /*unStreamId*/, TUint /*unNumSlots*/)
       
   235 {
       
   236    return KErrNotSupported;
       
   237 }
       
   238 
       
   239 
       
   240     //
       
   241     // Configures the stream's buffering capability. Sets the 
       
   242     // queue to the heap size specified.
       
   243     //
       
   244     // Note:
       
   245     //		This API is optional. Packet sink will start with default values
       
   246     //      This API could be called during runtime to re-adjust the queue size
       
   247     //
       
   248     // Paramaters:
       
   249     //		unStreamId	        : Stream identifier
       
   250     //		unQueueSiezInBytes	: Maximum number of heap size that may be 
       
   251     //                    bufferred in packet sink for the given stream
       
   252     //
       
   253     // Returns KErrNone on success or system wide error otherwise
       
   254     //
       
   255 TInt CXPSPacketSink::ConfigStreamBySize(TUint /*unStreamId*/, TUint32 /*unQueueSiezInBytes*/)
       
   256 {
       
   257     return KErrNotSupported;
       
   258 }
       
   259 
       
   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 CXPSPacketSink::Reset()
       
   270 {
       
   271     return KErrNotSupported;
       
   272 }
       
   273 
       
   274     //
       
   275     // SetOverflowAutoManage instructs XPS whether to do buffer overflow control or not
       
   276     //
       
   277     // Paramaters:
       
   278     //		bIsOverflowAutoManaged: 
       
   279     //        ETrue: if XPS has no packet for one stream, and Helix is demanding 
       
   280     //               for it, XPS will drop 1 packet from any stream whose queue
       
   281     //               is full. It allows XPS client to push further packets into XPS 
       
   282     //               in the hope that required stream packet could come to XPS 
       
   283     //               eventually. This process repeats till XPS receives deired packet.
       
   284     //        EFalse:XPS dose not do buffer management described above
       
   285     //
       
   286     //      Note: If XPS client has single queue implementation, it is better to
       
   287     //            let XPS handle the overflow situation.
       
   288     //      
       
   289     //      Default: ETrue
       
   290     //
       
   291     // Returns: the previous status of Overflow Management
       
   292     //
       
   293     // 
       
   294 TBool CXPSPacketSink::SetOverflowAutoManage(TBool /*bIsOverflowAutoManaged*/)
       
   295 {
       
   296     
       
   297     return ETrue;
       
   298 }
       
   299 
       
   300