|
1 /* |
|
2 * Copyright (c) 2002 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: CMMAAudioMetaDataControl is a concrete class for getting |
|
15 * metadata from an audio media. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <jdebug.h> |
|
22 |
|
23 #include "cmmaaudiometadatacontrol.h" |
|
24 |
|
25 CMMAAudioMetaDataControl::CMMAAudioMetaDataControl( |
|
26 RMMFController& aController) |
|
27 : iController(aController) |
|
28 { |
|
29 DEBUG("CMMAAudioMetaDataControl constructor called."); |
|
30 } |
|
31 |
|
32 TInt CMMAAudioMetaDataControl::KeyCountL() |
|
33 { |
|
34 TInt entries = 0; |
|
35 |
|
36 User::LeaveIfError(iController.GetNumberOfMetaDataEntries(entries)); |
|
37 return entries; |
|
38 } |
|
39 |
|
40 HBufC* CMMAAudioMetaDataControl::KeyL(TInt aIndex) |
|
41 { |
|
42 CMMFMetaDataEntry* currEntry = NULL; |
|
43 |
|
44 currEntry = iController.GetMetaDataEntryL(aIndex); |
|
45 CleanupStack::PushL(currEntry); |
|
46 HBufC* key = currEntry->Name().AllocL(); |
|
47 CleanupStack::PopAndDestroy(); // currEntry |
|
48 |
|
49 return key; |
|
50 } |
|
51 |
|
52 |
|
53 /* |
|
54 * Get the value of given audio metadata key. The ownership of the created value |
|
55 * (descriptor) is passed to the caller. |
|
56 */ |
|
57 HBufC* CMMAAudioMetaDataControl::KeyValueL(const TDesC& aKey) |
|
58 { |
|
59 DEBUG("MMA::CMMAAudioMetaDataControl::GetKeyValueL() called."); |
|
60 |
|
61 HBufC* retVal = NULL; |
|
62 CMMFMetaDataEntry* currEntry = NULL; |
|
63 |
|
64 TInt nEntries = 0; |
|
65 User::LeaveIfError(iController.GetNumberOfMetaDataEntries(nEntries)); |
|
66 |
|
67 for (TInt i = 0; i < nEntries; ++i) |
|
68 { |
|
69 currEntry = iController.GetMetaDataEntryL(i); |
|
70 |
|
71 if (0 == aKey.Compare(currEntry->Name())) |
|
72 { |
|
73 CleanupStack::PushL(currEntry); |
|
74 retVal = currEntry->Value().AllocL(); |
|
75 CleanupStack::PopAndDestroy(); // currEntry |
|
76 break; |
|
77 } |
|
78 |
|
79 delete currEntry; |
|
80 } |
|
81 |
|
82 User::LeaveIfNull(retVal); |
|
83 return retVal; |
|
84 } |
|
85 |
|
86 // END OF FILE |