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 __COMPOSER_H__ |
|
22 #define __COMPOSER_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #ifndef __E32BASE_H__ |
|
26 #include <e32base.h> |
|
27 #endif |
|
28 |
|
29 // CONSTANTS |
|
30 // MACROS |
|
31 // DATA TYPES |
|
32 // FUNCTION PROTOTYPES |
|
33 // FORWARD DECLARATIONS |
|
34 |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Base class for file format parser |
|
40 * ?other_description_lines |
|
41 */ |
|
42 class CComposer : public CBase |
|
43 { |
|
44 |
|
45 public: // Constants |
|
46 |
|
47 enum TErrorCode |
|
48 { |
|
49 EInternalAssertionFailure = -2200, |
|
50 EComposerNotEnoughData = -2201, //FC Can this happen? |
|
51 EComposerEndOfStream = -2202,//FC Can this happen? |
|
52 EComposerBufferTooSmall = -2203,//FC Can this happen? |
|
53 EComposerUnsupportedFormat = -2204,//FC Can this happen? |
|
54 EComposerStreamCorrupted = -2205,//FC Can this happen? |
|
55 EComposerFailure = -2206 |
|
56 }; |
|
57 |
|
58 // file format |
|
59 enum TFileFormat { |
|
60 EFileFormatUnrecognized = 0, |
|
61 EFileFormat3GP, |
|
62 EFileFormatMP4 |
|
63 }; |
|
64 |
|
65 // video format |
|
66 enum TVideoFormat { |
|
67 EVideoFormatNone = 0, |
|
68 EVideoFormatH263Profile0Level10, |
|
69 EVideoFormatH263Profile0Level45, |
|
70 EVideoFormatMPEG4, |
|
71 EVideoFormatAVCProfileBaseline |
|
72 }; |
|
73 |
|
74 // audio format |
|
75 enum TAudioFormat |
|
76 { |
|
77 EAudioFormatNone = 0, |
|
78 EAudioFormatAMR, |
|
79 EAudioFormatAAC |
|
80 }; |
|
81 |
|
82 public: // Data structures |
|
83 |
|
84 // common stream parameters |
|
85 struct TStreamParameters |
|
86 { |
|
87 TBool iHaveVideo; // is there video in the stream ? |
|
88 TBool iHaveAudio; // is there audio in the stream ? |
|
89 TUint iNumDemuxChannels; // number of demux channels |
|
90 TFileFormat iFileFormat; // file format |
|
91 TVideoFormat iVideoFormat; // video format |
|
92 TAudioFormat iAudioFormat; // audio format |
|
93 |
|
94 TUint iAudioFramesInSample; // audio frames per one sample (3GPP) |
|
95 |
|
96 TUint iVideoWidth; // width of a video frame |
|
97 TUint iVideoHeight; // height of a video frame |
|
98 TInt64 iVideoPicturePeriodNsec; // one PCF tick period in nanoseconds |
|
99 TUint iVideoIntraFrequency; // intra frame frequency in stream |
|
100 |
|
101 TUint iStreamLength; // stream length in milliseconds |
|
102 TUint iVideoLength; |
|
103 TUint iAudioLength; |
|
104 |
|
105 TBool iCanSeek; // TRUE if seeking in file is possible |
|
106 |
|
107 TUint iStreamSize; // stream size in bytes |
|
108 TUint iStreamBitrate; // stream average bitrate |
|
109 |
|
110 TUint iMaxPacketSize; // The maximum media packet size |
|
111 TUint iLogicalChannelNumberVideo; // Logical channel number for video data |
|
112 TUint iLogicalChannelNumberAudio; // Logical channel number for audio data |
|
113 TUint iReferencePicturesNeeded; // Number of reference pictures |
|
114 // the video decoder needs to store. |
|
115 TUint iNumScalabilityLayers; // The number of different scalability layers used |
|
116 TUint iLayerFrameRates[8]; // Picture rate for each layer |
|
117 |
|
118 TReal iFrameRate; |
|
119 TInt iVideoTimeScale; |
|
120 TInt iAudioTimeScale; |
|
121 |
|
122 }; |
|
123 |
|
124 public: // Constructors and destructor |
|
125 |
|
126 public: // New functions |
|
127 |
|
128 /** |
|
129 * Composer the stream header. |
|
130 * @param aStreamParameters Stream parameters |
|
131 */ |
|
132 virtual void ComposeHeaderL(CComposer::TStreamParameters& aStreamParameters, |
|
133 TInt aOutputVideoTimeScale, TInt aOutputAudioTimeScale, TInt aAudioFramesInSample) = 0; |
|
134 |
|
135 virtual TInt Close() = 0; |
|
136 |
|
137 virtual TInt WriteFrames(TDesC8& aSrcBuffer, TInt aFrameSize,TInt aDuration, |
|
138 TInt aKeyFrame,TInt aNumberOfFrames,TInt aFrameType) = 0; |
|
139 |
|
140 virtual TInt WriteFrames(TDesC8& aSrcBuffer, TInt aFrameSize,TInt aDuration, |
|
141 TInt aKeyFrame,TInt aNumberOfFrames,TInt aFrameType, TInt& aMP4Size, |
|
142 TBool aModeChanged,TBool aFirstFrameOfClip,TInt aMode, TBool aFromEncoder) = 0; |
|
143 |
|
144 virtual TUint8* GetComposedBuffer() = 0; //Added for buffer support |
|
145 |
|
146 virtual TUint GetComposedBufferSize() = 0; //Added for buffer support |
|
147 |
|
148 /** |
|
149 * Calculate free space on the target output drive in bytes. |
|
150 * |
|
151 * @param None |
|
152 * @return Free space in bytes |
|
153 */ |
|
154 virtual TInt64 DriveFreeSpaceL() = 0; |
|
155 |
|
156 |
|
157 }; |
|
158 |
|
159 #endif // __PARSER_H__ |
|
160 |
|
161 // End of File |
|