|
1 /** @file |
|
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: Element table data handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef UPNPMIMEMAPPER_H |
|
21 #define UPNPMIMEMAPPER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "upnptablebean.h" |
|
25 #include "upnpmap.h" |
|
26 #include <e32base.h> |
|
27 #include <d32dbms.h> |
|
28 |
|
29 |
|
30 // Mapping file extensions |
|
31 _LIT8( KExtensionJpg, "jpg" ); |
|
32 _LIT8( KExtensionPng, "png" ); |
|
33 _LIT8( KExtensionTxt, "txt" ); |
|
34 _LIT8( KExtensionMp3, "mp3" ); |
|
35 _LIT8( KExtensionGif, "gif" ); |
|
36 _LIT8( KExtensionBmp, "bmp" ); |
|
37 _LIT( KExtensionWav, ".wav" ); |
|
38 _LIT( KExtensionAac, ".aac" ); |
|
39 |
|
40 |
|
41 |
|
42 // mime types <-> files ext |
|
43 _LIT8( KXHtmlMime, "application/xhtml+xml" ); _LIT( KXHtmlExt,".xhtml" ); |
|
44 _LIT8( KHtmlMime, "text/html" ); _LIT( KHtmlExt, ".html" ); |
|
45 _LIT8( KXmlMime1, "text/xml" ); |
|
46 _LIT8( KXmlMime2, "application/xml" ); |
|
47 _LIT8( KXmlMime3, "application/x-xml"); _LIT( KXmlExt, ".xml" ); |
|
48 _LIT8( KTxtMime, "text/plain" ); |
|
49 _LIT8( KTxtMime2, "application/txt" ); |
|
50 _LIT8( KTxtMime3, "browser/internal" ); |
|
51 _LIT8( KTxtMime4, "text/anytext" ); |
|
52 _LIT8( KTxtMime5, "widetext/plain" ); |
|
53 _LIT8( KTxtMime6, "widetext/paragraph" ); _LIT( KTxtExt, ".txt" ); |
|
54 _LIT8( KJpegMime, "image/jpeg" ); _LIT( KJpegExt, ".jpeg" ); |
|
55 _LIT8( KJpegMime2, "image/jpg" ); |
|
56 _LIT8( KJpegMime3, "image/jpe_" ); |
|
57 _LIT8( KJpegMime4, "image/pjpeg" ); |
|
58 _LIT8( KJpegMime5, "image/vnd.swiftview-jpeg" ); |
|
59 |
|
60 _LIT8( KJpgMime, "image/jpeg" ); _LIT( KJpgExt, ".jpg" ); |
|
61 _LIT8( KJpgMime2, "image/jpg" ); |
|
62 _LIT8( KJpgMime3, "image/jpe_" ); |
|
63 _LIT8( KJpgMime4, "image/pjpeg" ); |
|
64 _LIT8( KJpgMime5, "image/vnd.swiftview-jpeg" ); |
|
65 |
|
66 _LIT8( KGifMime, "image/gif" ); _LIT( KGifExt, ".gif" ); |
|
67 _LIT8( KGifMime2, "image/x-xbitmap" ); |
|
68 _LIT8( KGifMime3, "image/gi_" ); |
|
69 |
|
70 _LIT8( KPngMime, "image/png" ); _LIT( KPngExt, ".png" ); |
|
71 _LIT8( KPngMime2, "application/png" ); |
|
72 _LIT8( KPngMime3, "application/x-png" ); |
|
73 |
|
74 _LIT8( KMpgMime1, "video/mpeg"); _LIT( KMpgExt1, ".mpg" ); |
|
75 _LIT8( KMpgMime2, "video/mpg"); |
|
76 _LIT8( KMpgMime3, "video/x-mpg"); |
|
77 _LIT8( KMpgMime4, "video/mpeg2" ); |
|
78 _LIT8( KMpgMime5, "application/x-pn-mpg" ); |
|
79 _LIT8( KMpgMime6, "video/x-mpeg" ); |
|
80 _LIT8( KMpgMime7, "video/x-mpeg2a"); |
|
81 _LIT8( KMpgMime8, "audio/mpeg" ); |
|
82 _LIT8( KMpgMime9, "audio/x-mpeg" ); |
|
83 _LIT8( KMpgMime10, "image/mpg" ); |
|
84 |
|
85 _LIT8( KMpeg4Mime, "video/mpeg4" ); _LIT( KMpeg4Ext,".mpeg4" ); |
|
86 |
|
87 _LIT8( KMp4Mime, "video/mp4" ); _LIT( KMp4Ext, ".mp4" ); |
|
88 _LIT8( KMp4Mime2, "video/mp4v-es" ); |
|
89 _LIT8( KMp4Mime3, "audio/mp4" ); |
|
90 |
|
91 _LIT8( KAviMime1, "video/avi" ); |
|
92 _LIT8( KAviMime2, "video/msvideo" ); |
|
93 _LIT8( KAviMime3, "video/x-msvideo" ); _LIT( KAviExt, ".avi" ); |
|
94 _LIT8( KAviMime4, "image/avi" ); |
|
95 _LIT8( KAviMime5, "video/xmpg2" ); |
|
96 _LIT8( KAviMime6, "application/x-troff-msvideo" ); |
|
97 _LIT8( KAviMime7, "audio/aiff" ); |
|
98 _LIT8( KAviMime8, "audio/avi" ); |
|
99 |
|
100 _LIT8( KMp3Mime1, "audio/x-mpeg-3"); |
|
101 _LIT8( KMp3Mime2, "audio/mpeg3" ); _LIT( KMp3Ext, ".mp3" ); |
|
102 _LIT8( KMp3Mime3, "audio/mpeg" ); // 1) _LIT( KMpgExt2, ".mp3" ); |
|
103 _LIT8( KMp3Mime4, "audio/x-mpeg" ); |
|
104 _LIT8( KMp3Mime5, "audio/mp3" ); |
|
105 _LIT8( KMp3Mime6, "audio/x-mp3" ); |
|
106 _LIT8( KMp3Mime7, "audio/x-mpeg3" ); |
|
107 _LIT8( KMp3Mime8, "audio/mpg" ); |
|
108 _LIT8( KMp3Mime9, "audio/x-mpg" ); |
|
109 _LIT8( KMp3Mime10, "audio/x-mpegaudio" ); |
|
110 |
|
111 _LIT8( KAacMime, "audio/aac" ); _LIT( KAacExt, ".aac" ); |
|
112 _LIT8( KWmaMime, "audio/x-ms-wma" ); _LIT( KWmaExt, ".wma" ); |
|
113 _LIT8( KWmaMime2, "video/x-ms-asf" ); |
|
114 |
|
115 _LIT8( KBmpMime, "image/bmp" ); _LIT( KBmpExt, ".bmp" ); |
|
116 _LIT8( KBmpMime2, "image/x-bmp" ); |
|
117 _LIT8( KBmpMime3, "image/x-bitmap" ); |
|
118 _LIT8( KBmpMime4, "image/x-xbitmap" ); |
|
119 _LIT8( KBmpMime5, "image/x-ms-bmp" ); |
|
120 _LIT8( KBmpMime6, "application/bmp" ); |
|
121 _LIT8( KBmpMime7, "application/x-bmp" ); |
|
122 _LIT8( KBmpMime8, "application/x-win-bitmap" ); |
|
123 _LIT8( KBmpMime9, "application/preview" ); |
|
124 |
|
125 _LIT8( KAudioL16, "audio/L16" ); |
|
126 _LIT8( KAudioVnd, "audio/vnd.dlna.adts" ); |
|
127 |
|
128 _LIT8( KAudio3gpp, "audio/3gpp" ); |
|
129 _LIT8( KVideo3gpp, "video/3gpp" ); |
|
130 _LIT( K3gpExt, ".3gp" ); |
|
131 _LIT8( KAudioAMR, "audio/AMR" ); _LIT( KAmrExt, ".amr" ); |
|
132 |
|
133 _LIT8(KAudioWav, "audio/wav"); |
|
134 _LIT8(KVideoWmv, "video/x-ms-wmv"); _LIT( KWmvExt, ".wmv" ); |
|
135 _LIT8(KVideoAvi, "video/x-ms-avi"); |
|
136 |
|
137 _LIT8(KRealMedia, "application/vnd.rn-realmedia"); _LIT( KRmExt, ".rm" ); |
|
138 _LIT8(KRealAudio, "audio/vnd.rn-realaudio"); _LIT( KRealAudioExt, ".ra" ); |
|
139 _LIT8(KPmRealAudioPlugin, "audio/x-pn-realaudio-plugin"); _LIT( KPmRealAudioPluginExt, ".rpm" ); |
|
140 _LIT8(KPmRealAudio, "audio/x-pn-realaudio"); _LIT( KPmRealAudioExt, ".ra" ); |
|
141 _LIT8(KRealVideo, "video/vnd.rn-realvideo"); _LIT( KRealVideoExt, ".rv" ); |
|
142 |
|
143 // CLASS DECLARATION |
|
144 |
|
145 /** |
|
146 * Provides mime type to file extention mapping. |
|
147 * |
|
148 * @lib AVContentDirectory.lib |
|
149 * @since Series60 3.1 |
|
150 */ |
|
151 class CUpnpMimeMapper: public CBase |
|
152 { |
|
153 public: // Constructors and destructor |
|
154 |
|
155 /** |
|
156 * Two-phased constructor. |
|
157 */ |
|
158 static CUpnpMimeMapper* NewL(); |
|
159 |
|
160 /** |
|
161 * Destructor. |
|
162 */ |
|
163 virtual ~CUpnpMimeMapper(); |
|
164 |
|
165 public: // New functions |
|
166 |
|
167 |
|
168 void AddMimeMapElL( const TDesC8& aKey, const TDesC& aVal ); |
|
169 void InitMimeToExtensionMapL(); |
|
170 |
|
171 /** |
|
172 * This function gives extension to a file. |
|
173 * @since Series 60 3.1 |
|
174 * @param aMimeType - mime type from which additional information will be retrieved. |
|
175 * @return pointer to HBufC8 object with extension value for this file. |
|
176 */ |
|
177 HBufC8* GetExtensionL( const TDesC8& aMimeType ); |
|
178 |
|
179 const HBufC* Get( const TDesC8& aKey ); |
|
180 |
|
181 private: |
|
182 |
|
183 /** |
|
184 * C++ default constructor. |
|
185 */ |
|
186 CUpnpMimeMapper(); |
|
187 |
|
188 /** |
|
189 * By default Symbian 2nd phase constructor is private. |
|
190 */ |
|
191 void ConstructL(); |
|
192 |
|
193 private: // Data |
|
194 |
|
195 CUpnpMap<HBufC>* iMimeToExtMap; |
|
196 |
|
197 }; |
|
198 |
|
199 #endif // UPNPMIMEMAPPER_H |
|
200 |
|
201 // End of File |