os/mm/mmlibs/mmfw/src/Plugin/StdSourceAndSink/Mmfdes.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
sl@0
    17
#include <f32file.h>
sl@0
    18
#include <e32std.h>
sl@0
    19
#include <mmf/server/mmfdes.h>
sl@0
    20
#include <mmf/server/mmfdatabuffer.h>
sl@0
    21
#include <mmf/common/mmfpaniccodes.h>
sl@0
    22
sl@0
    23
void Panic(TMMFDescriptorPanicCode aPanicCode)
sl@0
    24
	{
sl@0
    25
	_LIT(KMMFDescriptorPanicCategory, "MMFDescriptor");
sl@0
    26
	User::Panic(KMMFDescriptorPanicCategory, aPanicCode);
sl@0
    27
	}
sl@0
    28
sl@0
    29
/**
sl@0
    30
Protected constructor.
sl@0
    31
sl@0
    32
Sets the offset to zero.
sl@0
    33
*/
sl@0
    34
CMMFDescriptor::CMMFDescriptor( ) : CMMFClip( KUidMmfDescriptorSource, KUidMmfDescriptorSink ) 
sl@0
    35
	{
sl@0
    36
	}
sl@0
    37
sl@0
    38
/**
sl@0
    39
Destructor.
sl@0
    40
sl@0
    41
The default implementation closes the descriptor thread.
sl@0
    42
*/
sl@0
    43
CMMFDescriptor::~CMMFDescriptor()
sl@0
    44
	{
sl@0
    45
	iDesThread.Close() ;
sl@0
    46
	}
sl@0
    47
sl@0
    48
/**
sl@0
    49
Constructs a CMMFDescriptor MDataSource.
sl@0
    50
sl@0
    51
@return A pointer to a new CMMFDescriptor.
sl@0
    52
*/
sl@0
    53
MDataSource* CMMFDescriptor::NewSourceL( )
sl@0
    54
	{
sl@0
    55
	CMMFDescriptor* self = new (ELeave) CMMFDescriptor( ) ;
sl@0
    56
	return STATIC_CAST( MDataSource*, self ) ;
sl@0
    57
	}
sl@0
    58
sl@0
    59
/**
sl@0
    60
Constructs a CMMFDescriptor MDataSink.
sl@0
    61
sl@0
    62
@return A pointer to a new CMMFDescriptor.
sl@0
    63
*/
sl@0
    64
MDataSink* CMMFDescriptor::NewSinkL( )
sl@0
    65
	{
sl@0
    66
	CMMFDescriptor* self = new (ELeave) CMMFDescriptor( ) ;
sl@0
    67
	return STATIC_CAST( MDataSink*, self ) ;
sl@0
    68
	}
sl@0
    69
sl@0
    70
/**
sl@0
    71
Performs source construction dependant on the source construction
sl@0
    72
initialisation data aInitData.
sl@0
    73
sl@0
    74
@param  aInitData
sl@0
    75
        The TPckgC<TMMFDescriptorParams> descriptor package containing the descriptor and the thread 
sl@0
    76
        ID for the descriptor.
sl@0
    77
*/
sl@0
    78
void CMMFDescriptor::ConstructSourceL( const TDesC8& aInitData )
sl@0
    79
	{
sl@0
    80
	ConstructL( aInitData ) ;
sl@0
    81
	}
sl@0
    82
sl@0
    83
sl@0
    84
/***
sl@0
    85
Sets how much of the underlying descriptor will be used, up	to the underlying descriptor's maximum
sl@0
    86
length.
sl@0
    87
sl@0
    88
@param  aSize
sl@0
    89
        The size of the descriptor.
sl@0
    90
sl@0
    91
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
sl@0
    92
        another of the system-wide error codes.
sl@0
    93
*/
sl@0
    94
