|
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 "omxilprocessingfunction.h" |
|
27 #include <e32base.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(COmxILFsm::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 |
|
44 MOmxILCallbackNotificationIf& GetCallbacks(); |
|
45 |
|
46 /** can return NULL if parameter has not been set. */ |
|
47 const HBufC* FileName() const; |
|
48 const HBufC8* Uri() const; |
|
49 |
|
50 private: |
|
51 COmxILFileSinkProcessingFunction(MOmxILCallbackNotificationIf& aCallbacks); |
|
52 void ConstructL(); |
|
53 |
|
54 void InitFileAndUriL(); |
|
55 OMX_ERRORTYPE SetFileName(const OMX_PARAM_CONTENTURITYPE* aContentUriType); |
|
56 |
|
57 private: |
|
58 RPointerArray<OMX_BUFFERHEADERTYPE> iBuffersToEmpty; |
|
59 OMX_STATETYPE iState; |
|
60 HBufC8* iUri; |
|
61 HBufC* iFileName; |
|
62 |
|
63 private: |
|
64 class CPFHelper; |
|
65 class CFileSinkAccess : public CActive |
|
66 { |
|
67 friend class CPFHelper; |
|
68 public: |
|
69 static CFileSinkAccess* NewL(COmxILFileSinkProcessingFunction& aParent); |
|
70 ~CFileSinkAccess(); |
|
71 |
|
72 // from CActive |
|
73 void RunL(); |
|
74 void DoCancel(); |
|
75 |
|
76 TInt Execute(); |
|
77 void Pause(); |
|
78 void Stop(); |
|
79 void Idle(); |
|
80 |
|
81 TInt ProcessNextBuffer(); |
|
82 |
|
83 private: |
|
84 CFileSinkAccess(COmxILFileSinkProcessingFunction& aParent); |
|
85 void ConstructL(); |
|
86 |
|
87 private: |
|
88 COmxILFileSinkProcessingFunction& iParent; |
|
89 OMX_BUFFERHEADERTYPE* iCurrentBuffer; |
|
90 |
|
91 RFs iFs; |
|
92 RFile iFileHandle; |
|
93 TInt iBufferOffset; |
|
94 TPtr8 iWriteBuffer; |
|
95 |
|
96 } *iFileSinkAccess; |
|
97 |
|
98 class CPFHelper : public CActive |
|
99 { |
|
100 public: |
|
101 static CPFHelper* NewL(COmxILFileSinkProcessingFunction& aParent, CFileSinkAccess& aFileSinkAccess); |
|
102 ~CPFHelper(); |
|
103 |
|
104 static OMX_ERRORTYPE ConvertSymbianErrorType(TInt aError); |
|
105 |
|
106 // from CActive |
|
107 void RunL(); |
|
108 void DoCancel(); |
|
109 |
|
110 TInt ExecuteAsync(); |
|
111 TInt StopAsync(); |
|
112 TInt PauseAsync(); |
|
113 void StopSync(); |
|
114 TInt IdleAsync(); |
|
115 TInt BufferIndication(OMX_BUFFERHEADERTYPE* apBufferHeader); |
|
116 |
|
117 enum TMessageType |
|
118 { |
|
119 EExecuteCommand, |
|
120 EStopCommand, |
|
121 EPauseCommand, |
|
122 ECancelCommand, |
|
123 EBufferIndication, |
|
124 EIdleCommand |
|
125 }; |
|
126 |
|
127 class TProcMessage |
|
128 { |
|
129 public: |
|
130 TMessageType iType; |
|
131 TAny* iPtr; |
|
132 }; |
|
133 |
|
134 RMsgQueue<TProcMessage> iMsgQueue; |
|
135 |
|
136 private: |
|
137 CPFHelper(COmxILFileSinkProcessingFunction& aParent, CFileSinkAccess& aFileSinkAccess); |
|
138 void ConstructL(); |
|
139 |
|
140 TInt ProcessQueue(); |
|
141 |
|
142 private: |
|
143 COmxILFileSinkProcessingFunction& iParent; |
|
144 CFileSinkAccess& iFileSinkAccess; |
|
145 } *iPFHelper; |
|
146 }; |
|
147 |
|
148 #endif // OMXILFILESINKPROCESSINGFUNCTION_H |
|
149 |