|
1 /* |
|
2 * Copyright (c) 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 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: Implementation of CBavpMediaRecognizer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef BAVPMEDIARECONGNIZER_H |
|
20 #define BAVPMEDIARECONGNIZER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <apgcli.h> |
|
24 // L960: header file name with non-standard character |
|
25 #include <mmf/common/mmfcontrollerpluginresolver.h> |
|
26 |
|
27 // Media types |
|
28 enum TBavpMediaType |
|
29 { |
|
30 ELocalVideoFile, |
|
31 ELocalAudioFile, |
|
32 ELocalRamFile, |
|
33 ELocalSdpFile, |
|
34 EUrl, |
|
35 ELocalAudioPlaylist, |
|
36 #if defined(BRDO_ASX_FF) |
|
37 ELocalAsxFile, |
|
38 #endif //BRDO_ASX_FF |
|
39 EUnidentified |
|
40 }; |
|
41 |
|
42 /** |
|
43 * CBavpMediaRecognizer |
|
44 * Implementation of CBavpMediaRecognizer |
|
45 * @lib npBrowserVideoPlugin.lib |
|
46 * @since 3.2 |
|
47 */ |
|
48 NONSHARABLE_CLASS(CBavpMediaRecognizer) : public CBase |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 */ |
|
55 static CBavpMediaRecognizer* NewL(); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 ~CBavpMediaRecognizer(); |
|
61 |
|
62 public: // New functions |
|
63 |
|
64 /** |
|
65 * Recognizes media type. |
|
66 * @since 3.2 |
|
67 * @param aMediaName Media file name or Url |
|
68 * @param aIncludeUrls Are Urls included or not |
|
69 * @return TBavpMediaType |
|
70 */ |
|
71 TBavpMediaType IdentifyMediaTypeL( const TDesC& aMediaName, |
|
72 TBool aIncludeUrls = EFalse ); |
|
73 |
|
74 /** |
|
75 * Recognizes media type. |
|
76 * @since 3.2 |
|
77 * @param aMediaName Media file name or Url |
|
78 * @param aFile file handle |
|
79 * @param aIncludeUrls Are Urls included or not |
|
80 * @return TBavpMediaType |
|
81 */ |
|
82 TBavpMediaType IdentifyMediaTypeL( const TDesC& aMediaName, |
|
83 RFile& aFile, |
|
84 TBool aIncludeUrls = EFalse ); |
|
85 |
|
86 /** |
|
87 * Recognizes Media files MimeType. |
|
88 * @since 3.2 |
|
89 * @param aLocalFile File name |
|
90 * @return TBuf<KMaxDataTypeLength>, Mime type. |
|
91 */ |
|
92 TBuf<KMaxDataTypeLength> MimeTypeL( const TDesC& aLocalFile ); |
|
93 |
|
94 /** |
|
95 * Checks if Url is valid or not. |
|
96 * @since 3.2 |
|
97 * @param aUrl |
|
98 * @return ETrue: Valid |
|
99 * EFalse: Not valid |
|
100 */ |
|
101 TBool ValidUrl( const TDesC& aUrl ); |
|
102 |
|
103 /** |
|
104 * Recognizes Media files MimeType. |
|
105 * @since 3.2 |
|
106 * @param aFile File handle |
|
107 * @return TBuf<KMaxDataTypeLength>, Mime type. |
|
108 */ |
|
109 TBuf<KMaxDataTypeLength> MimeTypeL( RFile& aFile ); |
|
110 |
|
111 private: // New functions |
|
112 |
|
113 /** |
|
114 * Checks if there is video playback support. |
|
115 * @param aFileName |
|
116 * @param aFileRecognitionResult Recognition result |
|
117 * @return ETrue: Supported |
|
118 * EFalse: Not supported |
|
119 */ |
|
120 TBool FileHasVideoSupport( const TDesC& aFileName, |
|
121 TDataRecognitionResult& aFileRecognitionResult ); |
|
122 |
|
123 /** |
|
124 * Checks if there is audio playback support. |
|
125 * @param aFileName |
|
126 * @param aFileRecognitionResult Recognition result |
|
127 * @return ETrue: Supported |
|
128 * EFalse: Not supported |
|
129 */ |
|
130 TBool FileHasAudioSupport( const TDesC& aFileName, |
|
131 TDataRecognitionResult& aFileRecognitionResult ); |
|
132 |
|
133 /** |
|
134 * Creates array to hold all the controller plugins that support video. |
|
135 * @return void |
|
136 */ |
|
137 void CreateVideoFormatsArrayL(); |
|
138 |
|
139 /** |
|
140 * Creates array to hold all the controller plugins that support audio. |
|
141 * @return void |
|
142 */ |
|
143 void CreateAudioFormatsArrayL(); |
|
144 |
|
145 /** |
|
146 * Recognizes local file |
|
147 * @param aFileName |
|
148 * @param aFileRecognitionResult Recognition result |
|
149 * @return void |
|
150 */ |
|
151 void RecognizeFileL( const TDesC& aFileName, |
|
152 TDataRecognitionResult& aResult ); |
|
153 |
|
154 /** |
|
155 * Reads local file to buffer |
|
156 * @param aFileName |
|
157 * @param aBuf, buffer |
|
158 * @return KErrNone or one of the system wide error codes. |
|
159 */ |
|
160 TInt ReadFile( const TDesC& aFileName, TDes8& aBuf ); |
|
161 |
|
162 /** |
|
163 * Determines presence of file handle. |
|
164 * @return ETrue if file handle exists. |
|
165 */ |
|
166 TBool FileHandleExists(); |
|
167 |
|
168 private: |
|
169 |
|
170 /** |
|
171 * C++ default constructor. |
|
172 */ |
|
173 CBavpMediaRecognizer(); |
|
174 |
|
175 /** |
|
176 * By default Symbian 2nd phase constructor is private. |
|
177 */ |
|
178 void ConstructL(); |
|
179 |
|
180 private: // Data |
|
181 // Array to hold all the controller plugins that support video |
|
182 RMMFControllerImplInfoArray iVideoControllers; |
|
183 // Array to hold all the controller plugins that support audio |
|
184 RMMFControllerImplInfoArray iAudioControllers; |
|
185 // bufsize |
|
186 TInt iBufSize; |
|
187 // Mime type recognizer |
|
188 RApaLsSession iRecognizer; |
|
189 RFile iFileHandle; |
|
190 }; |
|
191 |
|
192 #endif // BAVPMEDIARECONGNIZER_H |
|
193 |
|
194 // End of File |