|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CPROCOUTFILEHANDLER_H__ |
|
22 #define __CPROCOUTFILEHANDLER_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 #include "AudCommon.h" |
|
27 #include "ProcConstants.h" |
|
28 |
|
29 class CProcOutFileHandler : public CBase |
|
30 { |
|
31 |
|
32 public: |
|
33 |
|
34 /* |
|
35 static CProcOutFileHandler* NewL(const TDesC& aFileName, |
|
36 TInt aWriteBufferSize, |
|
37 TAudFileProperties aProperties); |
|
38 |
|
39 static CProcOutFileHandler* NewLC(const TDesC& aFileName, |
|
40 TInt aWriteBufferSize, |
|
41 TAudFileProperties aProperties); |
|
42 */ |
|
43 |
|
44 /** |
|
45 * Sets the output file properties |
|
46 * |
|
47 * @param aProperties properties of the output file |
|
48 */ |
|
49 TBool SetPropertiesL(TAudFileProperties aProperties); |
|
50 |
|
51 void GetPropertiesL(const TAudFileProperties*& aProperties); |
|
52 |
|
53 /** |
|
54 * Initializes an output file |
|
55 * (writes file headers etc.) |
|
56 * |
|
57 * @return ETrue if successful |
|
58 * |
|
59 */ |
|
60 virtual TBool InitializeFileL(); |
|
61 |
|
62 /** |
|
63 * Finalizes an output file |
|
64 * Writes some file specific information if needed and |
|
65 * closes the file |
|
66 * |
|
67 */ |
|
68 virtual TBool FinalizeFile(); |
|
69 |
|
70 /** |
|
71 * Writes a new audio frame to an output file |
|
72 * |
|
73 * @param aFrame an audio frame to be written |
|
74 * @param aSize the number of bytes written |
|
75 * |
|
76 */ |
|
77 virtual TBool WriteAudioFrameL(const HBufC8*& aFrame, TInt& aSize); |
|
78 |
|
79 /** |
|
80 * Writes a new audio frame to an output file |
|
81 * |
|
82 * @param aFrame an audio frame to be written |
|
83 * @param aSize the number of bytes written |
|
84 * @param aDurationMilliSeconds frame duration in milliseconds |
|
85 * |
|
86 */ |
|
87 virtual TBool WriteAudioFrameL(const HBufC8*& aFrame, TInt& aSize, TInt aDurationMilliSeconds); |
|
88 |
|
89 /** |
|
90 * Writes silent frames to current file position |
|
91 * |
|
92 * @param aTime time (in milliseconds) of how much silence is to be written |
|
93 */ |
|
94 virtual TBool WriteSilenceL(TInt32 aTime) = 0; |
|
95 virtual ~CProcOutFileHandler(); |
|
96 |
|
97 |
|
98 private: |
|
99 |
|
100 protected: |
|
101 |
|
102 void ConstructL(const TDesC& aFileName, TInt aWriteBufferSize, TAudFileProperties aProperties); |
|
103 void InitL(const TDesC& aFileName, TInt aWriteBufferSize); |
|
104 TBool OpenFileForWritingL(); |
|
105 TBool CloseFile(); |
|
106 CProcOutFileHandler(); |
|
107 |
|
108 TInt BufferedFileWriteL(const TDesC8& aDes,TInt aLength); |
|
109 TInt BufferedFileGetPos(); |
|
110 TInt BufferedFileSetPos(TInt aPos); |
|
111 |
|
112 HBufC* iFileName; |
|
113 |
|
114 RFile iFile; |
|
115 RFs iFs; |
|
116 TBool iFileOpen; |
|
117 |
|
118 HBufC8* iWriteBuffer; |
|
119 |
|
120 TInt iWriteBufferSize; |
|
121 |
|
122 TAudFileProperties* iProperties; |
|
123 |
|
124 HBufC8* iSilentFrame; |
|
125 |
|
126 }; |
|
127 |
|
128 #endif |