TInt CMMFDescriptor::SetSize( TInt aSize )
sl@0
    95
	{
sl@0
    96
	//[ precondition aSize >= 0
sl@0
    97
	// precondition sSize < MaxSize()
sl@0
    98
	// iDes is not null]
sl@0
    99
	 if(!iDes )
sl@0
   100
		 return KErrNotReady;
sl@0
   101
sl@0
   102
     if( aSize > MaxLength() )
sl@0
   103
		 return KErrOverflow;
sl@0
   104
sl@0
   105
	 if( aSize < 0 )
sl@0
   106
		 return KErrUnderflow;
sl@0
   107
sl@0
   108
	 // [ actually do the work ]
sl@0
   109
	 iDes->SetLength( aSize );
sl@0
   110
sl@0
   111
	 //[ assert the post condition
sl@0
   112
	 // aSize == Length()
sl@0
   113
	 // descriptor is still ok]
sl@0
   114
     ASSERT( aSize == iDes->Length());
sl@0
   115
	 ASSERT( iDes );
sl@0
   116
sl@0
   117
	 return KErrNone;
sl@0
   118
	}
sl@0
   119
sl@0
   120
sl@0
   121
/**
sl@0
   122
Performs sink construction dependant on the sink construction initialisation data aInitData.
sl@0
   123
sl@0
   124
@param  aInitData
sl@0
   125
        The TPckgC<TMMFDescriptorParams> descriptor package containing
sl@0
   126
        the descriptor and the thread ID for the descriptor.
sl@0
   127
*/
sl@0
   128
void CMMFDescriptor::ConstructSinkL( const TDesC8& aInitData )
sl@0
   129
	{
sl@0
   130
	ConstructL( aInitData ) ;
sl@0
   131
	}
sl@0
   132
sl@0
   133
void CMMFDescriptor::ConstructL( const TDesC8& aInitData )
sl@0
   134
	{
sl@0
   135
	TMMFDescriptorParams params;
sl@0
   136
	TPckgC<TMMFDescriptorParams> config(params);
sl@0
   137
	if (aInitData.Length() < config.Length())
sl@0
   138
		User::Leave(KErrGeneral);
sl@0
   139
	config.Set(aInitData);
sl@0
   140
	iDes = STATIC_CAST( TDes8*, config().iDes);
sl@0
   141
	User::LeaveIfError( iDesThread.Open( config().iDesThreadId ) );
sl@0
   142
	}
sl@0
   143
sl@0
   144
sl@0
   145
/** 
sl@0
   146
Loads aBuffer from iDes.
sl@0
   147
sl@0
   148
File read is asynchronous.  CReadRequest is created to respond to completion.
sl@0
   149
sl@0
   150
@param  aBuffer
sl@0
   151
        The buffer to be filled from the descriptor.
sl@0
   152
@param  aConsumer
sl@0
   153
        The data sink consumer of the buffer.
sl@0
   154
@param  aMediaId
sl@0
   155
        Not used.
sl@0
   156
*/
sl@0
   157
void CMMFDescriptor::FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId /*aMediaId*/  ) 
sl@0
   158
	{
sl@0
   159
	// Current position in Descriptor is iOffset.
sl@0
   160
sl@0
   161
	// Read from iDes in iDesThread into Des in aBuffer.
sl@0
   162
sl@0
   163
	// Assume that the amount to be read is the size of the buffer descriptor
sl@0
   164
	// Should check that there is sufficient data in the source buffer
sl@0
   165
	// If there is not enough to fill the target then copy what there is
sl@0
   166
	// How should the function deal with no data in the source buffer?
sl@0
   167
sl@0
   168
	// Use of a single iOffset will preclude use by more than one client (use ReadBufferL())
sl@0
   169
	if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type()))
