|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 * @file |
|
20 * @internalTechnology |
|
21 */ |
|
22 |
|
23 #ifndef OMXILFILESINKPROCESSINGFUNCTION_H |
|
24 #define OMXILFILESINKPROCESSINGFUNCTION_H |
|
25 |
|
26 #include <openmax/il/common/omxilprocessingfunction.h> |
|
27 #include <openmax/il/khronos/v1_x/OMX_Component.h> |
|
28 #include <e32msgqueue.h> |
|
29 #include <f32file.h> |
|
30 |
|
31 class COmxILFileSinkProcessingFunction : public COmxILProcessingFunction |
|
32 { |
|
33 public: |
|
34 static COmxILFileSinkProcessingFunction* NewL(MOmxILCallbackNotificationIf& aCallbacks); |
|
35 ~COmxILFileSinkProcessingFunction(); |
|
36 |
|
37 OMX_ERRORTYPE StateTransitionIndication(TStateIndex aNewState); |
|
38 OMX_ERRORTYPE BufferFlushingIndication(TUint32 aPortIndex, OMX_DIRTYPE aDirection); |
|
39 OMX_ERRORTYPE ParamIndication(OMX_INDEXTYPE aParamIndex, const TAny* apComponentParameterStructure); |
|
40 OMX_ERRORTYPE ConfigIndication(OMX_INDEXTYPE aConfigIndex, const TAny* apComponentConfigStructure); |
|
41 OMX_ERRORTYPE BufferIndication(OMX_BUFFERHEADERTYPE* apBufferHeader, OMX_DIRTYPE aDirection); |
|
42 OMX_BOOL BufferRemovalIndication(OMX_BUFFERHEADERTYPE* apBufferHeader, OMX_DIRTYPE aDirection); |
|
43 MOmxILCallbackNotificationIf& GetCallbacks(); |
|
44 |
|
45 /** can return NULL if parameter has not been set. */ |
|
46 const HBufC* FileName() const; |
|
47 const HBufC8* Uri() const; |
|
48 |
|
49 private: |
|
50 COmxILFileSinkProcessingFunction(MOmxILCallbackNotificationIf& aCallbacks); |
|
51 void ConstructL(); |
|
52 |
|
53 void InitFileAndUriL(); |
|
54 OMX_ERRORTYPE SetFileName(const OMX_PARAM_CONTENTURITYPE* aContentUriType); |
|
55 |
|
56 private: |
|
57 RPointerArray<OMX_BUFFERHEADERTYPE> iBuffersToEmpty; |
|
58 OMX_STATETYPE iState; |
|
59 HBufC8* ipUri; |
|
60 HBufC* ipFileName; |
|
61 |
|
62 private: |
|
63 class CPFHelper; |
|
64 class CFileSinkAccess : public CActive |
|
65 { |
|
66 friend class CPFHelper; |
|
67 public: |
|
68 static CFileSinkAccess* NewL(COmxILFileSinkProcessingFunction& aParent); |
|
69 ~CFileSinkAccess(); |
|
70 |
|
71 // from CActive |
|
72 void RunL(); |
|
73 void DoCancel(); |
|
74 |
|
75 TInt Execute(); |
|
76 void Pause(); |
|
77 void Stop(); |
|
78 void Idle(); |
|
79 |
|
80 TInt ProcessNextBuffer(); |
|
81 |
|
82 private: |
|
83 CFileSinkAccess(COmxILFileSinkProcessingFunction& aParent); |
|
84 void ConstructL(); |
|
85 |
|
86 private: |
|
87 COmxILFileSinkProcessingFunction& iParent; |
|
88 OMX_BUFFERHEADERTYPE* iCurrentBuffer; |
|
89 |
|
90 RFs iFs; |
|
91 RFile iFileHandle; |
|
92 TInt iBufferOffset; |
|
93 TPtr8 iWriteBuffer; |
|
94 |
|
95 } *ipFileSinkAccess; |
|
96 |
|
97 class CPFHelper : public CActive |
|
98 { |
|
99 public: |
|
100 static CPFHelper* NewL(COmxILFileSinkProcessingFunction& aParent, CFileSinkAccess& aFileSinkAccess); |
|
101 ~CPFHelper(); |
|
102 |
|
103 static OMX_ERRORTYPE ConvertSymbianErrorType(TInt aError); |
|
104 |
|
105 // from CActive |
|
106 void RunL(); |
|
107 void DoCancel(); |
|
108 |
|
109 TInt ExecuteAsync(); |
|
110 TInt StopAsync(); |
|
111 TInt PauseAsync(); |
|
112 void StopSync(); |
|
113 TInt IdleAsync(); |
|
114 TInt BufferIndication(OMX_BUFFERHEADERTYPE* apBufferHeader); |
|
115 |
|
116 enum TMessageType |
|
117 { |
|
118 EExecuteCommand, |
|
119 EStopCommand, |
|
120 EPauseCommand, |
|
121 ECancelCommand, |
|
122 EBufferIndication, |
|
123 EIdleCommand |
|
124 }; |
|
125 |
|
126 class TProcMessage |
|
127 { |
|
128 public: |
|
129 TMessageType iType; |
|
130 TAny* iPtr; |
|
131 }; |
|
132 |
|
133 RMsgQueue<TProcMessage> iMsgQueue; |
|
134 |
|
135 private: |
|
136 CPFHelper(COmxILFileSinkProcessingFunction& aParent, CFileSinkAccess& aFileSinkAccess); |
|
137 void ConstructL(); |
|
138 |
|
139 TInt ProcessQueue(); |
|
140 |
|
141 private: |
|
142 COmxILFileSinkProcessingFunction& iParent; |
|
143 CFileSinkAccess& iFileSinkAccess; |
|
144 } *ipPFHelper; |
|
145 }; |
|
146 |
|
147 #endif // OMXILFILESINKPROCESSINGFUNCTION_H |
|
148 |