49 void MMF::Utils::panic(PanicCode code) |
50 void MMF::Utils::panic(PanicCode code) |
50 { |
51 { |
51 User::Panic(PanicCategory, code); |
52 User::Panic(PanicCategory, code); |
52 } |
53 } |
53 |
54 |
54 |
|
55 static const TInt KMimePrefixLength = 6; // either "audio/" or "video/" |
|
56 _LIT(KMimePrefixAudio, "audio/"); |
55 _LIT(KMimePrefixAudio, "audio/"); |
57 _LIT(KMimePrefixVideo, "video/"); |
56 _LIT(KMimePrefixVideo, "video/"); |
|
57 _LIT(KMimeSDP, "application/sdp"); |
|
58 |
|
59 enum ConstantStringLengths { |
|
60 KMimePrefixLength = 6, // either "audio/" or "video/", |
|
61 KMimeSDPLength = 15 // "application/sdp" |
|
62 }; |
58 |
63 |
59 MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType) |
64 MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType) |
60 { |
65 { |
61 MediaType result = MediaTypeUnknown; |
|
62 |
|
63 if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixAudio) == 0) { |
66 if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixAudio) == 0) { |
64 result = MediaTypeAudio; |
67 return MediaTypeAudio; |
65 } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0) { |
68 } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0 || |
66 result = MediaTypeVideo; |
69 mimeType.Left(KMimeSDPLength).Compare(KMimeSDP) == 0) { |
67 } |
70 return MediaTypeVideo; |
68 |
71 } else |
69 return result; |
72 return MediaTypeUnknown; |
70 } |
73 } |
71 |
74 |
|
75 QString MMF::Utils::symbianErrorToString(int errorCode) |
|
76 { |
|
77 /** |
|
78 * Here we translate only the error codes which are likely to be |
|
79 * meaningful to the user. For example, when an error occurs |
|
80 * during opening of a media file, displaying "not found" or |
|
81 * "permission denied" is informative. On the other hand, |
|
82 * differentiating between KErrGeneral and KErrArgument at the UI |
|
83 * level does not make sense. |
|
84 */ |
|
85 switch (errorCode) |
|
86 { |
|
87 // System-wide errors |
|
88 case KErrNone: |
|
89 return tr("No error"); |
|
90 case KErrNotFound: |
|
91 return tr("Not found"); |
|
92 case KErrNoMemory: |
|
93 return tr("Out of memory"); |
|
94 case KErrNotSupported: |
|
95 return tr("Not supported"); |
|
96 case KErrOverflow: |
|
97 return tr("Overflow"); |
|
98 case KErrUnderflow: |
|
99 return tr("Underflow"); |
|
100 case KErrAlreadyExists: |
|
101 return tr("Already exists"); |
|
102 case KErrPathNotFound: |
|
103 return tr("Path not found"); |
|
104 case KErrInUse: |
|
105 return tr("In use"); |
|
106 case KErrNotReady: |
|
107 return tr("Not ready"); |
|
108 case KErrAccessDenied: |
|
109 return tr("Access denied"); |
|
110 case KErrCouldNotConnect: |
|
111 return tr("Could not connect"); |
|
112 case KErrDisconnected: |
|
113 return tr("Disconnected"); |
|
114 case KErrPermissionDenied: |
|
115 return tr("Permission denied"); |
|
116 |
|
117 // Multimedia framework errors |
|
118 case KErrMMNotEnoughBandwidth: |
|
119 return tr("Insufficient bandwidth"); |
|
120 case KErrMMSocketServiceNotFound: |
|
121 case KErrMMServerSocket: |
|
122 return tr("Network unavailable"); |
|
123 case KErrMMNetworkRead: |
|
124 case KErrMMNetworkWrite: |
|
125 case KErrMMUDPReceive: |
|
126 return tr("Network communication error"); |
|
127 case KErrMMServerNotSupported: |
|
128 return tr("Streaming not supported"); |
|
129 case KErrMMServerAlert: |
|
130 return tr("Server alert"); |
|
131 case KErrMMInvalidProtocol: |
|
132 return tr("Invalid protocol"); |
|
133 case KErrMMInvalidURL: |
|
134 return tr("Invalid URL"); |
|
135 case KErrMMMulticast: |
|
136 return tr("Multicast error"); |
|
137 case KErrMMProxyServer: |
|
138 case KErrMMProxyServerConnect: |
|
139 return tr("Proxy server error"); |
|
140 case KErrMMProxyServerNotSupported: |
|
141 return tr("Proxy server not supported"); |
|
142 case KErrMMAudioDevice: |
|
143 return tr("Audio output error"); |
|
144 case KErrMMVideoDevice: |
|
145 return tr("Video output error"); |
|
146 case KErrMMDecoder: |
|
147 return tr("Decoder error"); |
|
148 case KErrMMPartialPlayback: |
|
149 return tr("Audio or video components could not be played"); |
|
150 case KErrMMDRMNotAuthorized: |
|
151 return tr("DRM error"); |
|
152 |
|
153 /* |
|
154 // We don't use QoS settings |
|
155 case KErrMMQosLowBandwidth: |
|
156 case KErrMMQosUnsupportedTrafficClass: |
|
157 case KErrMMQosPoorTrafficClass: |
|
158 case KErrMMQosUnsupportedParameters: |
|
159 case KErrMMQosPoorParameters: |
|
160 case KErrMMQosNotSupported: |
|
161 */ |
|
162 |
|
163 // Catch-all for errors other than those above |
|
164 default: |
|
165 { |
|
166 return tr("Unknown error (%1)").arg(errorCode); |
|
167 } |
|
168 } |
|
169 } |
72 |
170 |
73 #ifndef QT_NO_DEBUG |
171 #ifndef QT_NO_DEBUG |
74 |
172 |
75 #include <hal.h> |
173 #include <hal.h> |
76 #include <hal_data.h> |
174 #include <hal_data.h> |