sl@0
   170
		{
sl@0
   171
		TDes8& bufferDes = STATIC_CAST(CMMFDataBuffer*, aBuffer)->Data();
sl@0
   172
sl@0
   173
		//if request size is set, use it, else use max length of buffer
sl@0
   174
		TInt targetMaxLength = aBuffer->RequestSize() ? aBuffer->RequestSize() : bufferDes.MaxLength();
sl@0
   175
sl@0
   176
		//ensure RequestSize was within bounds
sl@0
   177
		if(targetMaxLength > bufferDes.MaxLength())
sl@0
   178
			targetMaxLength = bufferDes.MaxLength();
sl@0
   179
sl@0
   180
		TInt sourceLengthRemaining = iDes->Length() - iOffset;
sl@0
   181
		if ( ( sourceLengthRemaining - targetMaxLength ) > 0 )
sl@0
   182
			{
sl@0
   183
			bufferDes = iDes->Mid(iOffset,targetMaxLength);
sl@0
   184
			iOffset += targetMaxLength;
sl@0
   185
			}
sl@0
   186
		else if (sourceLengthRemaining > 0)
sl@0
   187
			{
sl@0
   188
			bufferDes = iDes->Mid(iOffset,sourceLengthRemaining);
sl@0
   189
			iOffset += sourceLengthRemaining;
sl@0
   190
			aBuffer->SetLastBuffer(ETrue);
sl@0
   191
			}
sl@0
   192
		else
sl@0
   193
			{
sl@0
   194
			bufferDes.SetLength(0);
sl@0
   195
			aBuffer->SetLastBuffer(ETrue);
sl@0
   196
			}
sl@0
   197
sl@0
   198
		aConsumer->BufferFilledL( aBuffer ) ;
sl@0
   199
		}
sl@0
   200
	else
sl@0
   201
		User::Leave(KErrNotSupported);
sl@0
   202
	}
sl@0
   203
sl@0
   204
/**
sl@0
   205
Empties aBuffer into iDes.
sl@0
   206
sl@0
   207
@param  aBuffer
sl@0
   208
        The buffer to be written to the descriptor.
sl@0
   209
@param  aSupplier
sl@0
   210
        The data source supplier of the buffer.
sl@0
   211
@param  aMediaId
sl@0
   212
        The Media ID.
sl@0
   213
*/
sl@0
   214
void CMMFDescriptor::EmptyBufferL( CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId /*aMediaId*/ )
sl@0
   215
	{
sl@0
   216
	// Does the buffer type need to be checked?
sl@0
   217
sl@0
   218
	// Assume that the amount to be read is the size of the buffer descriptor
sl@0
   219
	// Should check that there is sufficient data in the source buffer
sl@0
   220
	// If there is not enough to fill the target then copy what there is
sl@0
   221
	// How should the function deal with no data in the source buffer?
sl@0
   222
	if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type()))
sl@0
   223
		{
sl@0
   224
		TDes8& bufferDes = STATIC_CAST(CMMFDataBuffer*, aBuffer)->Data();
sl@0
   225
sl@0
   226
		TInt sourceLength = bufferDes.Length() ;	
sl@0
   227
		TInt targetLength = iDes->MaxLength() - iDes->Length();
sl@0
   228
		if ( targetLength>0 )
sl@0
   229
			{
sl@0
   230
			if (sourceLength>targetLength)
sl@0
   231
				{
sl@0
   232
				sourceLength = targetLength;
sl@0
   233
				bufferDes.SetLength(targetLength);
sl@0
   234
				}
sl@0
   235
sl@0
   236
			iDes->Append(bufferDes) ;
sl@0
   237
			}
sl@0
   238
		else
sl@0
   239
			bufferDes.SetLength(0);
sl@0
   240
sl@0
   241
		aSupplier->BufferEmptiedL( aBuffer ) ;
sl@0
   242
		}
sl@0
   243
	else
sl@0
   244
		User::Leave(KErrNotSupported);
sl@0
   245
	}
sl@0
   246
sl@0
   247
