|
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 "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: TNE server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef _CHXCTneServer_H_ |
|
21 #define _CHXCTneServer_H_ |
|
22 |
|
23 #include"HXTneclientservercommon.h" |
|
24 #include <hxtnutil.h> |
|
25 #include <hxtnutil_obs.h> |
|
26 |
|
27 #include <TNEVideoClipInfo.h> |
|
28 #include <e32base.h> |
|
29 #include <e32svr.h> |
|
30 #include <e32uid.h> |
|
31 #include <e32std.h> |
|
32 #include <coemain.h> |
|
33 #include <ecom/ecom.h> |
|
34 |
|
35 |
|
36 #include "yuv2rgb12.h" |
|
37 #include "yuv2rgb16.h" |
|
38 #include "yuv2rgb24.h" |
|
39 |
|
40 |
|
41 //////////////////////Server class///////////////// |
|
42 class CTneServer : public CServer2 |
|
43 { |
|
44 |
|
45 public: |
|
46 CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; |
|
47 public : |
|
48 // The thread function executed by the server |
|
49 static TInt ThreadFunction(TAny* aStarted); |
|
50 |
|
51 protected: |
|
52 CTneServer(CActive::TPriority aActiveObjectPriority); |
|
53 }; |
|
54 |
|
55 |
|
56 /////////////////Session class/////////////////////////// |
|
57 |
|
58 class CTneSession : public CSession2, public MHXThumbnailUtilityImplObserver |
|
59 |
|
60 { |
|
61 public: |
|
62 CTneSession(); |
|
63 ~CTneSession(); |
|
64 |
|
65 //service request |
|
66 void ServiceL(const RMessage2& aMessage); |
|
67 void DispatchMessageL(const RMessage2& aMessage); |
|
68 // void InitL(); we are not using this rite now |
|
69 |
|
70 // observer interface from MHXThumbnailUtilityImplObserver |
|
71 void MetaDataReady(TInt aError); |
|
72 void PacketReady(TInt aError, void *pData, TUint32 aDataSize); |
|
73 void EndOfPackets(); |
|
74 |
|
75 protected: |
|
76 |
|
77 void CompleteRequest(TInt aError); // Completes the Rmessage corresponding to Getthumb |
|
78 void FetchBasicMetaData(); // Extract metadata from Util |
|
79 void DoGetThumb(); // Calls Notification of Thumbpending to client on Clients request to Get thumb |
|
80 TBool IsGoodFrame(TUint8* aYUVDataPtr); // checks on the value of each frame wrt width and height |
|
81 void StopServer(); |
|
82 |
|
83 void NotifyIfGetThumbPending(TInt aError, TUint8 *&pYUVBuffer); // Notifies client of thumb pending |
|
84 TInt ReOpenFile(RFile &aFileHandle); // Called in case the clip is required to be open not from 0 index but from middle of clip |
|
85 TInt DoOpenFile(RFile &aFileHandle, TUint uStartTime); |
|
86 TInt GetStartingTime(TUint &uStartingTime); |
|
87 void CompleteCancelRequest(); // Completes the Rmessage corresponding to GetCancel |
|
88 |
|
89 private: |
|
90 |
|
91 enum EThumbnailUtilState |
|
92 { |
|
93 EStartGettingMetadata = 0, |
|
94 EStartGettingThumbNail, |
|
95 EStartGettingThumbNailWithIndex, |
|
96 ECancelling, |
|
97 ENotReady |
|
98 }; |
|
99 |
|
100 TInt iWidth; |
|
101 TInt iHeight; |
|
102 TUint iDuration; |
|
103 TInt64 iFrameCount; |
|
104 |
|
105 // Variable to handle error during the state transitions in server |
|
106 TInt m_LastError; |
|
107 TUint m_uPacketsReceived; |
|
108 |
|
109 |
|
110 // will be set to true if got the good thumb or an error has occured. |
|
111 TBool m_bDone; |
|
112 //file server |
|
113 RFs* iFs; |
|
114 |
|
115 |
|
116 // Concatenated YUV data for decoded frame |
|
117 TUint8* iYUVBuffer; |
|
118 TUint8** iClientYUVBufferPtrPtr; |
|
119 TBool m_bOpenFileLPending; |
|
120 TBool iGetThumbPending; |
|
121 |
|
122 TBool iCloseHandle; |
|
123 TBool ibOpenFilePending; |
|
124 TInt iThumbIndex; |
|
125 |
|
126 RMessage2 iClientRequest; |
|
127 RMessage2 iCancelRequest; |
|
128 // helix thumbnail utility |
|
129 CHXThumbnailUtility* iUtil; |
|
130 EThumbnailUtilState m_State; |
|
131 RFile iFileHandle; |
|
132 |
|
133 TBool m_bMetaDataReady; |
|
134 |
|
135 }; |
|
136 |
|
137 #endif // _CHXCTneServer_H_ |