serviceproviders/sapi_mediamanagement/src/mgmediaitemfactory.cpp
changeset 5 989d2f495d90
child 23 50974a8b132e
equal deleted inserted replaced
1:a36b1e19a461 5:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Factory method for media types
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <mclfitem.h>
       
    21  
       
    22 #include "mgmediaitemfactory.h"
       
    23 #include "mglinkfile.h"
       
    24 #include "mgmusicfile.h"
       
    25 #include "mgvideofile.h"
       
    26 #include "mgmediaitem.h"
       
    27 #include "mgmediafile.h"
       
    28 
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // MgMediaItemFactory::NewMediaItemLC
       
    32 // Checks the media type and returns an instance of the appropriate media item
       
    33 // ---------------------------------------------------------------------------
       
    34 //    
       
    35 CMgMediaItem* MgMediaItemFactory::GetMediaItemL( const MCLFItem& aClfItem )
       
    36     {
       
    37     TInt32 data( 0 );
       
    38     CMgMediaItem* mediaItem = NULL;
       
    39     if( aClfItem.GetField( ECLFFieldIdMediaType, data ) == KErrNone )
       
    40         {
       
    41         switch ( data )
       
    42             {
       
    43             case ECLFMediaTypeStreamingURL:
       
    44                 {
       
    45                 mediaItem = CMgLinkFile::NewL();
       
    46                 break;
       
    47                 }
       
    48             case ECLFMediaTypeMusic:
       
    49                 {
       
    50                 mediaItem = CMgMusicFile::NewL();
       
    51                 break;
       
    52                 }
       
    53             case ECLFMediaTypeVideo:
       
    54                 {
       
    55                 mediaItem = CMgVideoFile::NewL();
       
    56                 break;
       
    57                 }
       
    58             default:
       
    59                 {
       
    60                 mediaItem = CMgMediaFile::NewL();
       
    61                 break;
       
    62                 }
       
    63             }
       
    64         }
       
    65     return mediaItem;
       
    66     }
       
    67 
       
    68 
       
    69 
       
    70 
       
    71 
       
    72 
       
    73