/** 
sl@0
   248
Loads aLength number of bytes into aBuffer from specified point in iDes.
sl@0
   249
sl@0
   250
@param  aLength
sl@0
   251
        The number of bytes to be read into buffer.
sl@0
   252
@param  aBuffer
sl@0
   253
        The buffer to be filled from the descriptor.
sl@0
   254
@param  aPosition
sl@0
   255
        The offset into the descriptor at which to start reading.
sl@0
   256
@param  aConsumer
sl@0
   257
        The data sink consumer of the buffer
sl@0
   258
*/
sl@0
   259
void CMMFDescriptor::ReadBufferL(TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer)
sl@0
   260
	{
sl@0
   261
	if (!aBuffer)
sl@0
   262
		User::Leave(KErrArgument);
sl@0
   263
sl@0
   264
	if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type()))
sl@0
   265
		{
sl@0
   266
		TDes8& bufferDes = STATIC_CAST(CMMFDataBuffer*, aBuffer)->Data();
sl@0
   267
sl@0
   268
		if (aLength>bufferDes.MaxLength())
sl@0
   269
			User::Leave(KErrOverflow);
sl@0
   270
sl@0
   271
		if ((aLength<0) || (aPosition<0))
sl@0
   272
			User::Leave(KErrArgument);
sl@0
   273
sl@0
   274
		TInt sourceLength = iDes->Length() ;
sl@0
   275
sl@0
   276
		//ensure not trying to read more than is available
sl@0
   277
		if(aPosition + aLength > sourceLength)
sl@0
   278
			aLength = sourceLength - aPosition;
sl@0
   279
sl@0
   280
		if (aLength>0)
sl@0
   281
			{
sl@0
   282
			TPtrC8 srcPtr(iDes->Mid(aPosition,aLength));
sl@0
   283
			bufferDes.Copy(srcPtr.Ptr(),aLength);
sl@0
   284
			}
sl@0
   285
		else
sl@0
   286
			bufferDes.SetLength(0);
sl@0
   287
sl@0
   288
		//have we read all the available data
sl@0
   289
		if(aPosition + aLength >= sourceLength)
sl@0
   290
			aBuffer->SetLastBuffer(ETrue);
sl@0
   291
sl@0
   292
		if (aConsumer)
sl@0
   293
			aConsumer->BufferFilledL(aBuffer);
sl@0
   294
		}
sl@0
   295
	else
sl@0
   296
		User::Leave(KErrNotSupported);
sl@0
   297
	}
sl@0
   298
sl@0
   299
/**
sl@0
   300
Loads aBuffer from specified point in iDes
sl@0
   301
sl@0
   302
@param  aBuffer
sl@0
   303
        The buffer to be filled from the descriptor.
sl@0
   304
@param  aPosition
sl@0
   305
        The offset into the descriptor at which to start reading.
sl@0
   306
@param  aConsumer
sl@0
   307
        The data sink consumer of the buffer.
sl@0
   308
*/
sl@0
   309
void CMMFDescriptor::ReadBufferL(CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer)
sl@0
   310
	{
sl@0
   311
	if (!aBuffer)
sl@0
   312
		User::Leave(KErrArgument);
sl@0
   313
sl@0
   314
	if (aPosition<0)
sl@0
   315
		User::Leave(KErrArgument);
sl@0
   316
sl@0
   317
	if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type()))
sl@0
   318
		{
sl@0
   319
		TDes8& bufferDes = STATIC_CAST(CMMFDataBuffer*, aBuffer)->Data();
sl@0
   320
		//if request size is set, use it, else use max length of buffer
sl@0
   321
		TUint copyLength = aBuffer->RequestSize() ? aBuffer->RequestSize() : bufferDes.MaxLength();
sl@0
   322
sl@0
   323
		ReadBufferL(copyLength, aBuffer, aPosition, aConsumer);
sl@0
   324
		}
sl@0
   325
	else
sl@0
   326
		User::Leave(KErrNotSupported);
sl@0
   327
	}
sl@0
   328
