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