|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #ifndef MCCVIDEOSOURCEWRAPPER_H |
|
22 #define MCCVIDEOSOURCEWRAPPER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 #include <e32std.h> |
|
27 #include <mmf/server/mmfdatasource.h> |
|
28 #include <mmf/server/mmfdatasink.h> |
|
29 #include <3gplibrary/mp4lib.h> |
|
30 #include <CCMRMediaSink.h> |
|
31 #include <CCMRMediaRecorder.h> |
|
32 #include <CCMRMediaRecorderObserver.h> |
|
33 #include <mmf/devvideo/devvideobase.h> |
|
34 |
|
35 #include "mmcccodecinformation.h" |
|
36 |
|
37 class TMccCodecInfo; |
|
38 |
|
39 const TInt KIPULRandomAccessPeriod = 2; //Time in seconds between intra frames |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * |
|
45 */ |
|
46 class CMccVideoSourceWrapper: public CBase, public MCMRMediaSink, public MCMRMediaRecorderObserver |
|
47 { |
|
48 |
|
49 public: // Methods called internally or by the controller |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 */ |
|
54 static CMccVideoSourceWrapper* NewL( |
|
55 MCMRMediaSink& aObserver, |
|
56 MCMRMediaRecorderObserver& aObserver2 ); |
|
57 |
|
58 virtual ~CMccVideoSourceWrapper(); |
|
59 |
|
60 public: // new |
|
61 |
|
62 void OpenL( MDataSource* aAudioSource, |
|
63 TInt aCameraHandle, |
|
64 const TDesC8& aVideoMimeType = KNullDesC8, |
|
65 TFourCC aAudioType = KFourCCNULL, |
|
66 TUid aEncoderUid = KNullUid ); |
|
67 |
|
68 void PlayL(); |
|
69 |
|
70 void ResumeL(); |
|
71 |
|
72 void PauseL(); |
|
73 |
|
74 void StopL(); |
|
75 |
|
76 void SetVideoBitrateL( TUint aVideoBitRate ); |
|
77 |
|
78 void SetVideoFrameRateL( TReal32 aFramesPerSecond ); |
|
79 |
|
80 TUint GetVideoBitrateL(); |
|
81 |
|
82 CCMRMediaRecorder::TRecorderState State(); |
|
83 |
|
84 void SetVideoRateControlOptionsL( const TRateControlOptions& aOptions ); |
|
85 |
|
86 void GetVideoRateControlOptionsL( TRateControlOptions& aOptions ); |
|
87 |
|
88 public: // from MCMRMediaSink |
|
89 |
|
90 /** |
|
91 * Write a buffer to sink |
|
92 * @since 2.1 |
|
93 * @param CCMRMediaBuffer* aBuffer The buffer to write |
|
94 * @return TInt Error code |
|
95 */ |
|
96 virtual void WriteBufferL(CCMRMediaBuffer* aBuffer); |
|
97 |
|
98 /** |
|
99 * Inform video frame size to sink |
|
100 * @since 2.1 |
|
101 * @param TSize aSize Video frame size |
|
102 * @return TInt Error code |
|
103 */ |
|
104 virtual TInt SetVideoFrameSize(TSize aSize); |
|
105 |
|
106 /** |
|
107 * Inform average video bitrate to sink |
|
108 * @since 2.1 |
|
109 * @param TInt aBitRate Average video bitrate |
|
110 * @return TInt Error code |
|
111 */ |
|
112 virtual TInt SetAverageVideoBitRate(TInt aBitRate); |
|
113 |
|
114 /** |
|
115 * Inform maximum video bitrate to sink |
|
116 * @since 2.1 |
|
117 * @param TInt aBitRate Maximum expected video bitrate |
|
118 * @return TInt Error code |
|
119 */ |
|
120 virtual TInt SetMaxVideoBitRate(TInt aBitRate); |
|
121 |
|
122 /** |
|
123 * Inform average audio bitrate to sink |
|
124 * @since 2.1 |
|
125 * @param TInt aBitRate Average audio bitrate |
|
126 * @return TInt Error code |
|
127 */ |
|
128 virtual TInt SetAverageAudioBitRate(TInt aBitRate); |
|
129 |
|
130 public: // from MCMRMediaRecorderObserver |
|
131 |
|
132 /** |
|
133 * Informs the user that PrepareL() has been completed with or |
|
134 * without errors. If aError != KErrNone, media recorder remains in |
|
135 * open state |
|
136 * @since 2.1 |
|
137 * @param aError Error code |
|
138 * @return void |
|
139 */ |
|
140 virtual void MmroPrepareComplete(TInt aError); |
|
141 |
|
142 /** |
|
143 * Informs the user about a state change. |
|
144 * Useful to find out when a new prepare is needed after |
|
145 * a setting was changed |
|
146 * @since 2.1 |
|
147 * @param aState New state (CCMRMediaRecorder - TRecorderState) |
|
148 * @param aError Error code |
|
149 * @return void |
|
150 */ |
|
151 virtual void MmroStateChange(TInt aState, TInt aError); |
|
152 |
|
153 /** |
|
154 * Informs the user about a temporary runtime error. |
|
155 * Recording can't continue right now but it may |
|
156 * be possible to continue later (e.g. audio HW was |
|
157 * taken by a higher priority application) |
|
158 * @since 2.1 |
|
159 * @param aError Error code |
|
160 * @return void |
|
161 */ |
|
162 virtual void MmroTemporaryError(TInt aError); |
|
163 |
|
164 /** |
|
165 * Informs the user about a fatal runtime error (e.g. OOM). |
|
166 * MediaRecorder must be deleted and recreated. |
|
167 * @since 2.1 |
|
168 * @param aError Error code |
|
169 * @return void |
|
170 */ |
|
171 virtual void MmroFatalError(TInt aError); |
|
172 |
|
173 private: |
|
174 |
|
175 void ConstructL(); |
|
176 |
|
177 CMccVideoSourceWrapper( |
|
178 MCMRMediaSink& aObserver, |
|
179 MCMRMediaRecorderObserver& aObserver2 ); |
|
180 |
|
181 private: |
|
182 |
|
183 CCMRMediaRecorder* iMediaRecorder; |
|
184 MCMRMediaSink& iObserver; |
|
185 MCMRMediaRecorderObserver& iObserver2; |
|
186 |
|
187 TBool iFatalErrorOccured; |
|
188 |
|
189 private: |
|
190 #ifdef TEST_EUNIT |
|
191 friend class UT_CMccVideoSourceImpl; |
|
192 #endif |
|
193 }; |
|
194 |
|
195 |
|
196 #endif |
|
197 |
|
198 |
|
199 // End of file |