sl@0
   329
 /** 
sl@0
   330
Loads aBuffer from specified point in iDes.  Note that this is a synchronous read.
sl@0
   331
sl@0
   332
@param  aBuffer
sl@0
   333
        The buffer to be filled from the descriptor.
sl@0
   334
@param  aPosition
sl@0
   335
        The offset into the descriptor at which to start reading.
sl@0
   336
*/
sl@0
   337
void CMMFDescriptor::ReadBufferL(CMMFBuffer* aBuffer, TInt aPosition)
sl@0
   338
	{
sl@0
   339
	ReadBufferL(aBuffer, aPosition, NULL);
sl@0
   340
	}
sl@0
   341
sl@0
   342
/**
sl@0
   343
Empties aBuffer into iDes at specified location.
sl@0
   344
sl@0
   345
@param  aBuffer
sl@0
   346
        The data buffer containing bytes to be written.
sl@0
   347
@param  aPosition
sl@0
   348
        The offset into the descriptor at which to start writing.
sl@0
   349
@param  aSupplier
sl@0
   350
        The data source to be notified when the write has been completed.
sl@0
   351
*/
sl@0
   352
void CMMFDescriptor::WriteBufferL(CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) 
sl@0
   353
	{
sl@0
   354
	if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type()))
sl@0
   355
		{
sl@0
   356
		TDes8& bufferDes = STATIC_CAST(CMMFDataBuffer*, aBuffer)->Data();
sl@0
   357
sl@0
   358
		WriteBufferL(bufferDes.Length(), aBuffer, aPosition, aSupplier);
sl@0
   359
		}
sl@0
   360
	else
sl@0
   361
		User::Leave(KErrNotSupported);
sl@0
   362
	}
sl@0
   363
sl@0
   364
/**
sl@0
   365
Empties aLength bytes from aBuffer into iDes at specified location.
sl@0
   366
sl@0
   367
@param  aLength
sl@0
   368
        The number of bytes to be emptied from buffer.
sl@0
   369
@param  aBuffer
sl@0
   370
        The data buffer containing bytes to be written.
sl@0
   371
@param  aPosition
sl@0
   372
        The offset into the descriptor at which to start writing.
sl@0
   373
@param  aSupplier
sl@0
   374
        The data source to be notified when the write has been completed.
sl@0
   375
sl@0
   376
@leave  KErrNotReady
sl@0
   377
        If SinkPrimeL() and SinkThreadLogon() have not been called.
sl@0
   378
@leave  KErrArgument
sl@0
   379
        If aLength<0 or aPosition<0 or aSupplier is NULL.
sl@0
   380
@leave  KErrNotSupported 
sl@0
   381
        If aBuffer is not of type KMMFDataBuffer.
sl@0
   382
*/
sl@0
   383
void CMMFDescriptor::WriteBufferL(TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier)
sl@0
   384
	{
sl@0
   385
	if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type()))
