|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Utilities to locate and manipulate MCE sessions, streams, |
|
15 * sources and sinks |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MUSENGMCEUTILS_H |
|
22 #define MUSENGMCEUTILS_H |
|
23 |
|
24 |
|
25 #include <mcemediastream.h> |
|
26 #include <mcemediasink.h> |
|
27 #include <mcemediasource.h> |
|
28 |
|
29 |
|
30 class CMceSession; |
|
31 class CMceDisplaySink; |
|
32 class CMceCameraSource; |
|
33 class CMceFileSource; |
|
34 class CMceVideoStream; |
|
35 class CMceSpeakerSink; |
|
36 |
|
37 const TUint KMusEngNoAssociatedSourceType = KMaxTUint; |
|
38 |
|
39 /** |
|
40 * Static class including utility methods to locate and manipulate MCE |
|
41 * sessions, streams, sources and sinks |
|
42 * @lib musengine.lib |
|
43 */ |
|
44 class MusEngMceUtils |
|
45 { |
|
46 |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Tells if a stream is a video stream with rtp source. |
|
51 * |
|
52 * @param aStream Stream to be investigated |
|
53 * @return ETrue if parameter is a video stream with a RTP source |
|
54 */ |
|
55 static TBool IsVideoInStream( CMceMediaStream& aStream ); |
|
56 |
|
57 /** |
|
58 * Tells if a stream is a video stream with rtp sink. |
|
59 * |
|
60 * @param aStream Stream to be investigated |
|
61 * @return ETrue if parameter is a video stream with a RTP sink |
|
62 */ |
|
63 static TBool IsVideoOutStream( CMceMediaStream& aStream ); |
|
64 |
|
65 /** |
|
66 * Tells if a stream is an audio stream with rtp source. |
|
67 * |
|
68 * @param aStream Stream to be investigated |
|
69 * @return ETrue if parameter is an audio stream with a RTP source |
|
70 */ |
|
71 static TBool IsAudioInStream( CMceMediaStream& aStream ); |
|
72 |
|
73 /** |
|
74 * Gets handle to video stream with RTP sink. |
|
75 * Ownership is not transferred. |
|
76 * |
|
77 * @return Outgoing video stream |
|
78 * @leave KErrNotFound if none exists |
|
79 * @leave KErrOverflow if session contains more than one outgoing |
|
80 * video stream |
|
81 */ |
|
82 static CMceVideoStream* GetVideoOutStreamL( CMceSession& aSession ); |
|
83 |
|
84 /** |
|
85 * Gets handle to video stream with RTP source. |
|
86 * Ownership is not transferred. |
|
87 * |
|
88 * @return Incoming video stream |
|
89 * @leave KErrNotFound if none exists |
|
90 * @leave KErrOverflow if session contains more than one incoming |
|
91 * video stream |
|
92 */ |
|
93 static CMceVideoStream* GetVideoInStreamL( CMceSession& aSession ); |
|
94 |
|
95 /** |
|
96 * Gets handle to video stream with file sink. |
|
97 * Ownership is not transferred. |
|
98 * |
|
99 * @return Recording video stream, NULL if none exists |
|
100 */ |
|
101 static CMceVideoStream* GetRecordingStream( CMceSession& aSession ); |
|
102 |
|
103 /** |
|
104 * Gets handle to a media sink of spesified type contained by |
|
105 * a mediastream. If there are several sink instances, first one is |
|
106 * returned. If associated source type is defined, sink in stream having |
|
107 * the source is tried to be searched. If no such match, first matching |
|
108 * sink is returned. Ownership is not transferred. |
|
109 * |
|
110 * @return Media sink of the spesified type. NULL if none exists |
|
111 */ |
|
112 static CMceMediaSink* GetMediaSink( |
|
113 CMceMediaStream& aStream, |
|
114 TMceSinkType aType, |
|
115 TMceSourceType aAssociatedSourceType = KMusEngNoAssociatedSourceType ); |
|
116 |
|
117 /** |
|
118 * Gets handle to a media sink of spesified type contained by |
|
119 * a mediastream. If there are several sink instances, first one is |
|
120 * returned. If associated source type is defined, sink in stream having |
|
121 * the source is tried to be searched. If no such match, first matching |
|
122 * sink is returned. Ownership is not transferred. |
|
123 * |
|
124 * @return Media sink of the spesified type. |
|
125 * @leave KErrNotFound if there is no sink of spesified type |
|
126 */ |
|
127 static CMceMediaSink* GetMediaSinkL( |
|
128 CMceMediaStream& aStream, |
|
129 TMceSinkType aType, |
|
130 TMceSourceType aAssociatedSourceType = KMusEngNoAssociatedSourceType ); |
|
131 |
|
132 /** |
|
133 * Gets handle to a media sink of spesified type contained by |
|
134 * a session. If there are several sink instances, first one is |
|
135 * returned. If associated source type is defined, sink in stream having |
|
136 * the source is tried to be searched. If no such match, first matching |
|
137 * sink is returned. Ownership is not transferred. |
|
138 * |
|
139 * @return Media sink of the spesified type. NULL if none exists |
|
140 */ |
|
141 static CMceMediaSink* GetMediaSink( |
|
142 CMceSession& aSession, |
|
143 TMceSinkType aType, |
|
144 TMceSourceType aAssociatedSourceType = KMusEngNoAssociatedSourceType, |
|
145 TBool aStrictMatch = EFalse ); |
|
146 |
|
147 /** |
|
148 * Gets handle to a media sink of spesified type contained by |
|
149 * a session. If there are several sink instances, first one is |
|
150 * returned. If associated source type is defined, sink in stream having |
|
151 * the source is tried to be searched. If no such match, first matching |
|
152 * sink is returned. Ownership is not transferred. |
|
153 * |
|
154 * @return Media sink of the spesified type. |
|
155 * @leave KErrNotFound if there is no sink of spesified type |
|
156 */ |
|
157 static CMceMediaSink* GetMediaSinkL( |
|
158 CMceSession& aSession, |
|
159 TMceSinkType aType, |
|
160 TMceSourceType aAssociatedSourceType = KMusEngNoAssociatedSourceType, |
|
161 TBool aStrictMatch = EFalse ); |
|
162 |
|
163 /** |
|
164 * Gets handle to a speaker sink contained by specified stream |
|
165 * or its' bound stream. Ownership is not transferred. |
|
166 * |
|
167 * @return Speaker sink, NULL if none exists |
|
168 */ |
|
169 static CMceSpeakerSink* GetSpeaker( CMceMediaStream& aStream ); |
|
170 |
|
171 /** |
|
172 * Gets handle to a camera source. Ownership is not transferred. |
|
173 * |
|
174 * @return Camera source |
|
175 * @leave KErrNotFound if none exists |
|
176 */ |
|
177 static CMceCameraSource* GetCameraL( CMceSession& aSession ); |
|
178 |
|
179 /** |
|
180 * Gets handle to a file source. Ownership is not transferred. |
|
181 * |
|
182 * @return File source |
|
183 * @leave KErrNotFound if none exists |
|
184 */ |
|
185 static CMceFileSource* GetFileSourceL( CMceSession& aSession ); |
|
186 |
|
187 /** |
|
188 * Gets handle to a display sink. Ownership is not transferred. |
|
189 * |
|
190 * @return Display sink, NULL if none exists |
|
191 */ |
|
192 static CMceDisplaySink* GetDisplay( CMceSession& aSession, |
|
193 TBool aPreferViewFinder = ETrue ); |
|
194 |
|
195 /** |
|
196 * Gets handle to a display sink. If there are several display |
|
197 * sink instances view finder is preferred with default arguments. |
|
198 * Ownership is not transferred. |
|
199 * |
|
200 * @return Display sink |
|
201 * @leave KErrNotFound if there is no display |
|
202 */ |
|
203 static CMceDisplaySink* GetDisplayL( CMceSession& aSession, |
|
204 TBool aPreferViewFinder = ETrue ); |
|
205 |
|
206 /** |
|
207 * Gets handle to a display sink. Ownership is not transferred. |
|
208 * |
|
209 * @return Display sink, NULL if none exists |
|
210 */ |
|
211 static CMceDisplaySink* GetReceivingDisplay( CMceSession& aSession ); |
|
212 |
|
213 /** |
|
214 * Gets handle to a receiving display sink. Ownership is not transferred. |
|
215 * |
|
216 * @return Display sink |
|
217 * @leave KErrNotFound if there is no display |
|
218 */ |
|
219 static CMceDisplaySink* GetReceivingDisplayL( CMceSession& aSession ); |
|
220 |
|
221 /** |
|
222 * Gets handle to a viewfinder display sink. Ownership is not transferred. |
|
223 * |
|
224 * @return Display sink |
|
225 * @leave KErrNotFound if there is no display |
|
226 */ |
|
227 static CMceDisplaySink* GetVfDisplay( CMceSession& aSession ); |
|
228 |
|
229 /** |
|
230 * Adds display sink to specified stream if one does not exist already. |
|
231 * Display rect is set in both cases to a specified one. |
|
232 * Display is disabled by default. |
|
233 * |
|
234 * @param aStream is a stream where display is supposed to be added |
|
235 * @param aManager reference to used MCE manager |
|
236 * @param aDisplayRect is desired display area |
|
237 * @leave KErrArgument if offered stream is not a video stream |
|
238 */ |
|
239 static void AddDisplayL( CMceMediaStream& aStream, |
|
240 CMceManager& aManager, |
|
241 const TRect& aDisplayRect ); |
|
242 |
|
243 /** |
|
244 * Adds speaker sink to specified stream if one does not exist already. |
|
245 * Speaker is disabled by default. |
|
246 * |
|
247 * @param aStream is a stream where speaker is supposed to be added |
|
248 * @leave KErrArgument if offered stream is not a video stream |
|
249 */ |
|
250 static void AddSpeakerL( CMceMediaStream& aStream ); |
|
251 |
|
252 /** |
|
253 * Disables a specified stream, its' source and all the sinks |
|
254 * |
|
255 * @param aStream is a stream to be disabled |
|
256 */ |
|
257 static void DisableStreamL( CMceMediaStream& aStream ); |
|
258 |
|
259 /** |
|
260 * Enables or disables display sink. If the state is already correct, |
|
261 * nothing is done. |
|
262 */ |
|
263 static void DoEnableDisplayL( CMceDisplaySink& aDisplay, TBool aEnable ); |
|
264 |
|
265 }; |
|
266 |
|
267 |
|
268 #endif // MUSENGMCEUTILS_H |