|
1 /* |
|
2 * Copyright (c) 2006-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 "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: Header file of CUpnpResResolver class. CUpnpResResolver is |
|
15 * a class used for resolving res field attributes for a given |
|
16 * file. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef C_UPNPRESRESOLVER_H |
|
26 #define C_UPNPRESRESOLVER_H |
|
27 |
|
28 // system includes |
|
29 #include <e32base.h> |
|
30 #include <mdaaudiosampleplayer.h> // CMdaAudioPlayerUtility |
|
31 |
|
32 // user includes |
|
33 // NONE |
|
34 |
|
35 // forward declarations |
|
36 class RFile; |
|
37 class CUpnpResParameters; |
|
38 |
|
39 // data types |
|
40 // NONE |
|
41 |
|
42 // constants |
|
43 // NONE |
|
44 |
|
45 /** |
|
46 * CUpnpResResolver is a class for resolving res field attributes for a |
|
47 * given file. |
|
48 * |
|
49 * CUpnpResResolver class can be used to resolve a res field attributes for |
|
50 * a media file (image, AV, video). Attributes resolved for media files are: |
|
51 * - Protocolinfo for all files. |
|
52 * - Resolution and size for images. |
|
53 * - Duration and size for videos. |
|
54 * - Duration and size for music. |
|
55 * |
|
56 * @lib dlnaprofiler.lib |
|
57 * @since S60 v3.1 |
|
58 */ |
|
59 class CUpnpResResolver: public CBase, |
|
60 public MMdaAudioPlayerCallback |
|
61 { |
|
62 public: |
|
63 |
|
64 IMPORT_C static CUpnpResResolver* NewL(); |
|
65 |
|
66 IMPORT_C static CUpnpResResolver* NewLC(); |
|
67 |
|
68 virtual ~CUpnpResResolver(); |
|
69 |
|
70 /** |
|
71 * GetResParametersL resolves parameters that will be needed in |
|
72 * res-element attributes. |
|
73 * |
|
74 * @since S60 v3.1 |
|
75 * @param const TDesC& File for which to obtain res parameters. |
|
76 * @return CUpnpResParameters* Parameters needed for res-element. |
|
77 */ |
|
78 IMPORT_C CUpnpResParameters* GetResParametersL( const TDesC& aFilename ); |
|
79 |
|
80 private: |
|
81 |
|
82 CUpnpResResolver(); |
|
83 |
|
84 void ConstructL(); |
|
85 |
|
86 /** |
|
87 * GetMimetypeL returns the mime type of the file. |
|
88 * |
|
89 * @since S60 v3.1 |
|
90 * @param RFile& File for which to obtain mime. |
|
91 * @return HBufC8* Mime type of the file. |
|
92 */ |
|
93 HBufC8* GetMimetypeL( RFile& aFile ); |
|
94 |
|
95 /** |
|
96 * GetAudioDurationL obtains the duration of a audio file. |
|
97 * After call the duration is in iDuration member variable. |
|
98 * |
|
99 * @since S60 v3.1 |
|
100 * @param const TDesC& The audio file for which to obtain duration. |
|
101 */ |
|
102 void GetAudioDurationL( const TDesC& aFilename ); |
|
103 |
|
104 /** |
|
105 * GetVideoDurationL obtains the duration of a video file. |
|
106 * After call the duration is in iDuration member variable. |
|
107 * |
|
108 * @since S60 v3.1 |
|
109 * @param RFile& The video file for which to obtain duration. |
|
110 */ |
|
111 void GetVideoDurationL( RFile& aFile ); |
|
112 |
|
113 /** |
|
114 * GetFileSizeL returns the size of file in bytes. |
|
115 * |
|
116 * @since S60 v3.1 |
|
117 * @param RFile& The file for which to obtain size |
|
118 * @return TInt File size. |
|
119 */ |
|
120 TInt GetFileSizeL( RFile& aFile ); |
|
121 |
|
122 /** |
|
123 * GetImageResolutionL returns the resolution of the image. |
|
124 * |
|
125 * @since S60 v3.1 |
|
126 * @param RFile& File for which to obtain resolution. |
|
127 * @param const TDesC8& Mime type of the file. |
|
128 * @return TSize The resolution of the image. |
|
129 */ |
|
130 TSize GetImageResolutionL( RFile& aFile, const TDesC8& aMimetype ); |
|
131 |
|
132 // from base class MMdaAudioPlayerCallback |
|
133 |
|
134 /** |
|
135 * From MMdaAudioPlayerCallback. |
|
136 * MapcPlayComplete |
|
137 * |
|
138 * @since S60 v3.1 |
|
139 * @param aError error code |
|
140 */ |
|
141 void MapcPlayComplete( TInt aError ); |
|
142 |
|
143 /** |
|
144 * From MMdaAudioPlayerCallback. |
|
145 * MapcInitComplete |
|
146 * |
|
147 * @since S60 v3.1 |
|
148 * @param aError error code |
|
149 * @param aDuration duration of the file |
|
150 */ |
|
151 void MapcInitComplete( TInt aError, |
|
152 const TTimeIntervalMicroSeconds& aDuration ); |
|
153 |
|
154 private: // data |
|
155 // attributes related to CMdaAudioPlayerUtility usage |
|
156 CActiveSchedulerWait* iWait; // owned |
|
157 CMdaAudioPlayerUtility* iAudioplayer; // owned. |
|
158 |
|
159 // duration of the media file (video or audio) |
|
160 TTimeIntervalMicroSeconds iDuration; |
|
161 }; |
|
162 |
|
163 |
|
164 #endif // C_UPNPRESRESOLVER_H |