sl@0
   386
		{
sl@0
   387
		TDes8& bufferDes = STATIC_CAST(CMMFDataBuffer*, aBuffer)->Data();
sl@0
   388
sl@0
   389
		if (aLength>bufferDes.Length() || (aLength<0) || (aPosition<0))
sl@0
   390
			User::Leave(KErrArgument);
sl@0
   391
sl@0
   392
		TInt sourceLength = aLength;
sl@0
   393
		TPtr8 bufferPtr(((sourceLength) ? &bufferDes[0] : NULL), sourceLength, sourceLength);
sl@0
   394
		TInt targetLength = iDes->MaxLength() - aPosition;
sl@0
   395
		if (targetLength>0 && sourceLength > 0)
sl@0
   396
			{
sl@0
   397
			if (sourceLength>targetLength)
sl@0
   398
				User::Leave(KErrOverflow);
sl@0
   399
sl@0
   400
			if ((iDes->Length() - aPosition) > 0)
sl@0
   401
				{
sl@0
   402
				TInt bytesToReplace = iDes->Length() - aPosition;
sl@0
   403
				if (sourceLength > bytesToReplace) 
sl@0
   404
					{
sl@0
   405
					TPtrC8 replaceBuf = bufferPtr.Left(bytesToReplace);
sl@0
   406
					TPtrC8 appendBuf = bufferPtr.Right(sourceLength-bytesToReplace);
sl@0
   407
					iDes->Replace(aPosition, bytesToReplace, replaceBuf);
sl@0
   408
					iDes->Append(appendBuf);
sl@0
   409
					} 
sl@0
   410
				else
sl@0
   411
					iDes->Replace(aPosition, sourceLength, bufferPtr);
sl@0
   412
sl@0
   413
				} 
sl@0
   414
			else
sl@0
   415
				iDes->Append(bufferPtr.Ptr(),sourceLength);
sl@0
   416
			}
sl@0
   417
		else if (targetLength<0)
sl@0
   418
			User::Leave(KErrArgument);
sl@0
   419
		else if (aLength != 0)
sl@0
   420
			User::Leave(KErrOverflow);
sl@0
   421
sl@0
   422
		if (aSupplier)
sl@0
   423
			aSupplier->BufferEmptiedL(aBuffer);
sl@0
   424
		}
sl@0
   425
	else
sl@0
   426
		User::Leave(KErrNotSupported);
sl@0
   427
	}
sl@0
   428
sl@0
   429
/** 
sl@0
   430
Empties aBuffer into iFile at specified location.  Note that this is a synchronous write
sl@0
   431
sl@0
   432
@param  aBuffer
sl@0
   433
        The data buffer containing bytes to be written.
sl@0
   434
@param  aPosition
sl@0
   435
        The offset into file at which to start writing.
sl@0
   436
*/
sl@0
   437
void CMMFDescriptor::WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition)
sl@0
   438
	{
sl@0
   439
	WriteBufferL( aBuffer, aPosition, NULL );
sl@0
   440
	}
sl@0
   441
sl@0
   442
/**
sl@0
   443
Returns the amount of space available for the clip.
sl@0
   444
sl@0
   445
@return The space available in descriptor (difference between length and maxlength).
sl@0
   446
*/
sl@0
   447
TInt64 CMMFDescriptor::BytesFree() 
sl@0
   448
	{
sl@0
   449
	TInt64 length = iDes->Length() ;
sl@0
   450
	TInt64 maxLength =  iDes->MaxLength() ;
sl@0
   451
	return( maxLength - length ) ;
sl@0
   452
	}
sl@0
   453
sl@0
   454
/**
sl@0
   455
Returns the length of the clip.
sl@0
   456
sl@0
   457
@return The length (not max length) of the descriptor.
sl@0
   458
*/
sl@0
   459
TInt CMMFDescriptor::Size() 
sl@0
   460
	{
sl@0
   461
	TInt length = iDes->Length();
sl@0
   462
	return(length);
sl@0
   463
	}
sl@0
   464
sl@0
   465
/**
sl@0
   466
Returns the data type as a fourCC code for the CMMFDescriptor data source.
sl@0
   467
sl@0
   468
@param  aMediaId
sl@0
   469
        The ID of the media for which the codec is obtained.
sl@0
   470
sl@0
   471
@return The data type fourCC code.
sl@0
   472
*/
sl@0
   473
TFourCC CMMFDescriptor::SourceDataTypeCode(TMediaId /*aMediaId*/) 
sl@0
   474
	{
sl@0
   475
	return iSourceFourCC ;
sl@0
   476
	}
sl@0
   477
sl@0
   478
/**
sl@0
   479
Returns the data type as a fourCC code of the CMMFDescriptor data sink.
sl@0
   480
sl@0
   481
Used by MDataSource and MDataSink.
sl@0
   482
sl@0
   483
@return The data type fourCC code.
sl@0
   484
*/
sl@0
   485
