1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: MMF Backend Engine Header |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #ifndef XA_CMMFBackendEngine_H |
18 #ifndef CMMFBackendEngine_H |
19 #define XA_CMMFBackendEngine_H |
19 #define CMMFBackendEngine_H |
20 |
20 |
21 #define ENABLE_GRAPHICS_SURFACE_INTEGRATION |
21 #define ENABLE_GRAPHICS_SURFACE_INTEGRATION |
22 |
22 |
23 #include "openmaxalwrapper.h" |
23 #include "openmaxalwrapper.h" |
24 |
24 |
43 #include <AudioInput.h> |
43 #include <AudioInput.h> |
44 #include "sfmrlocaltimer.h" |
44 #include "sfmrlocaltimer.h" |
45 #endif |
45 #endif |
46 |
46 |
47 // MetaDataWrite Custom Command UID |
47 // MetaDataWrite Custom Command UID |
48 const TUid KUidMetaDataWriteCustomCommand = {0x10207af9}; |
48 const TUid KUidMetaDataWriteCustomCommand = |
|
49 { |
|
50 0x10207af9 |
|
51 }; |
49 |
52 |
50 #define MAX_EXTENSION_SIZE 10 |
53 #define MAX_EXTENSION_SIZE 10 |
51 |
54 |
52 class CMarkerPositionTimer; |
55 class CMarkerPositionTimer; |
53 class CPositionUpdateTimer; |
56 class CPositionUpdateTimer; |
54 NONSHARABLE_CLASS(CMMFBackendEngine) : public CBase, |
57 NONSHARABLE_CLASS(CMMFBackendEngine) : public CBase, |
55 public MVideoPlayerUtilityObserver, |
58 public MVideoPlayerUtilityObserver, |
56 public MVideoLoadingObserver, |
59 public MVideoLoadingObserver, |
57 public MMdaAudioPlayerCallback, |
60 public MMdaAudioPlayerCallback, |
58 public MMdaObjectStateChangeObserver |
61 public MMdaObjectStateChangeObserver |
59 { |
62 { |
60 public: |
63 public: |
61 enum TFuncInUse |
64 enum TFuncInUse |
62 { |
65 { |
63 EPlay = 0, |
66 EPlay = 0, |
64 ERecord |
67 ERecord |
65 }; |
68 }; |
66 |
69 |
67 enum TUriType |
70 enum TUriType |
68 { |
71 { |
69 ELocal = 0, |
72 ELocal = 0, |
70 EStreaming |
73 EStreaming |
71 }; |
74 }; |
72 |
75 |
73 enum TMMFUtiltyInUse |
76 enum TMMFUtiltyInUse |
74 { |
77 { |
75 ENoUtility, |
78 ENoUtility, |
76 EVideoPlayerUtility, |
79 EVideoPlayerUtility, |
77 EAudioPlayerUtility, |
80 EAudioPlayerUtility, |
78 EAudioRecorderUtility |
81 EAudioRecorderUtility |
79 }; |
82 }; |
80 |
83 |
81 enum TRecorderState |
84 enum TRecorderState |
82 { |
85 { |
83 ERecorderNotReady = 0, |
86 ERecorderNotReady = 0, |
84 ERecorderOpen, |
87 ERecorderOpen, |
85 ERecorderRecording |
88 ERecorderRecording |
86 }; |
89 }; |
87 |
90 |
88 public: |
91 public: |
89 |
92 |
90 static CMMFBackendEngine* NewL(); |
93 static CMMFBackendEngine* NewL(); |
91 ~CMMFBackendEngine(); |
94 ~CMMFBackendEngine(); |
92 |
95 |
93 TInt SetFileName(char* uri,XAuint32 format,TFuncInUse func); |
96 TInt SetFileName(char* uri, XAuint32 format, TFuncInUse func); |
94 void Close(); |
97 void Close(); |
95 void Destroy(); |
98 void Destroy(); |
96 TInt SetRecorderState(TRecorderState state, XAboolean stopCalled); |
99 TInt SetRecorderState(TRecorderState state, XAboolean stopCalled); |
97 TInt GetRecordPosition(XAuint64* position); |
100 TInt GetRecordPosition(XAuint64* position); |
98 TInt SetPositionUpdatePerioed(XAmillisecond period); |
101 TInt SetPositionUpdatePerioed(XAmillisecond period); |
103 TInt GetChannels(XAuint32* channels); |
106 TInt GetChannels(XAuint32* channels); |
104 TInt SetDestinationBitRate(XAuint32* bitrate); |
107 TInt SetDestinationBitRate(XAuint32* bitrate); |
105 TInt SetDestinationSampleRate(XAmilliHertz* samplerate); |
108 TInt SetDestinationSampleRate(XAmilliHertz* samplerate); |
106 TInt SetDestinationChannels(XAuint32* channels); |
109 TInt SetDestinationChannels(XAuint32* channels); |
107 |
110 |
108 /* XAresult SetWindowHandle(void* display_info);*/ |
|
109 XAresult CreateAndConfigureWindowL(); |
111 XAresult CreateAndConfigureWindowL(); |
110 XAresult SetNativeDisplayInformation(void* display_info); |
112 XAresult SetNativeDisplayInformation(void* display_info); |
111 XAresult ResumePlayback(); |
113 XAresult ResumePlayback(); |
112 XAresult PausePlayback(); |
114 XAresult PausePlayback(); |
113 XAresult StopPlayback(); |
115 XAresult StopPlayback(); |
114 XAresult GetPlayState(XAuint32 *pState); |
116 XAresult GetPlayState(XAuint32 *pState); |
115 XAresult GetDuration(XAmillisecond *pMsec); |
117 XAresult GetDuration(XAmillisecond *pMsec); |
116 XAresult GetPosition(XAmillisecond *pMsec); |
118 XAresult GetPosition(XAmillisecond *pMsec); |
117 XAresult SetPlayAdaptContext(void * adaptcontext); |
119 XAresult SetPlayAdaptContext(void * adaptcontext); |
122 XAresult SetPositionUpdatePeriod(XAmillisecond mSec); |
124 XAresult SetPositionUpdatePeriod(XAmillisecond mSec); |
123 |
125 |
124 XAresult SetPosition(XAmillisecond pMsec); |
126 XAresult SetPosition(XAmillisecond pMsec); |
125 XAresult SetRepeats(XAboolean repeat); |
127 XAresult SetRepeats(XAboolean repeat); |
126 XAresult SetPlayWindow(XAmillisecond start, XAmillisecond end); |
128 XAresult SetPlayWindow(XAmillisecond start, XAmillisecond end); |
127 |
129 |
128 XAresult GetNumStreams(XAuint32* numstreams); |
130 XAresult GetNumStreams(XAuint32* numstreams); |
129 XAresult GetStreamInfo(XAuint32 streamindex, XAuint32* streamtype); |
131 XAresult GetStreamInfo(XAuint32 streamindex, XAuint32* streamtype); |
130 XAresult GetVideoFrameSize(XAuint32* height, XAuint32* width, XAuint32* frameRate); |
132 XAresult GetVideoFrameSize(XAuint32* height, XAuint32* width, |
|
133 XAuint32* frameRate); |
131 XAresult SetActiveState(XAuint32 streamindex, XAboolean active); |
134 XAresult SetActiveState(XAuint32 streamindex, XAboolean active); |
132 |
135 |
133 XAresult SetVolume(XAuint32 volume); |
136 XAresult SetVolume(XAuint32 volume); |
134 XAresult GetVolume(XAuint32* volume); |
137 XAresult GetVolume(XAuint32* volume); |
135 XAresult GetMaxVolume(XAuint32* maxvolume); |
138 XAresult GetMaxVolume(XAuint32* maxvolume); |
136 public: |
139 public: |
137 |
140 |
138 // MMdaObjectStateChangeObserver |
141 // MMdaObjectStateChangeObserver |
139 void MoscoStateChangeEvent( |
142 void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, |
140 CBase* aObject, |
143 TInt aCurrentState, TInt aErrorcCode); |
141 TInt aPreviousState, |
|
142 TInt aCurrentState, |
|
143 TInt aErrorcCode); |
|
144 |
144 |
145 //MMdaAudioPlayerCallback |
145 //MMdaAudioPlayerCallback |
146 void MapcInitComplete( |
146 void MapcInitComplete(TInt aError, |
147 TInt aError, |
|
148 const TTimeIntervalMicroSeconds& aDuration); |
147 const TTimeIntervalMicroSeconds& aDuration); |
149 void MapcPlayComplete(TInt aError); |
148 void MapcPlayComplete(TInt aError); |
150 |
149 |
151 //From MVidePlayerUtilityObserver |
150 //From MVidePlayerUtilityObserver |
152 void MvpuoOpenComplete(TInt aError); |
151 void MvpuoOpenComplete(TInt aError); |
153 void MvpuoPrepareComplete(TInt aError); |
152 void MvpuoPrepareComplete(TInt aError); |
154 void MvpuoFrameReady(CFbsBitmap& aFrame, TInt aError); |
153 void MvpuoFrameReady(CFbsBitmap& aFrame, TInt aError); |
155 void MvpuoPlayComplete(TInt aError); |
154 void MvpuoPlayComplete(TInt aError); |
156 void MvpuoEvent(const TMMFEvent& aEvent); |
155 void MvpuoEvent(const TMMFEvent& aEvent); |
157 |
156 |
158 // From MRebufferCallback |
157 // From MRebufferCallback |
159 void MvloLoadingStarted(); |
158 void MvloLoadingStarted(); |
160 void MvloLoadingComplete(); |
159 void MvloLoadingComplete(); |
161 |
160 |
162 private: |
161 private: |
163 enum TPlayerState |
162 enum TPlayerState |
164 { |
163 { |
165 EPlayerClosed, |
164 EPlayerClosed, |
166 EPlayerOpened, |
165 EPlayerOpened, |
167 EPlayerPrepared, |
166 EPlayerPrepared, |
168 EPlayerPaused, |
167 EPlayerPaused, |
169 EPlayerPlaying, |
168 EPlayerPlaying, |
170 }; |
169 }; |
171 |
170 |
172 private: |
171 private: |
173 CMMFBackendEngine(); |
172 CMMFBackendEngine(); |
174 void ConstructL(); |
173 void ConstructL(); |
175 void InitAudioRecorderUtilityL(); |
174 void InitAudioRecorderUtilityL(); |
176 void InitAudioPlayerUtilityL(); |
175 void InitAudioPlayerUtilityL(); |
180 XAresult DoHandlePlayItfAttributesChanged(); |
179 XAresult DoHandlePlayItfAttributesChanged(); |
181 void DoPostEvent(XAuint32 event); |
180 void DoPostEvent(XAuint32 event); |
182 TInt InitializeURIForMMFUtil(char *uri); |
181 TInt InitializeURIForMMFUtil(char *uri); |
183 |
182 |
184 private: |
183 private: |
185 CVideoPlayerUtility2* iVideoPlayer; |
184 CVideoPlayerUtility2* iVideoPlayer; |
186 CBase* iBaseVideoPlayer; |
185 CBase* iBaseVideoPlayer; |
187 CMdaAudioPlayerUtility* iAudioPlayer; |
186 CMdaAudioPlayerUtility* iAudioPlayer; |
188 CBase* iBaseAudioPlayer; |
187 CBase* iBaseAudioPlayer; |
189 CMdaAudioRecorderUtility* iAudioRecorder; |
188 CMdaAudioRecorderUtility* iAudioRecorder; |
190 CBase* iBaseAudioRecorder; |
189 CBase* iBaseAudioRecorder; |
191 TFileName iFileName; |
190 TFileName iFileName; |
192 TInt iAPIBeingUsed; |
191 TInt iAPIBeingUsed; |
193 TInt iPreviousRecordState; |
192 TInt iPreviousRecordState; |
194 TInt iCurrentRecordState; |
193 TInt iCurrentRecordState; |
195 TInt iErrorCode; |
194 TInt iErrorCode; |
196 TRecorderState iRecordState; |
195 TRecorderState iRecordState; |
197 LocalTimer* iPositionUpdateTimer; |
196 LocalTimer* iPositionUpdateTimer; |
198 TUint64 iTimerDelay; |
197 TUint64 iTimerDelay; |
199 void* iAdaptContext; |
198 void* iAdaptContext; |
200 XAuint32 iFileFormat; |
199 XAuint32 iFileFormat; |
201 TInt iPauseSupportMP4; |
200 TInt iPauseSupportMP4; |
202 CActiveSchedulerWait* iActiveSchedulerWait; |
201 CActiveSchedulerWait* iActiveSchedulerWait; |
203 CAudioInput* iAudioInputRecord; |
202 CAudioInput* iAudioInputRecord; |
204 #ifdef USE_LOCAL_WINDOW_RESOURCES |
203 #ifdef USE_LOCAL_WINDOW_RESOURCES |
205 CMediaClientVideoDisplay* iMediaClientVideoDisplay; |
204 CMediaClientVideoDisplay* iMediaClientVideoDisplay; |
206 TRect m_clipRect; |
205 TRect m_clipRect; |
207 TRect m_videoExtent; |
206 TRect m_videoExtent; |
208 TRect m_cropRegion; |
207 TRect m_cropRegion; |
209 TVideoAspectRatio m_pixelAspectRatio; |
208 TVideoAspectRatio m_pixelAspectRatio; |
210 RWindow m_Window; |
209 RWindow m_Window; |
211 TRect m_cropRect; |
210 TRect m_cropRect; |
212 TSurfaceId m_surfaceId; |
211 TSurfaceId m_surfaceId; |
213 TVideoRotation m_rotation; |
212 TVideoRotation m_rotation; |
214 TReal32 m_scaleWidth; |
213 TReal32 m_scaleWidth; |
215 TReal32 m_scaleHeight; |
214 TReal32 m_scaleHeight; |
216 TInt m_horizPos; |
215 TInt m_horizPos; |
217 TInt m_vertPos; |
216 TInt m_vertPos; |
218 TInt m_displayId; |
217 TInt m_displayId; |
219 /*TBool m_bWindowReferencePassed;*/ |
218 /*TBool m_bWindowReferencePassed;*/ |
220 RWsSession m_ws; |
219 RWsSession m_ws; |
221 #endif /* USE_LOCAL_WINDOW_RESOURCES */ |
220 #endif /* USE_LOCAL_WINDOW_RESOURCES */ |
222 |
221 |
223 /* Holds duration of the media clip opend for playback */ |
222 /* Holds duration of the media clip opend for playback */ |
247 TPtr iUriPtr; |
246 TPtr iUriPtr; |
248 TUriType iUriType; |
247 TUriType iUriType; |
249 /* Property set by client */ |
248 /* Property set by client */ |
250 RWsSession* m_pWs; |
249 RWsSession* m_pWs; |
251 /* Property set by client */ |
250 /* Property set by client */ |
252 RWindow* m_pWindow; |
251 RWindow* m_pWindow; |
253 }; |
252 }; |
254 |
253 |
255 #else /* __cplusplus */ |
254 #else /* __cplusplus */ |
256 |
|
257 |
255 |
258 extern int mmf_backend_engine_init(void** engine); |
256 extern int mmf_backend_engine_init(void** engine); |
259 extern int mmf_backend_engine_deinit(void* engine); |
257 extern int mmf_backend_engine_deinit(void* engine); |
260 |
258 |
261 extern int mmf_set_recorder_uri(void* context, char* uri, XAuint32 format); |
259 extern int mmf_set_recorder_uri(void* context, char* uri, XAuint32 format); |
262 |
|
263 |
260 |
264 extern void mmf_close(void* context); |
261 extern void mmf_close(void* context); |
265 |
262 |
266 extern int mmf_set_adapt_context(void* context, void* adaptcontext); |
263 extern int mmf_set_adapt_context(void* context, void* adaptcontext); |
267 |
264 |
303 extern XAresult mmf_seekitf_set_playwindow(void * context, XAmillisecond start, XAmillisecond end); |
300 extern XAresult mmf_seekitf_set_playwindow(void * context, XAmillisecond start, XAmillisecond end); |
304 extern XAresult mmf_seekitf_set_repeats(void * context, XAboolean repeat); |
301 extern XAresult mmf_seekitf_set_repeats(void * context, XAboolean repeat); |
305 |
302 |
306 extern XAresult mmf_streaminformationitf_get_numstreams(void * context, XAuint32* numstreams); |
303 extern XAresult mmf_streaminformationitf_get_numstreams(void * context, XAuint32* numstreams); |
307 extern XAresult mmf_streaminformationitf_get_streaminfo(void * context, XAuint32 streamindex, |
304 extern XAresult mmf_streaminformationitf_get_streaminfo(void * context, XAuint32 streamindex, |
308 XAuint32* streamtype); |
305 XAuint32* streamtype); |
309 extern XAresult mmf_streaminformationitf_get_videoframesize(void * context, XAuint32* height, |
306 extern XAresult mmf_streaminformationitf_get_videoframesize(void * context, XAuint32* height, |
310 XAuint32* width, XAuint32* frameRate); |
307 XAuint32* width, XAuint32* frameRate); |
311 extern XAresult mmf_streaminformationitf_set_activestream(void * context, XAuint32 streamindex, |
308 extern XAresult mmf_streaminformationitf_set_activestream(void * context, XAuint32 streamindex, |
312 XAboolean active); |
309 XAboolean active); |
313 |
310 |
314 extern XAresult mmf_volumeitf_set_volume(void * context, XAuint32 volume); |
311 extern XAresult mmf_volumeitf_set_volume(void * context, XAuint32 volume); |
315 extern XAresult mmf_volumeitf_get_volume(void * context, XAuint32* volume); |
312 extern XAresult mmf_volumeitf_get_volume(void * context, XAuint32* volume); |
316 extern XAresult mmf_volumeitf_get_maxvolume(void * context, XAuint32* volume); |
313 extern XAresult mmf_volumeitf_get_maxvolume(void * context, XAuint32* volume); |
317 #endif /* __cplusplus */ |
314 #endif /* __cplusplus */ |
318 |
315 |
319 #endif /* XA_CMMFBackendEngine_H */ |
316 #endif /* CMMFBackendEngine_H */ |