• 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 #ifndef PVMF_RTSP_PORT_H_INCLUDED
19 #define PVMF_RTSP_PORT_H_INCLUDED
20 
21 #ifndef OSCL_BASE_H_INCLUDED
22 #include "oscl_base.h"
23 #endif
24 #ifndef PVLOGGER_H_INCLUDED
25 #include "pvlogger.h"
26 #endif
27 #ifndef OSCL_SOCKET_TYPES_H_INCLUDED
28 #include "oscl_socket_types.h"
29 #endif
30 #ifndef OSCL_SOCKET_H_INCLUDED
31 #include "oscl_socket.h"
32 #endif
33 #ifndef PVMF_PORT_BASE_IMPL_H_INCLUDED
34 #include "pvmf_port_base_impl.h"
35 #endif
36 #ifndef PVMI_CONFIG_AND_CAPABILITY_H_INCLUDED
37 #include "pvmi_config_and_capability.h"
38 #endif
39 #include "pvmf_node_interface.h"
40 
41 #ifndef PVMF_MEDIA_FRAG_GROU_H_INCLUDED
42 #include "pvmf_media_frag_group.h"
43 #endif
44 
45 #ifndef PVMI_CONFIG_AND_CAPABILITY_UTILS_H_INCLUDED
46 #include "pvmi_config_and_capability_utils.h"
47 #endif
48 /*
49 #ifndef PVMF_STREAMING_BUFFER_ALLOCATORS_H_INCLUDED
50 #include "pvmf_streaming_buffer_allocators.h"
51 #endif
52 */
53 #ifndef PVMI_PORT_CONFIG_KVP_H_INCLUDED
54 #include "pvmi_port_config_kvp.h"
55 #endif
56 #ifndef PVRTSP_ENGINE_NODE_EXTENSION_INTERFACE_H_INCLUDED
57 #include "pvrtspenginenodeextensioninterface.h"
58 #endif
59 
60 //Default vector reserve size
61 #define PVMF_RTSP_NODE_PORT_VECTOR_RESERVE 10
62 
63 // Capability mime strings
64 // Capability mime strings
65 #define PVMF_RTSP_PORT_IO_FORMATS "x-pvmf/pvmfstreaming/stream/encoding"
66 //#define PVMF_RTSP_PORT_IO_FORMATS "x-pvmf/pvmfstreaming/datagram/encoding"
67 #define PVMF_RTSP_PORT_IO_FORMATS_VALTYPE "x-pvmf/pvmfstreaming/stream/encoding;valtype=ksv"
68 
69 
70 class PVRTSPEngineNode;
71 
72 //Default vector reserve size
73 #define PVMF_RTSP_NODE_PORT_VECTOR_RESERVE 10
74 
75 class PVMFRTSPPort : public PvmfPortBaseImpl,
76         public PvmiCapabilityAndConfigPortFormatImpl
77 {
78     public:
79         /**
80          * Default constructor. Default settings will be used for the data queues.
81          * @param aId ID assigned to this port
82          * @param aTag Port tag
83          * @param aNode Container node
84          */
85         PVMFRTSPPort(int32 aSdpTrackID, bool aIsMedia, int32 aTag, PVMFNodeInterface* aNode);
86 
87         /**
88          * Constructor that allows the node to configure the data queues of this port.
89          * @param aTag Port tag
90          * @param aNode Container node
91          * @param aSize Data queue capacity. The data queue size will not grow beyond this capacity.
92          * @param aReserve Size of data queue for which memory is reserved. This must be
93          * less than or equal to the capacity. If this is less than capacity, memory will be
94          * allocated when the queue grows beyond the reserve size, but will stop growing at
95          * capacity.
96          * @param aThreshold Ready-to-receive threshold, in terms of percentage of the data queue capacity.
97          * This value should be between 0 - 100.
98          */
99         PVMFRTSPPort(int32 aSdpTrackID
100                      , bool aIsMedia
101                      , int32 aTag
102                      , PVMFNodeInterface* aNode
103                      , uint32 aInCapacity
104                      , uint32 aInReserve
105                      , uint32 aInThreshold
106                      , uint32 aOutCapacity
107                      , uint32 aOutReserve
108                      , uint32 aOutThreshold);
109 
110         /** Destructor */
111         ~PVMFRTSPPort();
112 
113         // Implement pure virtuals from PvmiCapabilityAndConfigPortFormatImpl interface
114         bool IsFormatSupported(PVMFFormatType);
115         void FormatUpdated();
116 
117         // this port supports config interface
QueryInterface(const PVUuid & aUuid,OsclAny * & aPtr)118         void QueryInterface(const PVUuid &aUuid, OsclAny*&aPtr)
119         {
120             if (aUuid == PVMI_CAPABILITY_AND_CONFIG_PVUUID)
121                 aPtr = (PvmiCapabilityAndConfig*)this;
122             else
123                 aPtr = NULL;
124         }
125 
126         PVMFStatus getParametersSync(PvmiMIOSession aSession, PvmiKeyType aIdentifier,
127                                      PvmiKvp*& aParameters, int& num_parameter_elements,    PvmiCapabilityContext aContext);
128         void setParametersSync(PvmiMIOSession aSession, PvmiKvp* aParameters,
129                                int num_elements, PvmiKvp * & aRet_kvp);
130         PVMFStatus releaseParameters(PvmiMIOSession aSession, PvmiKvp* aParameters, int num_elements);
131 
132         OsclSharedPtr<OsclMemAllocator> iAllocSharedPtr;
133 
134         int32   iSdpTrackID;
135         bool    bIsMedia;
136         bool    bIsChannelIDSet;
137         uint32  iChannelID;
138         int     iRdtStreamId;
139     private:
140         void Construct();
141         bool pvmiGetPortInPlaceDataProcessingInfoSync(const char* aFormatValType,
142                 PvmiKvp*& aKvp);
143 
144         PVLogger *iLogger;
145 
146         uint32 iNumFramesConsumed; //number of frames consumed & discarded.
147 
148         friend class PVRTSPEngineNode;
149         friend class Oscl_TAlloc<PVMFRTSPPort, OsclMemAllocator>;
150 };
151 
152 #endif
153 
154