TFourCC CMMFDescriptor::SinkDataTypeCode(TMediaId /*aMediaId*/) 
sl@0
   486
	{
sl@0
   487
	return iSinkFourCC ;
sl@0
   488
	}
sl@0
   489
sl@0
   490
/**
sl@0
   491
CMMFDescriptor as a source is always passive so this function is not supported.
sl@0
   492
sl@0
   493
@param  aBuffer
sl@0
   494
        The emptied buffer.
sl@0
   495
*/
sl@0
   496
void CMMFDescriptor::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ )
sl@0
   497
	{
sl@0
   498
	Panic(EMMFDescriptorPanicBufferEmptiedLNotSupported);
sl@0
   499
	}
sl@0
   500
sl@0
   501
/**
sl@0
   502
Tests whether a source buffer can be created.
sl@0
   503
sl@0
   504
@return	A boolean indicating if the buffer can be created. EFalse if a CMMFDescriptor cannot create 
sl@0
   505
        it's own buffer
sl@0
   506
*/
sl@0
   507
TBool CMMFDescriptor::CanCreateSourceBuffer()
sl@0
   508
	{
sl@0
   509
	return EFalse ;
sl@0
   510
	}
sl@0
   511
sl@0
   512
/**
sl@0
   513
Creates a source buffer.
sl@0
   514
sl@0
   515
@param  aMediaId
sl@0
   516
        The Media ID.
sl@0
   517
@param  aReference
sl@0
   518
        A boolean indicating if MDataSource owns the buffer. ETrue if MDataSource owns the buffer,
sl@0
   519
        EFalse if the caller owns the buffer.
sl@0
   520
sl@0
   521
@return	NULL as a CMMFFile cannot create it's own buffer
sl@0
   522
*/
sl@0
   523
CMMFBuffer* CMMFDescriptor::CreateSourceBufferL(  TMediaId /*aMediaId*/, TBool& /*aReference*/ )
sl@0
   524
	{
sl@0
   525
	User::Leave(KErrNotSupported);
sl@0
   526
	return NULL;
sl@0
   527
	}
sl@0
   528
sl@0
   529
/**
sl@0
   530
CMMFDescriptor as a sink is always passive so this function is not supported.
sl@0
   531
sl@0
   532
@param  aBuffer
sl@0
   533
        The filled buffer.
sl@0
   534
*/
sl@0
   535
void CMMFDescriptor::BufferFilledL( CMMFBuffer* /*aBuffer*/ )
sl@0
   536
	{
sl@0
   537
	Panic(EMMFDescriptorPanicBufferFilledLNotSupported);
sl@0
   538
	}
sl@0
   539
sl@0
   540
/**
sl@0
   541
Tests whether a sink buffer can be created.
sl@0
   542
sl@0
   543
@return A boolean indicating if the sink buffer can be created. EFalse if a CMMFDescriptor cannot 
sl@0
   544
        create it's own buffer.
sl@0
   545
*/
sl@0
   546
TBool CMMFDescriptor::CanCreateSinkBuffer()
sl@0
   547
	{
sl@0
   548
	return EFalse ;
sl@0
   549
	}
sl@0
   550
sl@0
   551
/**
sl@0
   552
Creates a sink buffer.
sl@0
   553
sl@0
   554
@param  aMediaId
sl@0
   555
        The Media ID.
sl@0
   556
@param  aReference
sl@0
   557
        A boolean indicating if MDataSource owns the buffer. ETrue if MDataSource owns the buffer,
sl@0
   558
        EFalse if the caller owns the buffer.
sl@0
   559
sl@0
   560
@return	NULL as a CMMFDescriptor cannot create it's own buffer
sl@0
   561
 */
sl@0
   562
CMMFBuffer* CMMFDescriptor::CreateSinkBufferL( TMediaId /*aMediaId*/ , TBool& /*aReference*/)
sl@0
   563
	{
sl@0
   564
	User::Leave(KErrNotSupported);
sl@0
   565
	return NULL;
sl@0
   566
	}