1 /* |
|
2 * Copyright (c) 2007 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 the License "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: RTP/TCP streamer for RTSP source.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCRRTPTCPSTREAMER_H |
|
21 #define CCRRTPTCPSTREAMER_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <e32base.h> |
|
25 |
|
26 // CONSTANTS |
|
27 const TInt KCRRtpTcpStreamCount( 2 ); /** Max of two streams, audio and video */ |
|
28 |
|
29 // MACROS |
|
30 // None |
|
31 |
|
32 // DATA TYPES |
|
33 // None |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class MCRRtpTcpObserver; |
|
37 class CCRRtpTcpStream; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * RTP/TCP streamer for RTSP packet source. |
|
43 * |
|
44 * @lib CommonRecordingEngine.lib |
|
45 * @since Series 60 3.0 |
|
46 */ |
|
47 class CCRRtpTcpStreamer : public CBase |
|
48 { |
|
49 |
|
50 public: // Constructors and destructors |
|
51 |
|
52 /** |
|
53 * Two-phased constructor |
|
54 * @param aObserver a observer to TCP streamer. |
|
55 */ |
|
56 static CCRRtpTcpStreamer* NewL( MCRRtpTcpObserver& aObserver ); |
|
57 |
|
58 /** |
|
59 * Destructor |
|
60 */ |
|
61 virtual ~CCRRtpTcpStreamer(); |
|
62 |
|
63 public: // New methods |
|
64 |
|
65 /** |
|
66 * Signals that input IP packet is available for parsing. |
|
67 * @since Series 60 3.0 |
|
68 * @param aIpData raw RTSP/RTP/TCP data received (IP packet). |
|
69 * @param aInterleaved a TCP interleaving state. |
|
70 * @return none. |
|
71 */ |
|
72 void DataAvailable( const TDesC8& aIpData, |
|
73 const TBool& aInterleaved ); |
|
74 |
|
75 private: // Constructors and destructors |
|
76 |
|
77 /** |
|
78 * C++ default constructor |
|
79 */ |
|
80 CCRRtpTcpStreamer( MCRRtpTcpObserver& aObserver ); |
|
81 |
|
82 /** |
|
83 * Second phase constructor |
|
84 */ |
|
85 void ConstructL(); |
|
86 |
|
87 private: // New methods |
|
88 |
|
89 /** |
|
90 * Handles IP packet when more data is expected. |
|
91 * @since Series 60 3.0 |
|
92 * @param aIpData a data of IP packet. |
|
93 * @return true if not enougth data in IP packet. |
|
94 */ |
|
95 TBool HandleMoreExpected( TPtrC8& aData ); |
|
96 |
|
97 /** |
|
98 * Handles TCP interleave packet. |
|
99 * @since Series 60 3.0 |
|
100 * @param aData a data of IP packet. |
|
101 * @return true if not enougth data in IP packet. |
|
102 */ |
|
103 TBool HandleTcpPacket( TPtrC8& aData ); |
|
104 |
|
105 /** |
|
106 * Handles RTSP control response. |
|
107 * @since Series 60 3.0 |
|
108 * @param aData a data of IP packet. |
|
109 * @param aInterleaved a TCP interleaving state. |
|
110 * @return true if not enougth data in IP packet. |
|
111 */ |
|
112 TBool HandleRtspResponse( TPtrC8& aData, |
|
113 const TBool& aInterleaved ); |
|
114 |
|
115 /** |
|
116 * Creates an packet from IP data buffer. |
|
117 * @since Series 60 3.0 |
|
118 * @param aData a data of IP packet. |
|
119 * @param aLength a length of RTSP/RTP packet. |
|
120 * @return none. |
|
121 */ |
|
122 void MakePacket( TPtrC8& aData, const TInt aLength ); |
|
123 |
|
124 /** |
|
125 * Handles incoming RTP or RTCP packet, forwards to user and to RTCP engine. |
|
126 * @since Series 60 3.0 |
|
127 * @param aPacket a data of RTP packet. |
|
128 * @return none. |
|
129 */ |
|
130 void ForwardPacket( const TDesC8& aPacket ); |
|
131 |
|
132 private: // Data |
|
133 |
|
134 /** |
|
135 * Observer for streaming session. |
|
136 */ |
|
137 MCRRtpTcpObserver& iObserver; |
|
138 |
|
139 /** |
|
140 * More expected bytes count. |
|
141 */ |
|
142 TInt iMoreExpected; |
|
143 |
|
144 /** |
|
145 * Data received so far. |
|
146 */ |
|
147 HBufC8* iIpData; |
|
148 |
|
149 /** |
|
150 * RTSP data received so far. |
|
151 */ |
|
152 HBufC8* iRtspData; |
|
153 |
|
154 /** |
|
155 * Media streams |
|
156 */ |
|
157 CCRRtpTcpStream* iStreams[KCRRtpTcpStreamCount]; |
|
158 |
|
159 }; |
|
160 |
|
161 #endif // CCRTCPSTREAMER_H |
|
162 |
|
163 // End of File |
|
164 |
|