williamr@2
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __MMFCLIP_H_
|
williamr@2
|
17 |
#define __MMFCLIP_H_
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <mmf/server/mmfdatasource.h>
|
williamr@2
|
20 |
#include <mmf/server/mmfdatasink.h>
|
williamr@2
|
21 |
#include <mmf/server/mmfbuffer.h>
|
williamr@2
|
22 |
#include <mmf/common/mmfutilities.h>
|
williamr@2
|
23 |
|
williamr@2
|
24 |
/**
|
williamr@2
|
25 |
@publishedAll
|
williamr@2
|
26 |
@released
|
williamr@2
|
27 |
|
williamr@2
|
28 |
Abstract class to represent a source or sink that contains a multimedia clip (i.e. not a stream or hardware device).
|
williamr@2
|
29 |
|
williamr@2
|
30 |
Typical examples are a file or an area of memory (descriptor).
|
williamr@2
|
31 |
*/
|
williamr@2
|
32 |
class CMMFClip : public CBase, public MDataSource, public MDataSink
|
williamr@2
|
33 |
{
|
williamr@2
|
34 |
public :
|
williamr@2
|
35 |
//asynchronous Read/WriteBufferLs
|
williamr@2
|
36 |
|
williamr@2
|
37 |
/**
|
williamr@2
|
38 |
Reads aLength number of bytes of data from the offset, aPosition into the buffer, aBuffer.
|
williamr@2
|
39 |
Intended for asynchronous usage.
|
williamr@2
|
40 |
|
williamr@2
|
41 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
42 |
|
williamr@2
|
43 |
@param aLength
|
williamr@2
|
44 |
The number of bytes to read.
|
williamr@2
|
45 |
@param aBuffer
|
williamr@2
|
46 |
The buffer to read the data into.
|
williamr@2
|
47 |
@param aPosition
|
williamr@2
|
48 |
The offset from which to start reading.
|
williamr@2
|
49 |
@param aConsumer
|
williamr@2
|
50 |
The sink of tha data read from the clip. Will be informed of read if not NULL.
|
williamr@2
|
51 |
*/
|
williamr@2
|
52 |
virtual void ReadBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) = 0 ;
|
williamr@2
|
53 |
|
williamr@2
|
54 |
/**
|
williamr@2
|
55 |
Writes aLength number of bytes of data from the offset, aPosition from the buffer, aBuffer.
|
williamr@2
|
56 |
Intended for asynchronous usage.
|
williamr@2
|
57 |
|
williamr@2
|
58 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
59 |
|
williamr@2
|
60 |
@param aLength
|
williamr@2
|
61 |
The number of bytes to write.
|
williamr@2
|
62 |
@param aBuffer
|
williamr@2
|
63 |
The buffer to write the data into.
|
williamr@2
|
64 |
@param aPosition
|
williamr@2
|
65 |
The offset from which to start writing.
|
williamr@2
|
66 |
@param aSupplier
|
williamr@2
|
67 |
The source of the data writen to the clip. Will be informed of write if not NULL.
|
williamr@2
|
68 |
*/
|
williamr@2
|
69 |
virtual void WriteBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) = 0 ;
|
williamr@2
|
70 |
|
williamr@2
|
71 |
/**
|
williamr@2
|
72 |
Reads the maximum number of bytes of data from the offset, aPosition into the buffer, aBuffer.
|
williamr@2
|
73 |
Intended for asynchronous usage.
|
williamr@2
|
74 |
|
williamr@2
|
75 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
76 |
|
williamr@2
|
77 |
@param aBuffer
|
williamr@2
|
78 |
The buffer to read the data into.
|
williamr@2
|
79 |
@param aPosition
|
williamr@2
|
80 |
The offset from which to start reading.
|
williamr@2
|
81 |
@param aConsumer
|
williamr@2
|
82 |
The sink of tha data read from the clip. Will be informed of read if not NULL.
|
williamr@2
|
83 |
*/
|
williamr@2
|
84 |
virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) = 0 ;
|
williamr@2
|
85 |
|
williamr@2
|
86 |
/**
|
williamr@2
|
87 |
Writes the maximum number of bytes of data from the offset, aPosition from the buffer, aBuffer.
|
williamr@2
|
88 |
Intended for asynchronous usage.
|
williamr@2
|
89 |
|
williamr@2
|
90 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
91 |
|
williamr@2
|
92 |
@param aBuffer
|
williamr@2
|
93 |
The buffer to write the data into.
|
williamr@2
|
94 |
@param aPosition
|
williamr@2
|
95 |
The offset from which to start writing.
|
williamr@2
|
96 |
@param aSupplier
|
williamr@2
|
97 |
The source of the data writen to the clip. Will be informed of write if not NULL.
|
williamr@2
|
98 |
*/
|
williamr@2
|
99 |
virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) = 0 ;
|
williamr@2
|
100 |
|
williamr@2
|
101 |
//synchronous Read/WriteBufferLs
|
williamr@2
|
102 |
|
williamr@2
|
103 |
/**
|
williamr@2
|
104 |
Reads the maximum number of bytes of data from the offset, aPosition into the buffer, aBuffer.
|
williamr@2
|
105 |
Intended for synchronous usage.
|
williamr@2
|
106 |
|
williamr@2
|
107 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
108 |
|
williamr@2
|
109 |
@param aBuffer
|
williamr@2
|
110 |
The buffer to read the data into.
|
williamr@2
|
111 |
@param aPosition
|
williamr@2
|
112 |
The offset from which to start reading.
|
williamr@2
|
113 |
*/
|
williamr@2
|
114 |
virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition) = 0 ;
|
williamr@2
|
115 |
|
williamr@2
|
116 |
/**
|
williamr@2
|
117 |
Writes the maximum number of bytes of data from the offset, aPosition from the buffer, aBuffer.
|
williamr@2
|
118 |
Intended for synchronous usage.
|
williamr@2
|
119 |
|
williamr@2
|
120 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
121 |
|
williamr@2
|
122 |
@param aBuffer
|
williamr@2
|
123 |
The buffer to write the data into.
|
williamr@2
|
124 |
@param aPosition
|
williamr@2
|
125 |
The offset from which to start writing.
|
williamr@2
|
126 |
*/
|
williamr@2
|
127 |
virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition) = 0 ;
|
williamr@2
|
128 |
|
williamr@2
|
129 |
/**
|
williamr@2
|
130 |
Returns the amount of space available for the clip.
|
williamr@2
|
131 |
|
williamr@2
|
132 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
133 |
|
williamr@2
|
134 |
@return The amount of space available.
|
williamr@2
|
135 |
*/
|
williamr@2
|
136 |
virtual TInt64 BytesFree() = 0 ;
|
williamr@2
|
137 |
|
williamr@2
|
138 |
/**
|
williamr@2
|
139 |
Returns the size of the clip in bytes.
|
williamr@2
|
140 |
|
williamr@2
|
141 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
142 |
|
williamr@2
|
143 |
@return The size of the clip.
|
williamr@2
|
144 |
*/
|
williamr@2
|
145 |
virtual TInt Size() = 0 ;
|
williamr@2
|
146 |
|
williamr@2
|
147 |
/**
|
williamr@2
|
148 |
Deletes the clip.
|
williamr@2
|
149 |
|
williamr@2
|
150 |
This should be overriden in the derived classes, the default version returns KErrNotSupported.
|
williamr@2
|
151 |
|
williamr@2
|
152 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
153 |
another of the system-wide error codes.
|
williamr@2
|
154 |
*/
|
williamr@2
|
155 |
virtual TInt Delete() {return KErrNotSupported;}
|
williamr@2
|
156 |
|
williamr@2
|
157 |
/**
|
williamr@2
|
158 |
Sets the size of the clip. This should be overriden in the derived
|
williamr@2
|
159 |
classes, the default version returns KErrNotSupported.
|
williamr@2
|
160 |
|
williamr@2
|
161 |
@param aSize
|
williamr@2
|
162 |
The size of the clip.
|
williamr@2
|
163 |
|
williamr@2
|
164 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
165 |
another of the system-wide error codes.
|
williamr@2
|
166 |
*/
|
williamr@2
|
167 |
inline virtual TInt SetSize(TInt aSize);
|
williamr@2
|
168 |
|
williamr@2
|
169 |
protected :
|
williamr@2
|
170 |
/**
|
williamr@2
|
171 |
Protected constructor.
|
williamr@2
|
172 |
|
williamr@2
|
173 |
@param aSourceType
|
williamr@2
|
174 |
The source type.
|
williamr@2
|
175 |
@param aSinkType
|
williamr@2
|
176 |
The sink type.
|
williamr@2
|
177 |
*/
|
williamr@2
|
178 |
CMMFClip( TUid aSourceType, TUid aSinkType ) : MDataSource( aSourceType ), MDataSink( aSinkType ) {}
|
williamr@2
|
179 |
} ;
|
williamr@2
|
180 |
|
williamr@2
|
181 |
inline TInt CMMFClip::SetSize(TInt /*aSize*/)
|
williamr@2
|
182 |
{
|
williamr@2
|
183 |
return KErrNotSupported;
|
williamr@2
|
184 |
}
|
williamr@2
|
185 |
|
williamr@2
|
186 |
|
williamr@2
|
187 |
#endif
|