author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 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 |
||
20 |
#include <e32base.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
21 |
#include <MCLFItem.h> |
19 | 22 |
|
23 |
#include "mgmediaitemfactory.h" |
|
24 |
#include "mglinkfile.h" |
|
25 |
#include "mgmusicfile.h" |
|
26 |
#include "mgvideofile.h" |
|
27 |
#include "mgmediaitem.h" |
|
28 |
#include "mgmediafile.h" |
|
29 |
||
30 |
// --------------------------------------------------------------------------- |
|
31 |
// CMgMediaItemFactory::NewL |
|
32 |
// Two-phased constructor |
|
33 |
// --------------------------------------------------------------------------- |
|
34 |
// |
|
35 |
||
36 |
CMgMediaItemFactory* CMgMediaItemFactory::NewL() |
|
37 |
{ |
|
38 |
CMgMediaItemFactory* self = new( ELeave ) CMgMediaItemFactory; |
|
39 |
return self; |
|
40 |
} |
|
41 |
||
42 |
// --------------------------------------------------------------------------- |
|
43 |
// CMgMediaItemFactory::GetMediaItem |
|
44 |
// Returns a pointer to an appropriate media type |
|
45 |
// --------------------------------------------------------------------------- |
|
46 |
// |
|
47 |
||
48 |
CMgMediaItem* CMgMediaItemFactory::GetMediaItemL( const MCLFItem& aClfItem ) |
|
49 |
{ |
|
50 |
CMgMediaItem* mediaItem = NewMediaItemL( aClfItem ); |
|
51 |
return mediaItem; |
|
52 |
} |
|
53 |
// --------------------------------------------------------------------------- |
|
54 |
// CMgMediaItemFactory::NewMediaItemLC |
|
55 |
// Checks the media type and returns an instance of the appropriate media item |
|
56 |
// --------------------------------------------------------------------------- |
|
57 |
// |
|
58 |
CMgMediaItem* CMgMediaItemFactory::NewMediaItemL( const MCLFItem& aClfItem ) |
|
59 |
{ |
|
60 |
TInt32 data( 0 ); |
|
61 |
if( aClfItem.GetField( ECLFFieldIdMediaType, data ) == KErrNone ) |
|
62 |
{ |
|
63 |
switch ( data ) |
|
64 |
{ |
|
65 |
case ECLFMediaTypeStreamingURL: |
|
66 |
{ |
|
67 |
return CMgLinkFile::NewL(); |
|
68 |
} |
|
69 |
case ECLFMediaTypeMusic: |
|
70 |
{ |
|
71 |
return CMgMusicFile::NewL(); |
|
72 |
} |
|
73 |
case ECLFMediaTypeVideo: |
|
74 |
{ |
|
75 |
return CMgVideoFile::NewL(); |
|
76 |
} |
|
77 |
default: |
|
78 |
{ |
|
79 |
return CMgMediaFile::NewL(); |
|
80 |
} |
|
81 |
} |
|
82 |
} |
|
83 |
return NULL; |
|
84 |
} |
|
85 |
||
86 |
||
87 |
||
88 |
||
89 |
||
90 |
||
91 |