mmsharing/mmshengine/inc/musengmceutils.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     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 
       
    28 
       
    29 class CMceSession;
       
    30 class CMceDisplaySink;
       
    31 class CMceCameraSource;
       
    32 class CMceFileSource;
       
    33 class CMceVideoStream;
       
    34 class CMceSpeakerSink;
       
    35 
       
    36 
       
    37 /**
       
    38 * Static class including utility methods to locate and manipulate MCE 
       
    39 * sessions, streams, sources and sinks
       
    40 * @lib musengine.lib
       
    41 */
       
    42 class MusEngMceUtils
       
    43     {
       
    44 
       
    45     public:
       
    46         
       
    47         /**
       
    48         * Tells if a stream is a video stream with rtp source.
       
    49         *
       
    50         * @param aStream Stream to be investigated
       
    51         * @return ETrue if parameter is a video stream with a RTP source
       
    52         */
       
    53         static TBool IsVideoInStream( CMceMediaStream& aStream );
       
    54 
       
    55         /**
       
    56         * Tells if a stream is an audio stream with rtp source.
       
    57         *
       
    58         * @param aStream Stream to be investigated
       
    59         * @return ETrue if parameter is an audio stream with a RTP source
       
    60         */
       
    61         static TBool IsAudioInStream( CMceMediaStream& aStream );
       
    62 
       
    63         /**
       
    64         * Gets handle to video stream with RTP sink. 
       
    65         * Ownership is not transferred.
       
    66         *
       
    67         * @return Outgoing video stream
       
    68         * @leave KErrNotFound if none exists
       
    69         * @leave KErrOverflow if session contains more than one outgoing
       
    70         *        video stream
       
    71         */
       
    72         static CMceVideoStream* GetVideoOutStreamL( CMceSession& aSession );
       
    73 
       
    74         /**
       
    75         * Gets handle to video stream with RTP source.
       
    76         * Ownership is not transferred.
       
    77         *
       
    78         * @return Incoming video stream
       
    79         * @leave KErrNotFound if none exists
       
    80         * @leave KErrOverflow if session contains more than one incoming
       
    81         *        video stream
       
    82         */
       
    83         static CMceVideoStream* GetVideoInStreamL( CMceSession& aSession );
       
    84 
       
    85         /**
       
    86         * Gets handle to video stream with file sink. 
       
    87         * Ownership is not transferred.
       
    88         *
       
    89         * @return Recording video stream, NULL if none exists
       
    90         */
       
    91         static CMceVideoStream* GetRecordingStream( CMceSession& aSession );
       
    92         
       
    93         /**
       
    94         * Gets handle to a media sink of spesified type contained by
       
    95         * a mediastream. If there are several sink instances, first one is 
       
    96         * returned. Ownership is not transferred.
       
    97         *
       
    98         * @return Media sink of the spesified type. NULL if none exists
       
    99         */
       
   100         static CMceMediaSink* GetMediaSink( CMceMediaStream& aStream, 
       
   101                                             TMceSinkType aType );
       
   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. Ownership is not transferred.
       
   107         *
       
   108         * @return Media sink of the spesified type.
       
   109         * @leave KErrNotFound if there is no sink of spesified type
       
   110         */
       
   111         static CMceMediaSink* GetMediaSinkL( CMceMediaStream& aStream, 
       
   112                                              TMceSinkType aType );
       
   113 
       
   114         /**
       
   115         * Gets handle to a media sink of spesified type contained by
       
   116         * a session. If there are several sink instances, first one is 
       
   117         * returned. Ownership is not transferred.
       
   118         *
       
   119         * @return Media sink of the spesified type. NULL if none exists
       
   120         */
       
   121         static CMceMediaSink* GetMediaSink( CMceSession& aSession, 
       
   122                                             TMceSinkType aType );
       
   123         
       
   124         /**
       
   125         * Gets handle to a media sink of spesified type contained by
       
   126         * a session. If there are several sink instances, first one is 
       
   127         * returned. Ownership is not transferred.
       
   128         *
       
   129         * @return Media sink of the spesified type.
       
   130         * @leave KErrNotFound if there is no sink of spesified type
       
   131         */
       
   132         static CMceMediaSink* GetMediaSinkL( CMceSession& aSession, 
       
   133                                              TMceSinkType aType );
       
   134         
       
   135         /**
       
   136         * Gets handle to a speaker sink contained by specified stream 
       
   137         * or its' bound stream. Ownership is not transferred.
       
   138         *
       
   139         * @return Speaker sink, NULL if none exists
       
   140         */
       
   141         static CMceSpeakerSink* GetSpeaker( CMceMediaStream& aStream );        
       
   142                                                                                   
       
   143         /**
       
   144         * Gets handle to a camera source. Ownership is not transferred.
       
   145         *
       
   146         * @return Camera source
       
   147         * @leave KErrNotFound if none exists
       
   148         */
       
   149         static CMceCameraSource* GetCameraL( CMceSession& aSession );        
       
   150 
       
   151         /**
       
   152         * Gets handle to a file source. Ownership is not transferred.
       
   153         *
       
   154         * @return File source
       
   155         * @leave KErrNotFound if none exists 
       
   156         */
       
   157         static CMceFileSource* GetFileSourceL( CMceSession& aSession );  
       
   158  
       
   159         /**
       
   160         * Gets handle to a display sink. Ownership is not transferred.
       
   161         *
       
   162         * @return Display sink, NULL if none exists
       
   163         */
       
   164         static CMceDisplaySink* GetDisplay( CMceSession& aSession );        
       
   165 
       
   166         /**
       
   167         * Gets handle to a display sink. If there are several display
       
   168         * sink instances, first one is returned.
       
   169         * Ownership is not transferred.
       
   170         *
       
   171         * @return Display sink
       
   172         * @leave KErrNotFound if there is no display
       
   173         */
       
   174         static CMceDisplaySink* GetDisplayL( CMceSession& aSession );     
       
   175 
       
   176         /**
       
   177         * Adds display sink to specified stream if one does not exist already.
       
   178         * Display rect is set in both cases to a specified one.
       
   179         * Display is disabled by default.
       
   180         * 
       
   181         * @param aStream is a stream where display is supposed to be added
       
   182         * @param aManager reference to used MCE manager
       
   183         * @param aDisplayRect is desired display area
       
   184         * @leave KErrArgument if offered stream is not a video stream
       
   185         */
       
   186         static void AddDisplayL( CMceMediaStream& aStream, 
       
   187                                  CMceManager& aManager, 
       
   188                                  const TRect& aDisplayRect );
       
   189 
       
   190         /**
       
   191         * Adds speaker sink to specified stream if one does not exist already.
       
   192         * Speaker is disabled by default.
       
   193         * 
       
   194         * @param aStream is a stream where speaker is supposed to be added
       
   195         * @leave KErrArgument if offered stream is not a video stream
       
   196         */
       
   197         static void AddSpeakerL( CMceMediaStream& aStream );
       
   198         
       
   199         /**
       
   200         * Disables a specified stream, its' source and all the sinks
       
   201         * 
       
   202         * @param aStream is a stream to be disabled
       
   203         */
       
   204         static void DisableStreamL( CMceMediaStream& aStream );
       
   205         
       
   206     };
       
   207 
       
   208 
       
   209 #endif // MUSENGMCEUTILS_H