Update contrib.
1 // Copyright (c) 2006-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __ASYNCFILEPARSER_H
17 #define __ASYNCFILEPARSER_H
25 // FORWARD DECLARATIONS
27 struct MP4HandleStruct;
34 NONSHARABLE_CLASS(CFileAsyncParser) : public CActive
36 public: // Constructors and destructor
39 * Two-phased constructor.
41 static CFileAsyncParser* NewL( MP4HandleStruct* aHandle, RFile64& aFile );
48 public: // New functions
51 * Reads audio frames from file asynchronously
53 * @return Error code, KErrNone if no errors, otherwise one of the system wide error codes.
55 TInt ReadAudioFrames( mp4_u8 *buffer, mp4_i64 aPosition, mp4_u32 aBytesToRead );
58 * Reads video frames from file asynchronously
60 * @return Error code, KErrNone if no errors, otherwise one of the system wide error codes.
62 TInt ReadVideoFrame( mp4_u8 *buffer, mp4_i64 aPosition, mp4_u32 aBytesToRead );
64 protected: // Functions from base classes
66 * From CActive Cancels async request.
71 * From CActive Called when async request completes.
77 * C++ default constructor.
82 * By default Symbian 2nd phase constructor is private.
84 void ConstructL( MP4HandleStruct* aHandle, RFile64& aFile );
87 * By default Symbian 2nd phase constructor is private.
89 TInt ReadDataAsync( mp4_u8 *buffer, mp4_i64 aPosition, mp4_u32 aBytesToRead );
92 * Return audio frames to observer
94 void ReturnAudioFrames();
97 * Return video frame to observer
99 void ReturnVideoFrame();
102 * Calculates audio framecount in buffer
104 TInt CalculateAudioFrameCount();
107 // Handle to parsed file structure.
108 MP4HandleStruct* iHandle;
112 // Pointer to iDiskBuffer data
113 TPtr8 iDiskBufferPointer;
115 TInt iReadBufferSize;
116 // Position of last read Diskbuffer in file
117 TInt64 iCurrentDiskReadPosition;
118 // Position of last read inside iDiskBuffer.
119 TUint iCurrentBufferReadPosition;
120 // Whether on last parse request all data was found on internal buffer.
121 TBool iAllDataInMemory;
123 // Audio parameters to be filled.
124 // Size of audio frame returned to client.
126 // Number of audio frames in buffer.
127 mp4_u32 iReturnedAudioFrames;
128 // Audio frame presentation time in milliseconds from the beginning of the audio sequence.
129 mp4_u32 iAudioTimeStamp;
130 // Audio frame presentation time in timescale from the beginning of the audio sequence
131 mp4_u32 iAudioTimeStamp2;
133 // Video parameter to be filled.
134 // Size of video frame returned to client.
136 // Whether returned video frame is keyframe or not.
137 mp4_bool iVideoKeyFrame;
138 // Video frame presentation time in milliseconds from the beginning of the video sequence.
139 mp4_u32 iVideoTimeStamp;
140 // Video frame presentation time in timescale from the beginning of the video sequence
141 mp4_u32 iVideoTimeStamp2;
143 // Read logic variables.
144 // Amount of bytes client wants to read
146 // Amount of bytes read.
148 // Flag whether there is async writing going.
149 TBool iAsyncReadOngoing;
150 // Flag whether current read is audio.
151 TBool iProcessingAudio;
155 // Parsed file being read.
157 // Output buffer being written to
161 #endif //__ASYNCFILEPARSER_H