h264_enc/arih264enchwdevice/src/arih264enchwdeviceimpl.cpp
author Pat Downey <patd@symbian.org>
Fri, 23 Jul 2010 16:58:44 +0100
changeset 0 bb31fbe78861
permissions -rw-r--r--
Initial commit of Aricent codec contribution.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2009 Aricent and/or its subsidiary(-ies).
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Aricent - initial contribution.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
* Implementation of member functions of H264 encoder plugin class -
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
* CAriH264encHwDeviceImpl.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
*
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
*/
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
// System Includes
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
#include <e32base.h>
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include <avc.h>
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include <e32math.h>
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
// User Includes
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include "arih264enchwdeviceimpl.h"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include "arih264hwdeviceconstants.h"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
#include "arih264encwrapper.h"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
// MACRO DEFINITIONS - start
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
// Uncomment this flag to enable instant rate calculations on-the-fly in urel
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
// builds. In UDEB it is enabled automatically
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
// By default it is commented
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
//#define CALCINSTANTBITRATE
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
// Uncomment to print additional debug information retrieved from
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
// core encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
//#define DEBUG_INFO
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
// MACRO DEFINITIONS - end
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
//  Maps the num/denom from the MDF to the aspect_ratio_idc value supported
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
TInt32 MapAspectRatio( TUint32 aNumerator, TUint32 aDenominator )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
	TInt32 aspectratio = -1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
	switch ( aDenominator )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
		case 1:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
			if ( aNumerator == 1 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
				aspectratio = 1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
		case 11:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
			switch ( aNumerator )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
				case 12:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
					aspectratio = 2;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
				case 10:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
					aspectratio = 3;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
				case 16:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
					aspectratio = 4;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
				case 24:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
					aspectratio = 6;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
				case 20:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
					aspectratio = 7;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
				case 32:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
					aspectratio = 8;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
				case 18:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
					aspectratio = 10;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
				case 15:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
					aspectratio = 11;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
				default:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
		case 33:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
			switch ( aNumerator )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
				case 40:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
					aspectratio = 5;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
				case 80:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
					aspectratio = 9;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
				case 64:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
					aspectratio = 12;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
				default:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
					break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
		case 99:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
			if ( aNumerator == 160 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
				aspectratio = 13;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
		default:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
	return aspectratio;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
//  Two phase constructor for an object of CAriH264encHwDeviceImpl
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
CAriH264encHwDeviceImpl* CAriH264encHwDeviceImpl::NewL()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
    CAriH264encHwDeviceImpl* self = new ( ELeave ) CAriH264encHwDeviceImpl();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
    CleanupStack::PushL( self );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
    self->ConstructL();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
    CleanupStack::Pop( self );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
    return self;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
//  Default constructor
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
CAriH264encHwDeviceImpl::CAriH264encHwDeviceImpl()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
    :iMMFDevVideoRecordProxy( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
     iInputDevice ( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
     iClockSource ( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
	 iInputBufReturnToPreProc( EFalse ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
     iPeriodicTimer ( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
	 iClockTimeWhenPaused( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
	 //100 milli seconds
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
     iPollingInterval(TTimeIntervalMicroSeconds32( KPOLLINGINTERVAL ) ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
     iCodec( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
     iEngine( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
	 iOutputBuffers( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
     iOutputBufferSize( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
     iPauseOffset( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
     iTotalTime( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
     iLastEncodedPictureTimestamp( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
	 iPictureLoss( EFalse ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
	 iInputEndCalled( EFalse ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
	 iFrozen( EFalse ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
	 iTotalLengthFilledSoFarInPacketMode( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
	 iTotalOutputBufferLengthInPacketMode( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
	 iPacketOffSetCurrentPosition( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
	 iPacketOffSetAndLengthInfoBuffers( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
	 iInternalOutputBuffers( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
	 iNumOfBuffersAtClientInPacketModeNeedReAllocation( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
	 iPacketsPending( EFalse ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
	 iNumOfOutBuffersAvailableInPacketModeChange( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
	 iNumofBuffersPendingFromClientInChangeToPacketMode( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
	 iNumOfOutBuffersBeforeChangeToPacketMode( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
	 iCodedBufferForPacketModeChange( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
	 iSegmentBuffers( NULL ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
	 iIsConfigDataFilledInFirstOutputBuffer( EFalse ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
	 iIsSliceEnabledInCodedPicture( EFalse ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
	 iNoOfOutputFramesPerSec( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
	 iSizePerFrame( 0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
	 iEncStateMac( NULL )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
	iSupportedDataUnitTypes = EDuCodedPicture | EDuVideoSegment;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
	iSupportedDataUnitEncapsulations = EDuElementaryStream
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
									   | EDuGenericPayload;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
    // Default values for Init params - full range
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
    TUncompressedVideoFormat inputFormat;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
    inputFormat.iDataFormat = EYuvRawData;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
    inputFormat.iYuvFormat.iCoefficients = EYuvBt709Range1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
    inputFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
    inputFormat.iYuvFormat.iYuv2RgbMatrix = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
    inputFormat.iYuvFormat.iRgb2YuvMatrix = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
    inputFormat.iYuvFormat.iAspectRatioNum = 1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
    inputFormat.iYuvFormat.iAspectRatioDenom = 1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
    iH264EncInitParams.iInputFormat = inputFormat;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
    iH264EncInitParams.iLevel = KH264ENCIMPL_LEVEL_UNKNOWN;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
	iH264EncInitParams.iAfterInitialize = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
    iH264EncInitParams.iOutputFormat        = EH264;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
    iH264EncInitParams.iMinNumOutputBuffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
		= KH264ENCIMPL_MAXNUM_OUTPUTBUFFERS;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
	iH264EncInitParams.iMaxCodedSegmentSize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
		= KH264ENCIMPL_DEFAULT_SEGMENTSIZE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
	iH264EncInitParams.iMaxPictureRate = KH264ENCIMPL_DEFAULT_PICTURERATE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
	// initialize picture counters
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
	iPictureCounters.iPicturesSkippedBufferOverflow = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
	iPictureCounters.iPicturesSkippedProcPower		= 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
	iPictureCounters.iPicturesSkippedRateControl	= 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
	iPictureCounters.iPicturesProcessed				= 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
	iPictureCounters.iInputPictures					= 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
	// default packet mode is off
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
	iH264EncInitParams.iDataEncapsulation 	= EDuElementaryStream;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
    iH264EncInitParams.iDataUnitType		= EDuCodedPicture;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
	iH264EncInitParams.iBitRate = KH264ENCIMPL_DEFAULT_BITRATE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
    iH264EncInitParams.iTargetPictureRate = KH264ENCIMPL_DEFAULT_PICTURERATE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
    iH264EncInitParams.iRandomAccessRate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
		= KH264ENCIMPL_DEFAULT_RANDOMACCESSRATE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
//  Destructor
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
CAriH264encHwDeviceImpl::~CAriH264encHwDeviceImpl()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
	PRINT_MSG( LEVEL_LOW, ( "this is %x", this ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
    iSupportedInputFormats.Close();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
	iLevels.Close();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
    //allocated formats should be deleted before closing
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
    while ( iSupportedOutputFormats.Count() > 0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
        CCompressedVideoFormat* lCompFormat =   iSupportedOutputFormats[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
        iSupportedOutputFormats.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
        delete lCompFormat;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
    iSupportedOutputFormats.Close();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
	// Stop processing
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
	if( !iEncStateMac->IsStopped() && ( !iEncStateMac->IsInDeadState() ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
		if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
			Stop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
	if( iEngine )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
		iEngine->Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
		delete iEngine;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
		iEngine = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
	if( iCodec )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
		delete iCodec;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
		iCodec = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
    //delete output buffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
    iOutputFreeBufferQueue.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
    if( iOutputBuffers )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
		if( iNumOfOutBuffersBeforeChangeToPacketMode )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
			for ( TInt i = 0; i < iNumOfOutBuffersBeforeChangeToPacketMode
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
				; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
				if ( iOutputBuffers[i].iData.Ptr() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
					{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
					delete ( TUint8* )iOutputBuffers[i].iData.Ptr();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
					}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
		else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
			for ( TInt i = 0; i < iH264EncInitParams.iMinNumOutputBuffers;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
				i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
				if ( iOutputBuffers[i].iData.Ptr() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
					{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
					delete ( TUint8* )iOutputBuffers[i].iData.Ptr();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
					}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
		delete []iOutputBuffers;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
        }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
    delete iPeriodicTimer;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
    iPeriodicTimer = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
	if ( iPacketOffSetAndLengthInfoBuffers )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
		for( TInt i = 0; i < KH264ENCIMPL_MAXNUM_TEMPOUTPUTBUFFERS; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
			delete [] ( TUint8* )iPacketOffSetAndLengthInfoBuffers[i];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
		delete []( TUint* )iPacketOffSetAndLengthInfoBuffers;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
    //delete temp output buffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
    iInternalOutputBufferQueue.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
    if( iInternalOutputBuffers )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
        {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
        for ( TInt i = 0; i < KH264ENCIMPL_MAXNUM_TEMPOUTPUTBUFFERS; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
            {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
            if ( iInternalOutputBuffers[i].iData.Ptr() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
                {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
                delete ( TUint8* )iInternalOutputBuffers[i].iData.Ptr();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
                }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
            }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
		delete []iInternalOutputBuffers;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
        }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
	if ( iCodedBufferForPacketModeChange )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
		if ( iCodedBufferForPacketModeChange->iData.Ptr() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
			delete iCodedBufferForPacketModeChange->iData.Ptr();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
		delete iCodedBufferForPacketModeChange;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
	iFreeBufferQueueForPacketOffsetInfo.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
	iFilledBufferQueueForPacketOffsetInfo.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
	//delete the segment buffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
    if( iSegmentBuffers )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
        {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
        for ( TInt i = 0; i < iH264EncInitParams.iMinNumOutputBuffers; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
            {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
            if ( iSegmentBuffers[i].iData.Ptr() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
                {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
                delete ( TUint8* )iSegmentBuffers[i].iData.Ptr();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
                }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
            }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
		delete []iSegmentBuffers;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
        }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
    if ( iConfigData )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
    	delete iConfigData;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
    	iConfigData = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
    if ( iEncStateMac )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
        {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
    	delete iEncStateMac;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
    	iEncStateMac = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
        }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
//  Custom Interface supported by the HwDevice plugin
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
TAny* CAriH264encHwDeviceImpl::CustomInterface( TUid  aInterface )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
	if( aInterface == KH324AnnexKDefinedEncoderConfigDataCIUid )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
		PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
		return ( ( MH324AnnexKDefinedEncoderConfigDataCI* ) this );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
		PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
		return NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   394
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
//  Returns information about this Encoder HW Device
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
CVideoEncoderInfo* CAriH264encHwDeviceImpl::VideoEncoderInfoLC()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
    TSize maxPictureSize = TSize( KH264ENCIMPL_SDTV_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
    		KH264ENCIMPL_SDTV_HEIGHT_PAL );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
    TUint32 maxBitRate = KMAXSUPPBITRATE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
    RArray<TPictureRateAndSize> maxPictureRatesAndSizes;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
    CleanupClosePushL( maxPictureRatesAndSizes );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
    TPictureRateAndSize pictureRateAndSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
    pictureRateAndSize.iPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
    pictureRateAndSize.iPictureSize = TSize( KH264ENCIMPL_QCIF_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
											  KH264ENCIMPL_QCIF_HEIGHT );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
	TInt error = KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
    error = maxPictureRatesAndSizes.Append( pictureRateAndSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   416
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
		PRINT_ERR( "Error while appending maximum picture rate and size" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   421
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   422
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   423
    pictureRateAndSize.iPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
    pictureRateAndSize.iPictureSize = TSize( KH264ENCIMPL_VGA_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
												KH264ENCIMPL_VGA_HEIGHT );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
    error = maxPictureRatesAndSizes.Append( pictureRateAndSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
		PRINT_ERR( "Error while appending maximum picture rate and size" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
    pictureRateAndSize.iPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
    pictureRateAndSize.iPictureSize = TSize( KH264ENCIMPL_CIF_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
											  KH264ENCIMPL_CIF_HEIGHT );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
    error = maxPictureRatesAndSizes.Append( pictureRateAndSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
		PRINT_ERR( "Error while appending maximum picture rate and size" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   444
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   445
    pictureRateAndSize.iPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   446
    pictureRateAndSize.iPictureSize = TSize( KH264ENCIMPL_SQCIF_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   447
											 KH264ENCIMPL_SQCIF_HEIGHT );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
    error = maxPictureRatesAndSizes.Append( pictureRateAndSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
		PRINT_ERR( "Error while appending maximum picture rate and size" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
    pictureRateAndSize.iPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
    pictureRateAndSize.iPictureSize = TSize( KH264ENCIMPL_QVGA_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
											 KH264ENCIMPL_QVGA_HEIGHT );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
    error = maxPictureRatesAndSizes.Append( pictureRateAndSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
		PRINT_ERR( "Error while appending maximum picture rate and size" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
    pictureRateAndSize.iPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
    pictureRateAndSize.iPictureSize = TSize( KH264ENCIMPL_SDTV_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
										 KH264ENCIMPL_HALFSDTV_HEIGHT_NTSC);
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
    error = maxPictureRatesAndSizes.Append( pictureRateAndSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
		PRINT_ERR( "Error while appending maximum picture rate and size" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
    pictureRateAndSize.iPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
    pictureRateAndSize.iPictureSize = TSize( KH264ENCIMPL_SDTV_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
										 KH264ENCIMPL_HALFSDTV_HEIGHT_PAL );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   483
    error = maxPictureRatesAndSizes.Append( pictureRateAndSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
		PRINT_ERR( "Error while appending maximum picture rate and size" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
    pictureRateAndSize.iPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
    pictureRateAndSize.iPictureSize = TSize( KH264ENCIMPL_SDTV_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
											KH264ENCIMPL_SDTV_HEIGHT_NTSC );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
    error = maxPictureRatesAndSizes.Append( pictureRateAndSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
		PRINT_ERR( "Error while appending maximum picture rate and size" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   500
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   501
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
    pictureRateAndSize.iPictureRate = KH264ENCIMPL_PICTURERATE_25;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   504
    pictureRateAndSize.iPictureSize = TSize( KH264ENCIMPL_SDTV_WIDTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
											KH264ENCIMPL_SDTV_HEIGHT_PAL );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   506
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   507
    error = maxPictureRatesAndSizes.Append( pictureRateAndSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
		PRINT_ERR( "Error while appending maximum picture rate and size" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   512
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   513
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
    TUint32 supportedPictureOptions = TVideoPicture::ETimestamp |
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
										TVideoPicture::EReqInstantRefresh;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
	TUint32 supportedDataUnitEncapsulations = EDuElementaryStream |
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
												EDuGenericPayload;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
	TUint32 supportedDataUnitTypes			 = EDuCodedPicture |
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
												EDuVideoSegment;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
    CVideoEncoderInfo* lVideoEncoderInfo = CVideoEncoderInfo::NewL( TUid::
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
										Uid( KUidH264EncoderHwDeviceImplUid ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
										KH264EncManufacturer,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
										KH264EncIdentifier,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
										TVersion( KH264ENCIMPL_MAJOR_VERSION,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
										KH264ENCIMPL_MINOR_VERSION,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   530
										KH264ENCIMPL_BUILD_VERSION ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   531
										// Accelerated
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
										EFalse,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
										// Enc doesnt support direct capture
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
										EFalse,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
										iSupportedInputFormats.Array(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
										iSupportedOutputFormats.Array(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   537
										maxPictureSize,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   538
										supportedDataUnitTypes,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   539
										supportedDataUnitEncapsulations,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   540
										// Max bitrate layers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
										1,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   542
										//aSupportsSupplementalEnhancementInfo
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   543
										EFalse,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   544
										//aMaxUnequalErrorProtectionLevels
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   545
										1,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
										maxBitRate,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   547
										maxPictureRatesAndSizes.Array(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   548
										//aMaxInLayerScalabilitySteps
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
										1,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
										supportedPictureOptions,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   551
										//aSupportsPictureLoss
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   552
										ETrue,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   553
										//aSupportsSliceLoss
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   554
										ETrue,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   555
										//aCodingStandardSpecificInfo
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   556
										KNullDesC8,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   557
										//aImplementationSpecificInfo
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   558
										KNullDesC8 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   559
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   560
    CleanupStack::PopAndDestroy();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   561
    CleanupStack::PushL( lVideoEncoderInfo );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   562
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   563
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   564
    return lVideoEncoderInfo;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   565
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   566
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   567
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   568
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   569
//  Sets the encoder output format
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   570
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   571
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   572
void CAriH264encHwDeviceImpl::SetOutputFormatL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   573
							const CCompressedVideoFormat& aFormat,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   574
							TVideoDataUnitType aDataUnitType,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   575
							TVideoDataUnitEncapsulation aDataEncapsulation,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   576
							TBool aSegmentationAllowed )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   577
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   578
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   579
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   580
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   581
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   582
		PRINT_ERR( "SetOutputFormatL () called before Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   583
        User::Leave( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   584
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   585
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   586
    TInt error = KErrNotFound;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   587
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   588
    TPtrC8 mimeType( aFormat.MimeType() );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   589
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   590
    // Check if format is supported else return KErrNotSupported
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   591
    for ( TInt i = 0; i < iSupportedOutputFormats.Count(); i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   592
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   593
        CCompressedVideoFormat* lFormat = iSupportedOutputFormats[i];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   594
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   595
        if( mimeType.CompareF( lFormat->MimeType() ) == 0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   596
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   597
            iH264EncInitParams.iLevel = iLevels[i];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   598
            error = KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   599
            break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   600
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   601
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   602
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   603
    if( error == KErrNotFound )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   604
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   605
		PRINT_ERR( "CAriH264encHwDeviceImpl::SetOutputFormatL() Leaving"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   606
				   " because of unsupported output mimetype" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   607
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   608
        User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   609
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   610
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   611
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   612
    PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetOutputFormatL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   613
    		"level is set to %d", (TInt)iH264EncInitParams.iLevel ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   614
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   615
    if ( ( ( aDataUnitType != EDuCodedPicture ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   616
    	( aDataUnitType != EDuVideoSegment ) ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   617
		( ( aDataEncapsulation != EDuElementaryStream ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   618
		( aDataEncapsulation != EDuGenericPayload ) ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   619
		( ( aSegmentationAllowed ) ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   620
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   621
		PRINT_ERR( "CAriH264encHwDeviceImpl::SetOutputFormatL() Leaving"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   622
			" because of unsupported data unit type or data unit"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   623
			" encapsulation" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   624
        User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   625
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   626
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   627
    if( aDataUnitType == EDuCodedPicture )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   628
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   629
		PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetOutputFormatL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   630
				"Packet mode is OFF" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   631
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   632
    else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   633
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   634
		PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetOutputFormatL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   635
				"Packet mode is ON" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   636
		// must be calculated from and levels set by the client
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   637
		iH264EncInitParams.iMinNumOutputBuffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   638
					= KH264ENCIMPL_MAXNUM_SEGMENTBUFFERS;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   639
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   640
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   641
    iH264EncInitParams.iDataUnitType = aDataUnitType;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   642
    iH264EncInitParams.iDataEncapsulation = aDataEncapsulation;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   643
    iH264EncInitParams.iSegmentationAllowed = aSegmentationAllowed;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   644
    iH264EncInitParams.iBeforeInitialize |= EEncOutputFormat;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   645
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   646
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   647
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   648
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   649
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   650
//  Sets the pre-processor device that will write data to this encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   651
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   652
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   653
void CAriH264encHwDeviceImpl::SetInputDevice(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   654
										CMMFVideoPreProcHwDevice* aDevice )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   655
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   656
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   657
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   658
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   659
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   660
        ClientFatalError ( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   661
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   662
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   663
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   664
	if( !aDevice )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   665
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   666
        ClientFatalError ( KErrArgument );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   667
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   668
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   669
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   670
    iInputDevice = aDevice;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   671
    iH264EncInitParams.iBeforeInitialize |= EEncInputDevice;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   672
    iInputBufReturnToPreProc			=	 ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   673
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   674
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   675
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   676
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   677
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   678
//  Sets the number of bit-rate scalability layers to use
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   679
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   680
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   681
void CAriH264encHwDeviceImpl::SetNumBitrateLayersL( TUint aNumLayers )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   682
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   683
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   684
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   685
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   686
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   687
		PRINT_ERR( "SetNumBitrateLayersL () called before Initialize"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   688
				"..leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   689
        User::Leave( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   690
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   691
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   692
    if( aNumLayers != 1 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   693
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   694
		PRINT_ERR( "Wrong value passed for aNumLayers... Leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   695
        User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   696
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   697
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   698
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   699
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   700
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   701
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   702
//  Sets the scalability type for a bit-rate scalability layer. Currently not
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   703
//  supported.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   704
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   705
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   706
void CAriH264encHwDeviceImpl::SetScalabilityLayerTypeL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   707
									TUint /*aLayer*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   708
									TScalabilityType /*aScalabilityType*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   709
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   710
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   711
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   712
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   713
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   714
		PRINT_ERR( "SetScalabilityLayerTypeL() called before Initialize"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   715
				"..leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   716
        User::Leave( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   717
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   718
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   719
    PRINT_ERR( "SetScalabilityLayerTypeL() not supported...Leaving with "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   720
    		"KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   721
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   722
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   723
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   724
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   725
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   726
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   727
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   728
//  Sets the reference picture options to be used for all scalability layers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   729
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   730
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   731
void CAriH264encHwDeviceImpl::SetGlobalReferenceOptions(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   732
										TUint aMaxReferencePictures,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   733
										TUint aMaxPictureOrderDelay )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   734
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   735
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   736
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   737
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   738
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   739
        ClientFatalError( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   740
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   741
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   742
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   743
    if( aMaxPictureOrderDelay != 0 || aMaxReferencePictures
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   744
    		> KH264ENCIMPL_MAXNUM_REFERENCEPICTURES )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   745
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   746
        ClientFatalError( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   747
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   748
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   749
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   750
    iH264EncInitParams.iLayerReferenceOptions[0].iMaxReferencePictures
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   751
    	= aMaxReferencePictures;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   752
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   753
    iH264EncInitParams.iLayerReferenceOptions[0].iMaxPictureOrderDelay
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   754
		= aMaxPictureOrderDelay;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   755
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   756
    iH264EncInitParams.iBeforeInitialize |= EEncGlobalRefOptions;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   757
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   758
    PRINT_EXIT
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   759
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   760
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   761
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   762
// Sets the reference picture options to be used for a single scalability
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   763
// layer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   764
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   765
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   766
void CAriH264encHwDeviceImpl::SetLayerReferenceOptions( TUint /*aLayer*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   767
											TUint /*aMaxReferencePictures*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   768
											TUint /*aMaxPictureOrderDelay*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   769
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   770
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   771
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   772
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   773
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   774
        ClientFatalError( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   775
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   776
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   777
	ClientFatalError( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   778
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   779
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   780
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   781
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   782
///---------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   783
// Sets encoder buffering options
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   784
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   785
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   786
void CAriH264encHwDeviceImpl::SetBufferOptionsL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   787
									const TEncoderBufferOptions& aOptions )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   788
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   789
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   790
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   791
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   792
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   793
		PRINT_ERR( "SetBufferOptionsL () called before Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   794
        User::Leave( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   795
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   796
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   797
    PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetBufferOptionsL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   798
    		"iMaxPreEncoderBufferPictures = %d" ,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   799
    		(TInt)aOptions.iMaxPreEncoderBufferPictures ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   800
    PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetBufferOptionsL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   801
    		"iMaxOutputBufferSize = %d",
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   802
    		( TInt ) aOptions.iMaxOutputBufferSize ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   803
    PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetBufferOptionsL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   804
    		"iMaxCodedPictureSize = %d" ,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   805
    		( TInt )aOptions.iMaxCodedPictureSize ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   806
    PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetBufferOptionsL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   807
    		"iHrdVbvSpec = %x", ( TInt ) aOptions.iHrdVbvSpec ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   808
    PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetBufferOptionsL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   809
    		"iMinNumOutputBuffers = %d" ,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   810
    		( TInt ) aOptions.iMinNumOutputBuffers ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   811
    PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetBufferOptionsL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   812
    		"iMaxCodedSegmentSize = %d" ,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   813
			( TInt ) aOptions.iMaxCodedSegmentSize ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   814
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   815
    if( ( aOptions.iMaxPreEncoderBufferPictures == 0 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   816
        ( aOptions.iMaxOutputBufferSize == 0 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   817
        ( aOptions.iMinNumOutputBuffers == 0 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   818
		( aOptions.iHrdVbvSpec == EHrdVbv3GPP ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   819
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   820
		PRINT_ERR( "SetBufferOptionsL () - incorrect parameter passed ..."
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   821
				"leaving with KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   822
        User::Leave ( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   823
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   824
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   825
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   826
	if ( aOptions.iHrdVbvParams != KNullDesC8 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   827
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   828
		if ( aOptions.iHrdVbvSpec == EHrdVbvNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   829
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   830
			PRINT_ERR( "SetBufferOptionsL () - incorrect HrdVbvParams or"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   831
					"iHrdVbvSpec passed ...leaving with KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   832
   			User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   833
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   834
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   835
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   836
		TPckgBuf <TAvcPictureHeader> params;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   837
		params.Copy ( aOptions.iHrdVbvParams );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   838
		TUint size = sizeof( TAvcPictureHeader );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   839
		if ( size != aOptions.iHrdVbvParams.Length() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   840
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   841
			PRINT_ERR( "CAriH264encHwDeviceImpl::SetBufferOptionsL() -"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   842
					   "invalid structure passed for iHrdVbvParams" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   843
			User::Leave( KErrArgument );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   844
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   845
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   846
		// Perform the checks on the members of
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   847
		if( ( params().iBaselineProfileConstraintSet == ( TBool )EFalse ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   848
            ( params().iMainProfileConstraintSet == ( TBool )ETrue ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   849
            ( params().iExtendedProfileConstraintSet == ( TBool )ETrue ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   850
            ( ( params().iPictureType ) & EAvcPictureTypeB ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   851
			( ( params().iPictureType ) & EAvcPictureTypeSI ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   852
			( ( params().iPictureType ) & EAvcPictureTypeSP ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   853
			( params().iLongTermPicture == ( TBool )ETrue ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   854
			( params().iFrame == ( TBool )EFalse ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   855
			( params().iQPY < 10 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   856
			( params().iQPY > 51 ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   857
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   858
			PRINT_ERR( "CAriH264encHwDeviceImpl ::SetBufferOptionsL Invalid "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   859
					"data passed in TAVCHrdParams" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   860
			User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   861
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   862
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   863
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   864
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   865
    iH264EncInitParams.iMaxPreEncoderBufferPictures
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   866
				= aOptions.iMaxPreEncoderBufferPictures;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   867
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   868
    iH264EncInitParams.iMaxOutputBufferSize = aOptions.iMaxOutputBufferSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   869
    iH264EncInitParams.iMaxCodedPictureSize = aOptions.iMaxCodedPictureSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   870
    iH264EncInitParams.iMaxCodedSegmentSize = aOptions.iMaxCodedSegmentSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   871
    iH264EncInitParams.iMinNumOutputBuffers = aOptions.iMinNumOutputBuffers;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   872
    iH264EncInitParams.iBeforeInitialize |= EEncBufferOptions;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   873
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   874
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   875
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   876
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   877
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   878
// Sets the encoder output rectangle
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   879
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   880
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   881
void CAriH264encHwDeviceImpl::SetOutputRectL( const TRect& aRect )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   882
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   883
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   884
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   885
    if( ( aRect.iTl.iX >= aRect.iBr.iX ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   886
        ( aRect.iTl.iY >= aRect.iBr.iY ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   887
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   888
		PRINT_ERR( " Invalid parameteres passed..Leaving " );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   889
        User::Leave ( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   890
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   891
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   892
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   893
    iH264EncInitParams.iOutputRect = aRect;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   894
    iH264EncInitParams.iBeforeInitialize |= EEncOutputRectSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   895
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   896
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   897
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   898
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   899
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   900
// Sets whether bit errors or packets losses can be expected in the video
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   901
// transmission
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   902
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   903
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   904
void CAriH264encHwDeviceImpl::SetErrorsExpected( TBool aBitErrors,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   905
												TBool aPacketLosses )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   906
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   907
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   908
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   909
    // This can bel called before and after initialize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   910
	 PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetErrorsExpected()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   911
			 " BitErrors is set to [ %d ]", aBitErrors ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   912
	 PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::SetErrorsExpected() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   913
			 "iPacketLosses is set to [ %d ]", aPacketLosses ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   914
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   915
	if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   916
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   917
	    iCurSetH264EncParams.iBitErrors       =   aBitErrors;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   918
	    iCurSetH264EncParams.iPacketLosses    =   aPacketLosses;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   919
		iCurSetH264EncParams.iAfterInitialize |= EEncErrorsExpected;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   920
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   921
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   922
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   923
	    iH264EncInitParams.iBitErrors       =   aBitErrors;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   924
	    iH264EncInitParams.iPacketLosses    =   aPacketLosses;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   925
		iH264EncInitParams.iBeforeInitialize |= EEncErrorsExpected;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   926
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   927
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   928
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   929
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   930
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   931
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   932
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   933
// Sets the minimum frequency (in time) for instantaneous random access points
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   934
// in the bitstream
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   935
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   936
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   937
void CAriH264encHwDeviceImpl::SetMinRandomAccessRate( TReal aRate )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   938
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   939
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   940
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   941
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   942
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   943
		// simply return no further action is taken
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   944
		if( aRate <= 0.0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   945
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   946
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   947
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   948
		iCurSetH264EncParams.iRandomAccessRate = aRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   949
		PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   950
				"::SetMinRandomAccessRate() iRandomAccessRate is %f" ,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   951
				( TReal )iH264EncInitParams.iRandomAccessRate ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   952
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   953
		iCurSetH264EncParams.iAfterInitialize |= EEncRandomAccessRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   954
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   955
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   956
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   957
		if( aRate <= 0.0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   958
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   959
			ClientFatalError ( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   960
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   961
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   962
		iH264EncInitParams.iRandomAccessRate = aRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   963
		PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   964
				"::SetMinRandomAccessRate() iRandomAccessRate is %f" ,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   965
				( TReal )iH264EncInitParams.iRandomAccessRate ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   966
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   967
		iH264EncInitParams.iBeforeInitialize |= EEncRandomAccessRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   968
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   969
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   970
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   971
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   972
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   973
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   974
//  Sets coding-standard specific encoder options.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   975
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   976
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   977
void CAriH264encHwDeviceImpl::SetCodingStandardSpecificOptionsL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   978
											const TDesC8& aOptions )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   979
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   980
    PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   981
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   982
	if ( aOptions == KNullDesC8 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   983
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   984
		PRINT_ERR( "CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   985
				"::SetCodingStandardSpecificOptionsL() Leaving because Null "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   986
				"Descriptor Passed" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   987
		User::Leave( KErrArgument );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   988
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   989
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   990
	// validate the parameters
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   991
	TPckgBuf<TAvcVideoMode> avcVideoMode;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   992
	TUint size = sizeof( TAvcVideoMode );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   993
	if ( size != aOptions.Length() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   994
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   995
		PRINT_MSG( LEVEL_HIGH, ( "CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   996
		"::SetCodingStandardSpecificOptionsL() - invalid structure passed") );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   997
		User::Leave( KErrArgument );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   998
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   999
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1000
	// before init
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1001
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1002
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1003
     	iH264EncInitParams.iCodingStandardSpecificOptions = avcVideoMode();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1004
		iH264EncInitParams.iBeforeInitialize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1005
			|= EEncCodingStandardSpecificOptions;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1006
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1007
	avcVideoMode.Copy( aOptions );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1008
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1009
	if ( ( avcVideoMode().iAllowedPictureTypes & EAvcPictureTypeB ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1010
		 ( avcVideoMode().iAllowedPictureTypes & EAvcPictureTypeSI ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1011
		 ( avcVideoMode().iAllowedPictureTypes & EAvcPictureTypeSP ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1012
		 ( avcVideoMode().iFlexibleMacroblockOrder ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1013
		 ( avcVideoMode().iRedundantPictures ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1014
		 ( avcVideoMode().iDataPartitioning ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1015
		 ( !avcVideoMode().iFrameMBsOnly ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1016
		 ( avcVideoMode().iMBAFFCoding ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1017
		 ( avcVideoMode().iEntropyCodingCABAC ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1018
		 ( avcVideoMode().iWeightedPPrediction ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1019
		 ( avcVideoMode().iWeightedBipredicitonMode ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1020
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1021
		PRINT_ERR( "CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1022
			"::SetCodingStandardSpecificOptionsL() - leaving invalid data "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1023
			"passed for TAvcVideoMode" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1024
		User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1025
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1026
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1027
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1028
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1029
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1030
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1031
//  Sets coding-standard specific encoder options.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1032
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1033
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1034
void CAriH264encHwDeviceImpl::SetImplementationSpecificEncoderOptionsL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1035
												const TDesC8& /*aOptions*/)
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1036
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1037
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1038
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1039
    //This API can be called at any point of time
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1040
	PRINT_ERR( "SetImplementationSpecificEncoderOptionsL () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1041
			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1042
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1043
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1044
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1045
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1046
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1047
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1048
//  Returns coding-standard specific initialization output from the encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1049
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1050
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1051
HBufC8* CAriH264encHwDeviceImpl::CodingStandardSpecificInitOutputLC()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1052
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1053
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1054
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1055
    TUint configlength;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1056
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1057
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1058
    	PRINT_ERR( "CodingStandardSpecificInitOutputLC () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1059
    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1060
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1061
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1062
    TUint err = iCodec->GetParam( CONTROL_CMD_GET_CONFIG_LENGTH,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1063
							   &configlength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1064
    if ( err )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1065
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1066
    	PRINT_ERR("GetParam failure");
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1067
    	User::Leave( err );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1068
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1069
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1070
    iConfigData = HBufC8::NewL( configlength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1071
    err = iCodec->GetParam( CONTROL_CMD_GET_CONFIG_HEADER, iConfigData );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1072
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1073
    if ( err )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1074
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1075
    	PRINT_ERR("GetParam failure");
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1076
        User::Leave( err );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1077
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1078
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1079
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1080
    return iConfigData;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1081
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1082
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1083
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1084
//  Returns coding-standard specific initialization output from the encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1085
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1086
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1087
HBufC8* CAriH264encHwDeviceImpl::ImplementationSpecificInitOutputLC()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1088
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1089
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1090
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1091
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1092
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1093
    	PRINT_ERR( "ImplementationSpecificInitOutputLC () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1094
    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1095
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1096
        return NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1097
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1098
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1099
	PRINT_ERR( "ImplementationSpecificInitOutputLC () not supported...leaving"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1100
			"with KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1101
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1102
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1103
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1104
    return NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1105
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1106
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1107
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1108
// Sets the number of unequal error protection levels
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1109
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1110
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1111
void CAriH264encHwDeviceImpl::SetErrorProtectionLevelsL(TUint /*aNumLevels*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1112
												TBool /*aSeparateBuffers*/)
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1113
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1114
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1115
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1116
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1117
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1118
    	PRINT_ERR( "SetErrorProtectionLevelsL () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1119
    	    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1120
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1121
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1122
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1123
	PRINT_ERR( "SetErrorProtectionLevelsL() not supported...leaving"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1124
			"with KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1125
	User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1126
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1127
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1128
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1129
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1130
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1131
// Sets the number of unequal error protection levels
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1132
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1133
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1134
void CAriH264encHwDeviceImpl::SetErrorProtectionLevelL( TUint /*aLevel*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1135
													   TUint /*aBitrate*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1136
													   TUint /*aStrength*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1137
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1138
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1139
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1140
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1141
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1142
    	PRINT_ERR( "SetErrorProtectionLevelsL () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1143
    	    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1144
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1145
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1146
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1147
	PRINT_ERR( "SetErrorProtectionLevelsL() not supported...leaving"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1148
			"with KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1149
	User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1150
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1151
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1152
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1153
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1154
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1155
//  Sets the expected or prevailing channel conditions for an unequal
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1156
//  error protection level, in terms of expected packet loss rate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1157
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1158
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1159
void CAriH264encHwDeviceImpl::SetChannelPacketLossRate( TUint /*aLevel*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1160
							TReal /*aLossRate*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1161
							TTimeIntervalMicroSeconds32 /*aLossBurstLength*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1162
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1163
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1164
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1165
    if ( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1166
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1167
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1168
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1169
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1170
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1171
	//packet mode is already enabled
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1172
	if ( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1173
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1174
		PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1175
		" ::SetChannelPacketLossRate()- already in packet mode returning" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1176
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1177
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1178
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1179
	// Flush the output buffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1180
	iEngine->ReturnOutputBuffers();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1181
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1182
	// output buffers status
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1183
	iNumOfOutBuffersAvailableInPacketModeChange
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1184
						= iOutputFreeBufferQueue.Count();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1185
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1186
	iNumofBuffersPendingFromClientInChangeToPacketMode
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1187
				= iH264EncInitParams.iMinNumOutputBuffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1188
				- iOutputFreeBufferQueue.Count();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1189
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1190
	iNumOfOutBuffersBeforeChangeToPacketMode
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1191
			= iH264EncInitParams.iMinNumOutputBuffers;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1192
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1193
	TInt error = KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1194
	// some buffers are available
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1195
	if ( iNumOfOutBuffersAvailableInPacketModeChange )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1196
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1197
			while( iOutputFreeBufferQueue.Count() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1198
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1199
				// add to engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1200
				iEngine->AddOutput( iOutputFreeBufferQueue[0] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1201
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1202
				// remove this buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1203
				iOutputFreeBufferQueue.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1204
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1205
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1206
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1207
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1208
		// create one buffer which can hold one encoded picture
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1209
		TRAP( error, CreateCodedBufferForModeChangeL() );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1210
		if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1211
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1212
			ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1213
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1214
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1215
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1216
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1217
	iH264EncInitParams.iMaxCodedSegmentSize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1218
				= KH264ENCIMPL_DEFAULT_SEGMENTSIZE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1219
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1220
	// Get the maximum output buffer size for the encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1221
	TUint maxOutputBufferSize =0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1222
	error = iCodec->GetParam( CONTROL_CMD_GET_MAX_FRAME_SIZE,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1223
										&maxOutputBufferSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1224
	if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1225
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1226
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1227
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1228
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1229
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1230
	iH264EncInitParams.iMinNumOutputBuffers = ( maxOutputBufferSize /
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1231
							iH264EncInitParams.iMaxCodedSegmentSize ) *
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1232
							KH264ENCIMPL_MAXNUM_OUTPUTBUFFERS;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1233
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1234
	TRAP( error, CreateSegmentOutputBuffersL (
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1235
								iH264EncInitParams.iMinNumOutputBuffers,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1236
								iH264EncInitParams.iMaxCodedSegmentSize ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1237
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1238
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1239
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1240
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1241
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1242
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1243
	error = iCodec->GetParam( CONTROL_CMD_GET_MAX_NUM_PACKETS,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1244
											&iMaxNumOfPackets );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1245
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1246
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1247
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1248
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1249
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1250
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1251
	TRAP( error, CreatePacketOffsetLengthInfoBuffersL( iMaxNumOfPackets ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1252
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1253
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1254
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1255
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1256
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1257
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1258
	TBool yesorno = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1259
	error = iCodec->SetParam( CONTROL_CMD_SET_PACKET_MODE, &yesorno );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1260
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1261
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1262
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1263
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1264
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1265
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1266
	// change output mode to videosegment
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1267
	iH264EncInitParams.iDataUnitType = EDuVideoSegment;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1268
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1269
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1270
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1271
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1272
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1273
//  Sets the expected or prevailing channel conditions for an unequal error
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1274
//  protection level, in terms of expected bit error rate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1275
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1276
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1277
void CAriH264encHwDeviceImpl::SetChannelBitErrorRate( TUint /*aLevel*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1278
								TReal aErrorRate, TReal /*aStdDeviation*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1279
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1280
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1281
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1282
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1283
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1284
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1285
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1286
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1287
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1288
    // ignore the negative and 0 error rate values - #AANV-6QSC9N
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1289
    if ( aErrorRate < 0.0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1290
        {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1291
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1292
        }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1293
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1294
	TReal* bitErrorRate = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1295
	TRAPD( error , bitErrorRate = new( ELeave )TReal );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1296
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1297
	if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1298
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1299
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1300
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1301
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1302
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1303
    *bitErrorRate = aErrorRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1304
    TRAP( error, iEngine->AddCommandL( CBaseEngine::EHighPriority,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1305
    		CONTROL_CMD_SET_CHANNEL_BIT_ERROR_RATE, bitErrorRate ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1306
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1307
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1308
		delete bitErrorRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1309
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1310
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1311
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1312
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1313
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1314
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1315
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1316
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1317
//  Sets the target size of each coded video segment
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1318
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1319
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1320
void CAriH264encHwDeviceImpl::SetSegmentTargetSize( TUint aLayer,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1321
												TUint aSizeBytes,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1322
												TUint /*aSizeMacroblocks*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1323
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1324
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1325
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1326
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1327
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1328
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1329
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1330
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1331
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1332
   if ( iH264EncInitParams.iDataUnitType == EDuCodedPicture )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1333
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1334
		if( aSizeBytes== 0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1335
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1336
			if( iIsSliceEnabledInCodedPicture )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1337
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1338
				iIsSliceEnabledInCodedPicture= EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1339
				TInt error = iCodec->SetParam( CONTROL_CMD_SET_FRAME_MODE,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1340
												NULL );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1341
				if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1342
					{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1343
					ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1344
					return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1345
					}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1346
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1347
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1348
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1349
		TUint calculatedSegmentSize = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1350
		if( aSizeBytes <= KH264ENCIMPL_MIN_SLICESIZE )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1351
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1352
			calculatedSegmentSize = KH264ENCIMPL_MIN_SLICESIZE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1353
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1354
		else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1355
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1356
			if ( iH264EncInitParams.iMaxCodedSegmentSize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1357
					< iH264EncInitParams.iMaxCodedPictureSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1358
	            {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1359
			    if ( aSizeBytes > iH264EncInitParams.iMaxCodedSegmentSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1360
				    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1361
				    calculatedSegmentSize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1362
						= iH264EncInitParams.iMaxCodedSegmentSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1363
				    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1364
			    else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1365
				    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1366
				    calculatedSegmentSize = aSizeBytes;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1367
				    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1368
	            }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1369
		    else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1370
			    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1371
			    if ( aSizeBytes < iH264EncInitParams.iMaxCodedPictureSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1372
				    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1373
				    calculatedSegmentSize = aSizeBytes;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1374
				    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1375
			    else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1376
				    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1377
				    return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1378
				    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1379
			    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1380
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1381
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1382
        if( calculatedSegmentSize < KH264ENCIMPL_MIN_SLICESIZE )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1383
        	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1384
        	calculatedSegmentSize = KH264ENCIMPL_MIN_SLICESIZE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1385
        	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1386
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1387
        TBool yesorno = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1388
        TInt error = iCodec->SetParam( CONTROL_CMD_SET_PACKET_MODE,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1389
										&yesorno );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1390
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1391
		if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1392
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1393
			ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1394
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1395
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1396
			// Set the target size on codec
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1397
		error = iCodec->SetParam( CONTROL_CMD_SET_PACKET_SIZE,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1398
									&calculatedSegmentSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1399
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1400
		if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1401
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1402
			ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1403
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1404
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1405
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1406
				"::calculatedSegmentSize()  is  %d" ,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1407
				( TInt )calculatedSegmentSize ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1408
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1409
	    iH264EncInitParams.iMaxCodedSegmentSize = calculatedSegmentSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1410
		iIsSliceEnabledInCodedPicture = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1411
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1412
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1413
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1414
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1415
	if ( iH264EncInitParams.iDataUnitType != EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1416
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1417
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1418
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1419
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1420
    // aLayer should be zero since layered bit-rate scalability is not used.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1421
    if ( aLayer != 0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1422
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1423
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1424
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1425
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1426
	TUint calculatedSegmentSize = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1427
	// if value < 0 or > iMaxOutputBufferSize the adjust this value
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1428
	if ( aSizeBytes < KH264ENCIMPL_MIN_SEGMENTSIZE )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1429
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1430
		calculatedSegmentSize  = KH264ENCIMPL_MIN_SEGMENTSIZE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1431
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1432
    else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1433
        {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1434
        if ( iH264EncInitParams.iMaxOutputBufferSize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1435
						> KH264ENCIMPL_MAX_SEGMENTSIZE )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1436
            {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1437
		    if ( aSizeBytes < KH264ENCIMPL_MAX_SEGMENTSIZE )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1438
			    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1439
			    calculatedSegmentSize = aSizeBytes;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1440
			    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1441
		    else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1442
			    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1443
			    calculatedSegmentSize = KH264ENCIMPL_MAX_SEGMENTSIZE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1444
			    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1445
            }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1446
	    else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1447
		    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1448
		    if ( aSizeBytes < iH264EncInitParams.iMaxOutputBufferSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1449
			    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1450
			    calculatedSegmentSize = aSizeBytes;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1451
			    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1452
		    else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1453
			    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1454
			    calculatedSegmentSize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1455
					= iH264EncInitParams.iMaxOutputBufferSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1456
			    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1457
		    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1458
        }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1459
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1460
	// Set the target size on codec
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1461
	TInt error = iCodec->SetParam( CONTROL_CMD_SET_PACKET_SIZE,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1462
											&calculatedSegmentSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1463
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1464
	if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1465
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1466
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1467
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1468
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1469
    iH264EncInitParams.iMaxCodedSegmentSize = calculatedSegmentSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1470
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1471
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1472
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1473
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1474
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1475
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1476
// Sets the bit-rate control options for a layer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1477
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1478
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1479
void CAriH264encHwDeviceImpl::SetRateControlOptions( TUint aLayer,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1480
								const TRateControlOptions& aOptions )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1481
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1482
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1483
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1484
	if ( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1485
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1486
		ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1487
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1488
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1489
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1490
	// Since layered bit-rate scalability is not used, options are set for the
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1491
	// entire stream
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1492
	if ( aLayer != 0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1493
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1494
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1495
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1496
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1497
	if ( ( aOptions.iPictureRate <= 0 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1498
			( aOptions.iControl & EBrControlPicture ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1499
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1500
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1501
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1502
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1503
	if ( aOptions.iControl & EBrControlStream )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1504
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1505
		if ( ( aOptions.iQualityTemporalTradeoff < 0 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1506
			( aOptions.iQualityTemporalTradeoff > 1 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1507
			( aOptions.iLatencyQualityTradeoff < 0 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1508
			( aOptions.iLatencyQualityTradeoff > 1 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1509
			( aOptions.iBitrate == 0 ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1510
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1511
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1512
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1513
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1514
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1515
	TRateControlOptions* rateControlOptions = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1516
	TRAPD( error, rateControlOptions = new ( ELeave )TRateControlOptions );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1517
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1518
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1519
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1520
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1521
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1522
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1523
	rateControlOptions->iControl  =  aOptions.iControl;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1524
	// default bit rate used
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1525
	if( aOptions.iControl & EBrControlNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1526
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1527
		rateControlOptions->iBitrate    =  iH264EncInitParams.iBitRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1528
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1529
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1530
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1531
		rateControlOptions->iBitrate = ( aOptions.iBitrate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1532
		<= iH264EncInitParams.iBitRate ) ? ( aOptions.iBitrate )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1533
		: ( iH264EncInitParams.iBitRate );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1534
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1535
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1536
	rateControlOptions->iPictureQuality  =  aOptions.iPictureQuality;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1537
	rateControlOptions->iPictureRate     =  aOptions.iPictureRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1538
	rateControlOptions->iQualityTemporalTradeoff
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1539
				= aOptions.iQualityTemporalTradeoff;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1540
	rateControlOptions->iLatencyQualityTradeoff
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1541
				= aOptions.iLatencyQualityTradeoff;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1542
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1543
	TRAP( error, iEngine->AddCommandL( CBaseEngine::EHighPriority,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1544
			CONTROL_CMD_SET_RATE_CONTROL_OPTIONS, rateControlOptions ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1545
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1546
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1547
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1548
		delete rateControlOptions;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1549
		ClientFatalError ( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1550
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1551
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1552
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1553
	if( !iEncStateMac->IsPlaying() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1554
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1555
		TInt ret =  iCodec->SetParam( CONTROL_CMD_SET_RATE_CONTROL_OPTIONS,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1556
														rateControlOptions );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1557
		if ( ret )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1558
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1559
			ClientFatalError( ret );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1560
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1561
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1562
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1563
	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetRateControlOptions()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1564
			"iBitrate is %d", ( TInt )aOptions.iBitrate ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1565
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1566
	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetRateControlOptions()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1567
			"iPictureQuality is %d" , ( TInt )aOptions.iPictureQuality ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1568
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1569
	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetRateControlOptions()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1570
			" iPictureRate is %f", ( TReal )aOptions.iPictureRate ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1571
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1572
	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetRateControlOptions()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1573
			"iQualityTemporalTradeoff is %f" ,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1574
			( TReal )aOptions.iQualityTemporalTradeoff ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1575
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1576
	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetRateControlOptions()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1577
			" iLatencyQualityTradeoff is %f " ,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1578
			( TReal ) aOptions.iLatencyQualityTradeoff ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1579
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1580
	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetRateControlOptions()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1581
			"iControl is %x" , ( TInt ) aOptions.iControl ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1582
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1583
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1584
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1585
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1586
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1587
// Sets in-layer scalability options for a layer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1588
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1589
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1590
void CAriH264encHwDeviceImpl::SetInLayerScalabilityL( TUint /*aLayer*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1591
								TUint /*aNumSteps*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1592
								TInLayerScalabilityType /*aScalabilityType*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1593
								const TArray<TUint>& /*aBitrateShare*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1594
								const TArray<TUint>& /*aPictureShare*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1595
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1596
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1597
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1598
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1599
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1600
    	PRINT_ERR( "SetInLayerScalabilityL () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1601
    	    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1602
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1603
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1604
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1605
	PRINT_ERR( "SetInLayerScalabilityL () not supported..leaving with "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1606
	    			"KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1607
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1608
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1609
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1610
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1611
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1612
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1613
// Sets the period for layer promotions points for a scalability layer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1614
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1615
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1616
void CAriH264encHwDeviceImpl::SetLayerPromotionPointPeriod( TUint /*aLayer*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1617
														TUint /*aPeriod*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1618
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1619
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1620
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1621
    if ( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1622
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1623
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1624
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1625
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1626
    ClientFatalError( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1627
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1628
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1629
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1630
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1631
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1632
// Returns coding-standard specific settings output from the encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1633
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1634
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1635
HBufC8* CAriH264encHwDeviceImpl::CodingStandardSpecificSettingsOutputLC()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1636
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1637
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1638
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1639
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1640
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1641
    	PRINT_ERR( "CodingStandardSpecificSettingsOutputLC () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1642
    	    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1643
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1644
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1645
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1646
	PRINT_ERR( "CodingStandardSpecificSettingsOutputLC () not supported.."
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1647
			"leaving with KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1648
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1649
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1650
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1651
    return NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1652
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1653
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1654
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1655
// Returns implementation-specific settings output from the encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1656
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1657
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1658
HBufC8* CAriH264encHwDeviceImpl::ImplementationSpecificSettingsOutputLC()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1659
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1660
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1661
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1662
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1663
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1664
    	PRINT_ERR( "ImplementationSpecificSettingsOutputLC () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1665
    	    	    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1666
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1667
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1668
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1669
	PRINT_ERR( "ImplementationSpecificSettingsOutputLC () not supported.."
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1670
			"leaving with KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1671
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1672
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1673
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1674
    return NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1675
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1676
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1677
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1678
// Requests the encoder to sends supplemental information in the bitstream
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1679
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1680
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1681
void CAriH264encHwDeviceImpl::SendSupplementalInfoL( const TDesC8& /*aData*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1682
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1683
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1684
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1685
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1686
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1687
    	PRINT_ERR( "SendSupplementalInfoL () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1688
    	    	    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1689
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1690
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1691
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1692
	PRINT_ERR( "SendSupplementalInfoL () not supported.."
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1693
			"leaving with KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1694
	User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1695
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1696
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1697
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1698
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1699
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1700
// Requests the encoder to sends supplemental information in the bitstream
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1701
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1702
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1703
void CAriH264encHwDeviceImpl::SendSupplementalInfoL( const TDesC8& /*aData*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1704
							const TTimeIntervalMicroSeconds& /*aTimestamp*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1705
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1706
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1707
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1708
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1709
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1710
    	PRINT_ERR( "SendSupplementalInfoL () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1711
    	    	    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1712
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1713
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1714
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1715
	PRINT_ERR( "SendSupplementalInfoL () not supported.."
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1716
			"leaving with KErrNotSupported" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1717
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1718
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1719
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1720
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1721
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1722
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1723
// Cancels the current supplemental information send request
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1724
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1725
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1726
void CAriH264encHwDeviceImpl::CancelSupplementalInfo()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1727
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1728
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1729
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1730
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1731
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1732
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1733
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1734
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1735
    ClientFatalError( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1736
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1737
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1738
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1739
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1740
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1741
// Gets the current output buffer status. The information includes
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1742
// the number of free output buffers and the total size of free buffers in
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1743
// bytes.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1744
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1745
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1746
void CAriH264encHwDeviceImpl::GetOutputBufferStatus( TUint& aNumFreeBuffers,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1747
													TUint& aTotalFreeBytes )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1748
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1749
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1750
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1751
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1752
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1753
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1754
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1755
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1756
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1757
    aNumFreeBuffers = iEngine->NumOutputBuffers()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1758
						+ iOutputFreeBufferQueue.Count();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1759
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1760
    aTotalFreeBytes = aNumFreeBuffers * iOutputBufferSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1761
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1762
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1763
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1764
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1765
// Returns a used output buffer back to the encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1766
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1767
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1768
void CAriH264encHwDeviceImpl::ReturnBuffer( TVideoOutputBuffer* aBuffer )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1769
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1770
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1771
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1772
    if ( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1773
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1774
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1775
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1776
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1777
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1778
	if ( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1779
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1780
		// coded picture buffers so add it to Interanal Q or process engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1781
		if ( iNumofBuffersPendingFromClientInChangeToPacketMode )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1782
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1783
			iEngine->AddOutput( aBuffer );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1784
			--iNumofBuffersPendingFromClientInChangeToPacketMode;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1785
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1786
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1787
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1788
		// buffers returned by the client are
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1789
		if ( iNumOfBuffersAtClientInPacketModeNeedReAllocation )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1790
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1791
			TRAPD( error, ReallocateSegmentBufferL( aBuffer ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1792
			if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1793
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1794
				ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1795
				return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1796
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1797
			iNumOfBuffersAtClientInPacketModeNeedReAllocation--;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1798
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1799
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1800
		TInt error = KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1801
		error = iOutputFreeBufferQueue.Append( aBuffer );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1802
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1803
		if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1804
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1805
			ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1806
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1807
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1808
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1809
		if ( !iPacketsPending )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1810
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1811
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1812
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1813
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1814
		// still has packets in temporary buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1815
		if ( iTotalLengthFilledSoFarInPacketMode
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1816
				< iTotalOutputBufferLengthInPacketMode )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1817
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1818
			TVideoOutputBuffer *outBuf = iOutputFreeBufferQueue[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1819
			FillVideoSegment( outBuf, iInternalOutputBufferQueue[0] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1820
			iOutputFreeBufferQueue.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1821
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1822
			#ifdef CALCINSTANTBITRATE
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1823
			CalculateInstantBitRate( *outBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1824
			#endif
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1825
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1826
			iMMFDevVideoRecordProxy->MdvrpNewBuffer( outBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1827
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1828
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1829
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1830
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1831
		aBuffer->iData.Set( ( TUint8* )aBuffer->iData.Ptr(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1832
										iOutputBufferSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1833
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1834
		// add the buffer back to queue or process engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1835
		if ( ( !iEncStateMac->IsInputEndPending() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1836
				&& ( !iEncStateMac->IsStopped() ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1837
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1838
			iEngine->AddOutput( ( TAny* )aBuffer );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1839
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1840
		else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1841
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1842
			TInt error = iOutputFreeBufferQueue.Append( aBuffer );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1843
			if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1844
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1845
				ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1846
				return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1847
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1848
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1849
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1850
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1851
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1852
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1853
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1854
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1855
// Indicates a picture loss to the encoder, without specifying the lost
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1856
// picture
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1857
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1858
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1859
void CAriH264encHwDeviceImpl::PictureLoss()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1860
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1861
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1862
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1863
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1864
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1865
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1866
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1867
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1868
	iPictureLoss = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1869
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1870
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1871
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1872
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1873
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1874
// Indicates to the encoder the pictures that have been lost
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1875
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1876
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1877
void CAriH264encHwDeviceImpl::PictureLoss(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1878
									const TArray<TPictureId>& /*aPictures*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1879
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1880
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1881
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1882
    if ( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1883
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1884
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1885
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1886
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1887
	iPictureLoss = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1888
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1889
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1890
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1891
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1892
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1893
// Indicates a slice loss to the encoder.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1894
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1895
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1896
void CAriH264encHwDeviceImpl::SliceLoss( TUint aFirstMacroblock,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1897
											TUint aNumMacroblocks,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1898
											const TPictureId& /*aPicture*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1899
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1900
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1901
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1902
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1903
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1904
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1905
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1906
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1907
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1908
    if ( ( aFirstMacroblock == 0 ) || ( aNumMacroblocks == 0 ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1909
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1910
    	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SliceLoss() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1911
    			"aNumMacroblocks or aFirstMacroblock = 0 return" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1912
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1913
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1914
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1915
	TH264EncSliceLoss* sliceLossParams = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1916
	TRAPD( error, sliceLossParams  = new( ELeave ) TH264EncSliceLoss );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1917
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1918
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1919
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1920
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1921
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1922
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1923
	sliceLossParams->iFirstMacroblock = aFirstMacroblock;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1924
	sliceLossParams->iNumMacroblocks  = aNumMacroblocks;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1925
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1926
	TRAP( error, iEngine->AddCommandL( CBaseEngine::ENormalPriority,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1927
					CONTROL_CMD_SET_SLICELOSS, sliceLossParams ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1928
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1929
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1930
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1931
		delete sliceLossParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1932
		ClientFatalError ( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1933
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1934
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1935
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1936
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1937
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1938
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1939
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1940
// Sends a reference picture selection request to the encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1941
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1942
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1943
void CAriH264encHwDeviceImpl::ReferencePictureSelection(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1944
											const TDesC8& /*aSelectionData*/)
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1945
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1946
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1947
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1948
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1949
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1950
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1951
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1952
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1953
    ClientFatalError( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1954
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1955
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1956
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1957
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1958
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1959
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1960
// Initializes the device, and reserves hardware resources
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1961
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1962
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1963
void CAriH264encHwDeviceImpl::Initialize()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1964
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1965
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1966
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1967
    //Device should be in unintialized state
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1968
    if ( !iEncStateMac->IsTransitionValid(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1969
    		CStateMachine::EInitializingCommand ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1970
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1971
		iMMFDevVideoRecordProxy->MdvrpInitializeComplete(this
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1972
											, KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1973
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1974
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1975
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1976
	// check for input and output formats set by the client
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1977
	if ( ! ( iH264EncInitParams.iBeforeInitialize  & EEncInputFormat ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1978
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1979
		PRINT_MSG( LEVEL_CRITICAL, ("CAriH264encHwDeviceImpl::Initialize() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1980
				"- SetInputFormat not called" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1981
		iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1982
												KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1983
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1984
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1985
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1986
	// check for buffer sizes
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1987
	if( iH264EncInitParams.iBeforeInitialize & EEncBufferOptions )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1988
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1989
		if ( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1990
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1991
			// Buffer size related checks
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1992
			if ( ( iH264EncInitParams.iMaxOutputBufferSize >
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1993
				( KH264ENCIMPL_FACTOR_FOR_OUTPUTBUFFERSIZE_IN_PACKETMODE *
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1994
				KH264ENCIMPL_MAX_SEGMENTSIZE ) ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1995
				( iH264EncInitParams.iMaxCodedSegmentSize >
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1996
				KH264ENCIMPL_MAX_SEGMENTSIZE ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1997
				( iH264EncInitParams.iMaxCodedSegmentSize >
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1998
				iH264EncInitParams.iMaxOutputBufferSize ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1999
				( iH264EncInitParams.iMaxCodedSegmentSize == 0 ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2000
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2001
				PRINT_MSG( LEVEL_CRITICAL, ( "CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2002
				"::Initialize() - Wrong size for iMaxCodedSegmentSize" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2003
				iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2004
						KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2005
				return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2006
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2007
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2008
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2009
		else if ( iH264EncInitParams.iDataUnitType == EDuCodedPicture )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2010
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2011
			if ( ( iH264EncInitParams.iMaxCodedPictureSize >
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2012
				iH264EncInitParams.iMaxOutputBufferSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2013
				|| ( iH264EncInitParams.iMaxCodedPictureSize == 0 ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2014
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2015
				PRINT_MSG( LEVEL_CRITICAL, ( "CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2016
				"::Initialize() - Wrong size for iMaxCodedPictureSize" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2017
				iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2018
														KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2019
				return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2020
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2021
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2022
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2023
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2024
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2025
		if ( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2026
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2027
			iH264EncInitParams.iMinNumOutputBuffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2028
				= KH264ENCIMPL_MAXNUM_SEGMENTBUFFERS;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2029
			iH264EncInitParams.iMaxCodedSegmentSize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2030
				= KH264ENCIMPL_DEFAULT_SEGMENTSIZE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2031
			iH264EncInitParams.iMaxOutputBufferSize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2032
				= KH264ENCIMPL_MAX_SEGMENTSIZE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2033
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2034
		else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2035
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2036
			iH264EncInitParams.iMinNumOutputBuffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2037
				= KH264ENCIMPL_MAXNUM_OUTPUTBUFFERS;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2038
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2039
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2040
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2041
	// based on level set the max bit rate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2042
	switch ( iH264EncInitParams.iLevel )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2043
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2044
		//Level 1b
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2045
		case KH264ENCIMPL_LEVEL_1b:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2046
			iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_1b;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2047
            iH264EncInitParams.iTargetPictureRate = KPictureRate15;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2048
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2049
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2050
		case KH264ENCIMPL_LEVEL_1:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2051
			iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2052
            iH264EncInitParams.iTargetPictureRate = KPictureRate15;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2053
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2054
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2055
		case KH264ENCIMPL_LEVEL_11:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2056
            // Both Level 1b and 1.1 have this value
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2057
            // need to decide if 1.1 or 1.b
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2058
            // two options - client passes buffer options and client doesnt
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2059
			// pass buffer options
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2060
            {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2061
            TBool isLevel1b = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2062
            if ( iH264EncInitParams.iBeforeInitialize & EEncBufferOptions )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2063
                {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2064
                isLevel1b = ( ( KH264ENCIMPL_LEVEL1b_MAXCPBSIZE <=
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2065
								iH264EncInitParams.iMaxCodedPictureSize ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2066
								( iH264EncInitParams.iMaxCodedPictureSize <
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2067
								KH264ENCIMPL_LEVEL11_MAXCPBSIZE ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2068
                             ? ( ETrue )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2069
                             : ( EFalse );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2070
                }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2071
            //now we have input size information to decide 1b vs 1.1
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2072
            else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2073
                {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2074
                isLevel1b = ( ( iH264EncInitParams.iPictureSize.iWidth >
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2075
								KH264ENCIMPL_QCIF_WIDTH )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2076
                                && ( iH264EncInitParams.iPictureSize.iHeight >
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2077
                                KH264ENCIMPL_QCIF_HEIGHT ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2078
                             ? ( EFalse )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2079
                             : ( ETrue );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2080
                }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2081
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2082
            if ( isLevel1b )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2083
                {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2084
                iH264EncInitParams.iLevel = KH264ENCIMPL_LEVEL_1b;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2085
                iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_1b;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2086
                iH264EncInitParams.iTargetPictureRate = KPictureRate15;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2087
                }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2088
            else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2089
                {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2090
                iH264EncInitParams.iLevel = KH264ENCIMPL_LEVEL_11;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2091
                iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_11;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2092
                iH264EncInitParams.iTargetPictureRate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2093
					= ( ( iH264EncInitParams.iPictureSize.iWidth
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2094
					<= KH264ENCIMPL_QCIF_WIDTH ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2095
					( iH264EncInitParams.iPictureSize.iHeight
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2096
					<= KH264ENCIMPL_QCIF_HEIGHT ) ) ? ( KPictureRate15 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2097
                     : ( KPictureRate75 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2098
                }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2099
            }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2100
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2101
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2102
		case KH264ENCIMPL_LEVEL_12:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2103
			iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_12;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2104
            iH264EncInitParams.iTargetPictureRate = KPictureRate15;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2105
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2106
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2107
		case KH264ENCIMPL_LEVEL_13:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2108
			iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_13;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2109
            iH264EncInitParams.iTargetPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2110
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2111
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2112
		case KH264ENCIMPL_LEVEL_2:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2113
			iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_2;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2114
            iH264EncInitParams.iTargetPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2115
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2116
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2117
		case KH264ENCIMPL_LEVEL_21:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2118
			iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_21;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2119
            if ( iH264EncInitParams.iPictureSize.iHeight >
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2120
						KH264ENCIMPL_HALFSDTV_HEIGHT_NTSC )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2121
            	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2122
            	// HALFSDTV-PAL
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2123
                iH264EncInitParams.iTargetPictureRate = KPictureRate25;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2124
            	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2125
            else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2126
            	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2127
            	// HALFSDTV-NTSC
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2128
                iH264EncInitParams.iTargetPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2129
            	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2130
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2131
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2132
		case KH264ENCIMPL_LEVEL_22:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2133
			iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_22;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2134
            if ( iH264EncInitParams.iPictureSize.iHeight >
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2135
								KH264ENCIMPL_SDTV_HEIGHT_NTSC )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2136
            	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2137
            	// SDTV-PAL
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2138
                iH264EncInitParams.iTargetPictureRate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2139
						= KH264ENCIMPL_PICTURERATE_12_5;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2140
            	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2141
            else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2142
            	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2143
            	// SDTV-NTSC
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2144
                iH264EncInitParams.iTargetPictureRate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2145
						= KPictureRate15;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2146
            	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2147
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2148
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2149
		case KH264ENCIMPL_LEVEL_3:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2150
			iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_3;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2151
            if ( iH264EncInitParams.iPictureSize.iHeight
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2152
            		> KH264ENCIMPL_SDTV_HEIGHT_NTSC )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2153
            	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2154
                iH264EncInitParams.iTargetPictureRate = KPictureRate25;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2155
            	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2156
            else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2157
            	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2158
            	// SDTV-NTSC
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2159
                iH264EncInitParams.iTargetPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2160
            	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2161
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2162
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2163
			// level unknown based on size decide bitrate and level
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2164
		case 0:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2165
			SetLevelAndBitRate();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2166
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2167
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2168
		default:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2169
			break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2170
		};
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2171
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2172
    // create codec
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2173
    TRAPD( error, iCodec  = CAriH264encWrapper::NewL( iH264EncInitParams ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2174
    if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2175
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2176
        // init complete with error message
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2177
        iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2178
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2179
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2180
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2181
    // set the sync options to the codec
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2182
    if( iClockSource )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2183
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2184
    	TInt error = iCodec->SetSyncOptions( iClockSource );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2185
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2186
		if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2187
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2188
			iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2189
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2190
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2191
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2192
    //Check whether picture is of QCIF format if VT fast call setup is set
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2193
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2194
    if ( iH264EncInitParams.iVTFastCallSetUp )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2195
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2196
    	if ( iH264EncInitParams.iPictureSize.iWidth
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2197
    			!= KH264ENCIMPL_QCIF_WIDTH ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2198
    		 iH264EncInitParams.iPictureSize.iHeight
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2199
				!= KH264ENCIMPL_QCIF_HEIGHT )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2200
    		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2201
    		PRINT_MSG( LEVEL_LOW, ("Input resolution should be 176x144 for"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2202
    				" VT Fast call setup" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2203
    		ClientFatalError( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2204
    		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2205
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2206
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2207
    if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2208
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2209
        iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2210
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2211
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2212
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2213
    //create engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2214
    TRAP( error, iEngine = CBaseEngine::NewL( this,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2215
							( MBaseCodec* ) iCodec, EFalse ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2216
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2217
    if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2218
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2219
        //init complete with error message
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2220
        iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2221
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2222
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2223
    //get the max buffer length from the codec
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2224
    TInt maxOutputBufferSize = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2225
    error = iCodec->GetParam( CONTROL_CMD_GET_MAX_FRAME_SIZE,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2226
											&maxOutputBufferSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2227
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2228
    if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2229
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2230
        //init complete with error message
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2231
        iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2232
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2233
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2234
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2235
    // if EduCodedPicture mode then check for buffer size passed
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2236
    if( iH264EncInitParams.iDataUnitType == EDuCodedPicture )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2237
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2238
		if ( iH264EncInitParams.iBeforeInitialize & EEncBufferOptions )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2239
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2240
			if( maxOutputBufferSize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2241
					> iH264EncInitParams.iMaxCodedPictureSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2242
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2243
				PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::Initialize()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2244
				"maxOutputBufferSize = %d", ( TInt ) maxOutputBufferSize ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2245
				//init complete with error message
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2246
				iMMFDevVideoRecordProxy->MdvrpInitializeComplete(this,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2247
														KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2248
				return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2249
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2250
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2251
		else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2252
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2253
		    iH264EncInitParams.iMaxOutputBufferSize = maxOutputBufferSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2254
			iH264EncInitParams.iMaxCodedPictureSize = maxOutputBufferSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2255
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2256
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2257
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2258
	// if packet mode is on then allocate memory for NAL information
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2259
	TUint maxNumOfPackets = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2260
	if( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2261
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2262
		error = iCodec->GetParam( CONTROL_CMD_GET_MAX_NUM_PACKETS,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2263
													&iMaxNumOfPackets );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2264
		if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2265
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2266
			iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2267
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2268
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2269
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2270
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2271
	if ( iH264EncInitParams.iDataUnitType != EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2272
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2273
		TInt maxSlices = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2274
		if( maxOutputBufferSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2275
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2276
		    maxSlices = maxOutputBufferSize / KH264ENCIMPL_MIN_SLICESIZE;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2277
	        if( maxOutputBufferSize % KH264ENCIMPL_MIN_SLICESIZE )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2278
	        	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2279
    	        maxSlices++;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2280
	        	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2281
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2282
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2283
#ifndef EMZ_AVC_ENC_CODEC_SEIINFO_ENABLE
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2284
		PRINT_MSG( LEVEL_LOW, ( "CreateCodedOutputBuffersL SEI disble " ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2285
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2286
		// included KNumOfConfigParams*KDoubleWordLength bytes which are
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2287
		// required for filling offset length information
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2288
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2289
		TRAP( error, CreateCodedOutputBuffersL( ( maxOutputBufferSize +
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2290
			KWordLength + ( ( KNumOfConfigParams + maxSlices )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2291
			* KDoubleWordLength ) ) ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2292
#else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2293
		PRINT_MSG( LEVEL_LOW, ("CreateCodedOutputBuffersL SEI enable " ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2294
		TRAP( error, CreateCodedOutputBuffersL( ( maxOutputBufferSize +
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2295
			KWordLength + ( ( KNumOfNAL_SEI + maxSlices ) *
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2296
			KDoubleWordLength ) ) ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2297
#endif
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2298
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2299
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2300
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2301
		// Allocate sufficient segment mode buffers  Comment it for some time.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2302
		iH264EncInitParams.iMinNumOutputBuffers = ( maxOutputBufferSize /
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2303
				iH264EncInitParams.iMaxCodedSegmentSize ) *
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2304
				KH264ENCIMPL_MAXNUM_OUTPUTBUFFERS;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2305
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2306
		//  holds output buffer 2. holds packet lenght and offset information
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2307
		TRAP( error, CreateInternalOutputBuffersL( maxOutputBufferSize ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2308
		if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2309
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2310
			iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2311
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2312
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2313
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2314
		TRAP( error, CreatePacketOffsetLengthInfoBuffersL( iMaxNumOfPackets *
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2315
				KDoubleWordLength ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2316
		if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2317
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2318
			iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2319
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2320
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2321
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2322
		//segement size  will be the max segment size
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2323
		TUint segmentSize  = iH264EncInitParams.iMaxOutputBufferSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2324
		if ( ( iH264EncInitParams.iDataEncapsulation == EDuGenericPayload ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2325
			( iH264EncInitParams.iMaxOutputBufferSize <
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2326
			( KH264ENCIMPL_MAX_SEGMENTSIZE + KDoubleWordLength
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2327
			+ KWordLength ) ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2328
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2329
			segmentSize += KDoubleWordLength + KWordLength;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2330
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2331
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2332
		TRAP( error, CreateCodedOutputBuffersL( segmentSize ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2333
		if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2334
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2335
			iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2336
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2337
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2338
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2339
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2340
    if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2341
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2342
        iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2343
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2344
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2345
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2346
	//reset the picture counters
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2347
	iPictureCounters.iInputPictures = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2348
	iPictureCounters.iPicturesSkippedRateControl = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2349
	iPictureCounters.iPicturesProcessed	= 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2350
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2351
	// reset the options set by client
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2352
	iH264EncInitParams.iBeforeInitialize = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2353
	iCurSetH264EncParams = iH264EncInitParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2354
    iEncStateMac->Transit( CStateMachine::EInitializingCommand );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2355
    iEncStateMac->Transit( CStateMachine::EInitializeCommand );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2356
    iMMFDevVideoRecordProxy->MdvrpInitializeComplete( this, KErrNone );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2357
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2358
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2359
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2360
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2361
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2362
// Commit all changes since the last CommitL(), Revert() or Initialize()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2363
// to the Hw device
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2364
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2365
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2366
void CAriH264encHwDeviceImpl::CommitL()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2367
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2368
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2369
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2370
    // This method can only be called after Initialize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2371
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2372
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2373
    	PRINT_ERR( "CommitL () called before "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2374
    	    	    			"Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2375
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2376
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2377
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2378
    // Methods that will be affected by CommitL in our case:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2379
    // SetOutputRectL
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2380
    // SetCodingStandardSpecificOptionsL
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2381
    // SetErrorsExpected
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2382
    // SetMinRandomAccessRate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2383
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2384
	TH264EncInitParams *currentParams = new( ELeave ) TH264EncInitParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2385
	CleanupStack::PushL( currentParams );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2386
	*currentParams	= iCurSetH264EncParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2387
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2388
	// Add command apply commit settings to the codec
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2389
	iEngine->AddCommandL ( CBaseEngine::ENormalPriority,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2390
			CONTROL_CMD_SET_COMMIT_OPTIONS, currentParams );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2391
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2392
	iCurSetH264EncParams.iAfterInitialize = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2393
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2394
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2395
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2396
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2397
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2398
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2399
// Revert all changes since the last CommitL(), Revert() or Initialize()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2400
// back to their previous settings
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2401
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2402
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2403
void CAriH264encHwDeviceImpl::Revert()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2404
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2405
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2406
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2407
    // This method can only be called after Initialize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2408
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2409
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2410
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2411
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2412
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2413
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2414
    // Methods that will be affected by Revert in our case:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2415
    // SetOutputRectL
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2416
    // SetCodingStandardSpecificOptionsL
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2417
    // SetErrorsExpected
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2418
    // SetMinRandomAccessRate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2419
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2420
	iCurSetH264EncParams = iH264EncInitParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2421
	iCurSetH264EncParams.iAfterInitialize = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2422
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2423
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2424
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2425
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2426
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2427
// This method is called only in case of client memory buffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2428
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2429
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2430
void CAriH264encHwDeviceImpl::WritePictureL( TVideoPicture* aPicture )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2431
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2432
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2433
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2434
    // This method should only be called only in following states
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2435
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2436
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2437
    	PRINT_ERR( "WritePictureL () called before Initialize ()" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2438
        User::Leave( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2439
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2440
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2441
    if( iEncStateMac->IsInputEndPending() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2442
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2443
    	PRINT_ERR( "Input end is pending.. leaving with KErrEof" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2444
        User::Leave( KErrEof );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2445
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2446
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2447
    if( !aPicture ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2448
		( aPicture->iData.iRawData->Length() == 0 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2449
		( aPicture->iData.iRawData->Length() !=
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2450
		( ( iH264EncInitParams.iPictureSize.iWidth *
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2451
		iH264EncInitParams.iPictureSize.iHeight * 3 ) / 2 ) ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2452
		( aPicture->iData.iDataFormat != EYuvRawData ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2453
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2454
		PRINT_ERR( "Incorrect parameter passed" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2455
		User::Leave( KErrArgument );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2456
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2457
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2458
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2459
	// Added a check to return the input picture if application tries to add
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2460
	// pictures after calling InputEnd() or Stop() and before calling
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2461
	// Start() again.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2462
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2463
	if ( iEncStateMac->IsStopped() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2464
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2465
		SkipInputPicture( aPicture );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2466
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2467
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2468
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2469
	// counter to represent the num of input pictures received
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2470
	iPictureCounters.iInputPictures++;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2471
    if( IsForcedIFrameRequired( aPicture ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2472
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2473
        iEngine->AddCommandL( CBaseEngine::ENormalPriority,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2474
        		CONTROL_CMD_SET_FORCED_I_FRAME, NULL );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2475
		iPictureLoss = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2476
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2477
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2478
    //Check if clock source is enabled skip logic
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2479
    if ( iClockSource )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2480
        	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2481
        	if ( ( !CanEncode( aPicture ) ) || iFrozen )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2482
            {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2483
                SkipInputPicture( aPicture );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2484
                return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2485
            }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2486
        }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2487
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2488
    TInt error = iEngine->AddInput( aPicture );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2489
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2490
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2491
		PRINT_ERR( "CAriH264encHwDeviceImpl::WritePictureL()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2492
				" AddInput() failed" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2493
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2494
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2495
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2496
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2497
    if( this->iH264EncInitParams.iProcessRealtime )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2498
	    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2499
	    // Check the iDataUnitType
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2500
	    if( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2501
    		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2502
    		TInt perPictureSegmentBuffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2503
					= iH264EncInitParams.iMinNumOutputBuffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2504
									/ KH264ENCIMPL_MAXNUM_OUTPUTBUFFERS;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2505
    		TInt queueCount = iOutputFreeBufferQueue.Count();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2506
    		//  Check for availability of segment buffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2507
    		if ( queueCount < perPictureSegmentBuffers )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2508
    			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2509
    			// Sufficient number of segment buffers are not present
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2510
    			PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2511
    			"::WritePictureL() Input returned EDuVideoSegment " ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2512
    			// Return the earlier input picture added to the queue
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2513
    			iEngine->ReturnInput();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2514
				return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2515
    			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2516
    		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2517
    	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2518
    		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2519
    		//  Check for availability of buffers.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2520
    		if ( iEngine->NumOutputBuffers() == 0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2521
    			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2522
    			// Return the earlier input picture added to the queue
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2523
    			PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2524
    			"::WritePictureL() Input returned EDuCodedPicture " ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2525
    			iEngine->ReturnInput();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2526
				return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2527
    			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2528
    		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2529
	    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2530
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2531
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2532
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2533
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2534
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2535
// Notifies the hardware device that the end of input data has been reached
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2536
// and no more input pictures will be written
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2537
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2538
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2539
void CAriH264encHwDeviceImpl::InputEnd()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2540
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2541
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2542
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2543
    if ( !iEncStateMac->IsTransitionValid( CStateMachine::EInputEndCommand ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2544
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2545
        ClientFatalError( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2546
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2547
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2548
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2549
    if ( iEngine->NumInputBuffers() == 0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2550
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2551
    	PRINT_MSG( LEVEL_HIGH, ("CAriH264encHwDeviceImpl::InputEnds()" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2552
        Stop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2553
        iMMFDevVideoRecordProxy->MdvrpStreamEnd();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2554
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2555
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2556
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2557
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2558
		iInputEndCalled = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2559
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2560
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2561
    iEncStateMac->Transit( CStateMachine::EInputEndCommand );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2562
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2563
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2564
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2565
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2566
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2567
// Starts recording video
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2568
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2569
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2570
void CAriH264encHwDeviceImpl::Start()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2571
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2572
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2573
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2574
    if( iEncStateMac->IsPlaying() && !iEncStateMac->IsPaused() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2575
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2576
    	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::Start()-already in"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2577
    			"started state, So ignore" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2578
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2579
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2580
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2581
    if( !iEncStateMac->IsTransitionValid( CStateMachine::EStartCommand ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2582
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2583
        ClientFatalError( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2584
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2585
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2586
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2587
	if ( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2588
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2589
		// Enable flag which indicates that all picture params and sequence
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2590
		//  params are put into 1st buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2591
		iIsConfigDataFilledInFirstOutputBuffer = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2592
		for( TInt i = 0; i <= iInternalOutputBufferQueue.Count(); i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2593
		 	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2594
			TVideoOutputBuffer *outputBuffer = iInternalOutputBufferQueue[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2595
			iEngine->AddOutput( ( TAny* )outputBuffer );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2596
			iInternalOutputBufferQueue.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2597
		 	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2598
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2599
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2600
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2601
		// add all output buffers to engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2602
		for( TInt i = 0; i <= iOutputFreeBufferQueue.Count(); i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2603
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2604
			TVideoOutputBuffer *outputBuffer = iOutputFreeBufferQueue[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2605
			iEngine->AddOutput( ( TAny* )outputBuffer );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2606
			iOutputFreeBufferQueue.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2607
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2608
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2609
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2610
    if ( iClockSource )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2611
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2612
        TTime lSystemTime;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2613
        lSystemTime.UniversalTime();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2614
        UpdateTime();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2615
        iPeriodicTimer->Start( iPollingInterval, iPollingInterval,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2616
	    TCallBack( CAriH264encHwDeviceImpl::TimerCallBack, ( TAny* )this ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2617
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2618
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2619
    iEngine->Start();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2620
    PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::Start() Change to "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2621
    		" start state** ") ) ;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2622
    iEncStateMac->Transit( CStateMachine::EStartCommand );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2623
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2624
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2625
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2626
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2627
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2628
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2629
// Callback function to CPeriodicTimer object
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2630
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2631
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2632
TInt CAriH264encHwDeviceImpl::TimerCallBack( TAny* aPtr )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2633
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2634
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2635
	if ( !aPtr )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2636
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2637
		( ( CAriH264encHwDeviceImpl* )aPtr )->ClientFatalError(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2638
															KErrArgument );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2639
        return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2640
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2641
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2642
    return ( ( CAriH264encHwDeviceImpl* )aPtr )->UpdateTime();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2643
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2644
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2645
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2646
// Stops recording video.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2647
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2648
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2649
void CAriH264encHwDeviceImpl::Stop()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2650
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2651
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2652
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2653
    if( iEncStateMac->IsStopped() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2654
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2655
    	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::Stop() -> already "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2656
    			"in stop state, so ignore" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2657
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2658
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2659
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2660
    if( !iEncStateMac->IsTransitionValid( CStateMachine::EStopCommand ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2661
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2662
    	PRINT_MSG( LEVEL_CRITICAL, ("CAriH264encHwDeviceImpl::Stop() -> "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2663
    			"fatalerror because Stop called in invalid state" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2664
        ClientFatalError( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2665
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2666
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2667
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2668
	iInputEndCalled	= EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2669
	iIsSliceEnabledInCodedPicture = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2670
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2671
	if ( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2672
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2673
		// new clip started so config data has to be filled in first output
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2674
		// buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2675
		iIsConfigDataFilledInFirstOutputBuffer = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2676
		iTotalOutputBufferLengthInPacketMode = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2677
		iTotalLengthFilledSoFarInPacketMode = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2678
		iPacketsPending	= EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2679
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2680
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2681
    iEngine->Stop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2682
    iEngine->Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2683
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2684
    iFrozen = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2685
    if( iPeriodicTimer )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2686
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2687
        iPeriodicTimer->Cancel();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2688
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2689
    iEncStateMac->Transit( CStateMachine::EStopCommand );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2690
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2691
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2692
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2693
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2694
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2695
// Pauses video recording
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2696
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2697
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2698
void CAriH264encHwDeviceImpl::Pause()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2699
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2700
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2701
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2702
    if( iEncStateMac->IsPaused() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2703
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2704
    	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::Pause()-> already"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2705
    			"in Paused state, so ignore" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2706
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2707
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2708
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2709
    if( !iEncStateMac->IsTransitionValid( CStateMachine::EPauseCommand ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2710
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2711
    	PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::Pause() Pause "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2712
    			"called in invalid state" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2713
        ClientFatalError( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2714
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2715
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2716
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2717
    // No arguments to be passed in Pause
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2718
    if( iClockSource )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2719
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2720
        iPeriodicTimer->Cancel();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2721
        //Note down the clock when paued
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2722
        iClockTimeWhenPaused = iClockSource->Time().Int64();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2723
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2724
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2725
    // Stop the engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2726
    iEngine->Stop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2727
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2728
    //Change the state of the encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2729
    iEncStateMac->Transit( CStateMachine::EPauseCommand );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2730
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2731
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2732
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2733
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2734
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2735
// Resumes video recording
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2736
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2737
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2738
void CAriH264encHwDeviceImpl::Resume()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2739
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2740
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2741
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2742
	// doing it before transitionvalid check because initialize->resume is
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2743
	// not added
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2744
    if( iEncStateMac->IsInInitializedState() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2745
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2746
    	PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::Resume()->Got resume"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2747
    			" in initialized state. So go to start()" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2748
        Start();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2749
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2750
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2751
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2752
    if( iEncStateMac->IsPlaying() && !iEncStateMac->IsPaused() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2753
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2754
    	PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::Resume()->already in"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2755
    			" playing-not-paused state, so ignore" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2756
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2757
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2758
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2759
    if( !iEncStateMac->IsTransitionValid( CStateMachine::EResumeCommand ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2760
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2761
    	PRINT_MSG( LEVEL_CRITICAL, ("Resume called in invalid state" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2762
        ClientFatalError( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2763
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2764
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2765
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2766
    // No arguments to be passed in Resume
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2767
	if ( iClockSource )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2768
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2769
        //Clock may or may not be paused, when HWDevice is paused, so
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2770
        //add the paused duration to clock
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2771
        iPauseOffset = iClockSource->Time().Int64();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2772
        iPauseOffset -= iClockTimeWhenPaused;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2773
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2774
        //calculate the total time and deviation
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2775
        iTotalTime += iPauseOffset;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2776
        TTime lSystemTime;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2777
        lSystemTime.UniversalTime();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2778
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2779
        // Send Update time before sending Resume command, so that clock
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2780
        // source is set before
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2781
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2782
        UpdateTime ();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2783
        iPeriodicTimer->Start( iPollingInterval, iPollingInterval,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2784
		TCallBack( CAriH264encHwDeviceImpl::TimerCallBack, ( TAny* )this ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2785
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2786
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2787
	// Start the engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2788
	iEngine->Start();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2789
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2790
	if ( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2791
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2792
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2793
		// send the remaining pending packets to client
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2794
		while ( iOutputFreeBufferQueue.Count() && iPacketsPending )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2795
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2796
			TVideoOutputBuffer *outBuf = iOutputFreeBufferQueue[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2797
			FillVideoSegment( outBuf, iInternalOutputBufferQueue[0] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2798
			iOutputFreeBufferQueue.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2799
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2800
			#ifdef CALCINSTANTBITRATE
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2801
			CalculateInstantBitRate( *outBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2802
			#endif
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2803
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2804
			iMMFDevVideoRecordProxy->MdvrpNewBuffer( outBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2805
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2806
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2807
    //Change the state of the encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2808
    iEncStateMac->Transit( CStateMachine::EResumeCommand );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2809
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2810
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2811
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2812
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2813
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2814
// Freezes the input picture
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2815
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2816
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2817
void CAriH264encHwDeviceImpl::Freeze()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2818
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2819
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2820
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2821
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2822
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2823
    	PRINT_MSG( LEVEL_CRITICAL, ("CAriH264encHwDeviceImpl::Freeze() Freeze"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2824
    			" called in invalid state" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2825
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2826
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2827
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2828
    iFrozen = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2829
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2830
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2831
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2832
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2833
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2834
// Releases a frozen input picture
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2835
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2836
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2837
void CAriH264encHwDeviceImpl::ReleaseFreeze()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2838
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2839
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2840
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2841
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2842
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2843
    	PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::ReleaseFreeze() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2844
    			"called in invalid state" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2845
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2846
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2847
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2848
    iFrozen = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2849
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2850
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2851
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2852
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2853
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2854
// Returns the current recording position
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2855
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2856
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2857
TTimeIntervalMicroSeconds CAriH264encHwDeviceImpl::RecordingPosition()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2858
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2859
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2860
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2861
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2862
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2863
    	PRINT_MSG( LEVEL_HIGH, ("CAriH264encHwDeviceImpl::RecordingPosition()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2864
    			" called in invalid state" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2865
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2866
        return TTimeIntervalMicroSeconds( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2867
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2868
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2869
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2870
    return TTimeIntervalMicroSeconds( iLastEncodedPictureTimestamp );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2871
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2872
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2873
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2874
// Reads various counters related to processed video pictures
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2875
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2876
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2877
void CAriH264encHwDeviceImpl::GetPictureCounters(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2878
		CMMFDevVideoRecord::TPictureCounters& aCounters )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2879
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2880
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2881
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2882
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2883
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2884
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2885
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2886
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2887
	TUint numofpacktsskipped;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2888
	TUint err = iCodec->GetParam( CONTROL_CMD_GET_PICTURES_SKIPPED,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2889
												&numofpacktsskipped );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2890
	if ( err )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2891
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2892
		ClientFatalError( err );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2893
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2894
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2895
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2896
	iPictureCounters.iPicturesSkippedRateControl
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2897
		= iPictureCounters.iPicturesSkippedRateControl + numofpacktsskipped;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2898
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2899
	iPictureCounters.iPicturesProcessed
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2900
		= iPictureCounters.iInputPictures
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2901
		- iPictureCounters.iPicturesSkippedRateControl;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2902
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2903
	aCounters = iPictureCounters;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2904
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2905
	//reset the counters
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2906
	iPictureCounters.iInputPictures = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2907
	iPictureCounters.iPicturesSkippedRateControl = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2908
	iPictureCounters.iPicturesProcessed	= 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2909
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2910
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2911
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2912
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2913
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2914
// Reads the frame stabilisation output picture position.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2915
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2916
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2917
void CAriH264encHwDeviceImpl::GetFrameStabilisationOutput( TRect&/* aRect*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2918
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2919
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2920
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2921
    ClientFatalError( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2922
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2923
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2924
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2925
// Retrieves the number of complexity control levels available for this
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2926
// hardware device
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2927
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2928
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2929
TUint CAriH264encHwDeviceImpl::NumComplexityLevels()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2930
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2931
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2932
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2933
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2934
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2935
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2936
        return 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2937
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2938
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2939
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2940
    return( KH264ENCIMPL_NUM_COMPLEXITYLEVELS );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2941
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2942
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2943
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2944
// Sets the complexity level to use for video processing in a hardware device
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2945
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2946
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2947
void CAriH264encHwDeviceImpl::SetComplexityLevel( TUint aLevel )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2948
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2949
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2950
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2951
    if( !iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2952
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2953
        ClientFatalError( KErrNotReady );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2954
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2955
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2956
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2957
    if( aLevel >= KH264ENCIMPL_NUM_COMPLEXITYLEVELS )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2958
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2959
    	PRINT_MSG( LEVEL_CRITICAL, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2960
    			"::SetComplexityLevel() Unsupported level Passed" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2961
        ClientFatalError( KErrArgument );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2962
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2963
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2964
    iH264EncInitParams.iComplexityLevel = aLevel;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2965
    TH264EncInitParams *currentParams = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2966
	TRAPD( error, currentParams = new( ELeave ) TH264EncInitParams );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2967
	*currentParams	= iH264EncInitParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2968
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2969
	// Add command apply commit settings to the codec
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2970
	TRAP( error, iEngine->AddCommandL( CBaseEngine::ENormalPriority,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2971
			CONTROL_CMD_SET_COMPLEXITY_LEVEL, currentParams ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2972
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2973
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2974
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2975
		delete currentParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2976
		ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2977
		return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2978
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2979
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2980
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2981
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2982
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2983
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2984
// Retrieves information about the pre-processing capabilities of this
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2985
// hardware device.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2986
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2987
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2988
CPreProcessorInfo* CAriH264encHwDeviceImpl::PreProcessorInfoLC()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2989
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2990
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2991
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2992
	TInt cleanupstackpushcount = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2993
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2994
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2995
    	PRINT_ERR( "SetErrorProtectionLevelsL () called after Initialize()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2996
    			"..leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2997
        User::Leave( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2998
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2999
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3000
    _LIT( KManufacturer, "" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3001
    _LIT( KIdentifier, "" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3002
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3003
    TPtrC8 implementationSpecificInfo( NULL,0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3004
    RArray<TUncompressedVideoFormat> inputFormats;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3005
	CleanupClosePushL( inputFormats );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3006
	cleanupstackpushcount++;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3007
    inputFormats.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3008
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3009
    RArray<TUncompressedVideoFormat>  outputFormats;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3010
	CleanupClosePushL( outputFormats );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3011
	cleanupstackpushcount++;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3012
    outputFormats.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3013
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3014
    RArray<TUint32>  supportedCombinations;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3015
	CleanupClosePushL( supportedCombinations );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3016
	cleanupstackpushcount++;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3017
    supportedCombinations.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3018
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3019
    RArray<TScaleFactor> supportedScaleFactors;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3020
	CleanupClosePushL( supportedScaleFactors );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3021
	cleanupstackpushcount++;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3022
    supportedScaleFactors.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3023
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3024
    TYuvToYuvCapabilities yuvToYuvCapabilities;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3025
    TUid uid;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3026
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3027
    CPreProcessorInfo *preProcessorInfo = CPreProcessorInfo::NewL( uid.Null(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3028
                                            KManufacturer,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3029
                                            KIdentifier,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3030
                                            TVersion( 0,0,0 ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3031
                                            EFalse,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3032
                                            EFalse,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3033
                                            inputFormats.Array(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3034
                                            outputFormats.Array(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3035
                                            supportedCombinations.Array(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3036
                                            EFalse,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3037
                                            EFalse,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3038
                                            supportedScaleFactors.Array(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3039
                                            yuvToYuvCapabilities,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3040
                                            0,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3041
                                            0,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3042
                                            implementationSpecificInfo );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3043
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3044
    CleanupStack::PushL( preProcessorInfo );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3045
    CleanupStack::Pop( cleanupstackpushcount );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3046
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3047
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3048
    return preProcessorInfo ;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3049
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3050
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3051
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3052
// Sets the hardware device input format
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3053
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3054
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3055
void CAriH264encHwDeviceImpl::SetInputFormatL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3056
		const TUncompressedVideoFormat& aFormat, const TSize& aPictureSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3057
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3058
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3059
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3060
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3061
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3062
    	PRINT_ERR( "SetInputFormatL () called after Initialize()..leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3063
        User::Leave( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3064
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3065
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3066
    if( !CheckInputFormat( aFormat ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3067
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3068
    	PRINT_ERR("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3069
    	"::SetInputFormatL() Leaving because of not support input format" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3070
        User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3071
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3072
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3073
    // Check if passed size is supported by encoder
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3074
	// Check if encoder supports the passed input format
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3075
	// supports all sizes which are multiple of 16 pixels
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3076
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3077
	if ( ( !aPictureSize.iWidth ) || ( !aPictureSize.iHeight ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3078
		( aPictureSize.iWidth % 16 ) || ( aPictureSize.iHeight % 16 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3079
		( aPictureSize.iWidth > KH264ENCIMPL_SDTV_WIDTH ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3080
		( aPictureSize.iHeight > KH264ENCIMPL_SDTV_HEIGHT_PAL ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3081
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3082
		PRINT_ERR( "Incorrect parameter passed.. leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3083
		User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3084
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3085
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3086
	TInt32 aspectratio = ::MapAspectRatio(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3087
			aFormat.iYuvFormat.iAspectRatioNum,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3088
			aFormat.iYuvFormat.iAspectRatioDenom );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3089
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3090
	if ( aspectratio == -1 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3091
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3092
		PRINT_ERR( "Aspect ratio is -1.. leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3093
		User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3094
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3095
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3096
	iH264EncInitParams.iAspectRatio = aspectratio;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3097
    iH264EncInitParams.iInputFormat = aFormat;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3098
    iH264EncInitParams.iPictureSize = aPictureSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3099
    iH264EncInitParams.iBeforeInitialize |= EEncInputFormat;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3100
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3101
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3102
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3103
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3104
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3105
// Sets the data source to be a camera, and sets the device to use direct
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3106
// capture for input.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3107
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3108
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3109
void CAriH264encHwDeviceImpl::SetSourceCameraL( TInt /*aCameraHandle*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3110
													TReal /*aPictureRate*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3111
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3112
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3113
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3114
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3115
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3116
    	PRINT_ERR( "SetSourceCameraL() called after Initialize()..leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3117
        User::Leave( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3118
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3119
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3120
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3121
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3122
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3123
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3124
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3125
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3126
// Sets the data source to be memory buffers.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3127
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3128
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3129
void CAriH264encHwDeviceImpl::SetSourceMemoryL( TReal aMaxPictureRate,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3130
						TBool aConstantPictureRate,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3131
						TBool aProcessRealtime )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3132
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3133
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3134
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3135
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3136
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3137
    	PRINT_ERR( "SetSourceMemoryL() called after Initialize()..leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3138
        User::Leave( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3139
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3140
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3141
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3142
    if( ( aMaxPictureRate <= 0 ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3143
        ( aMaxPictureRate > KH264ENCIMPL_MAX_PICTURERATE ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3144
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3145
    	PRINT_ERR( "Incorrect value of max picture rate..leaving" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3146
        User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3147
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3148
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3149
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3150
    // Check for the picture rates supported
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3151
    PRINT_MSG( LEVEL_LOW, ( "CAriH264encHwDeviceImpl::SetSourceMemoryL() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3152
    		"Memory Picture rate is set as %f", aMaxPictureRate ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3153
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3154
    iH264EncInitParams.iMaxPictureRate = aMaxPictureRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3155
    iH264EncInitParams.iConstantPictureRate = aConstantPictureRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3156
    iH264EncInitParams.iProcessRealtime = aProcessRealtime;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3157
    iH264EncInitParams.iBeforeInitialize |= EEncSourceMemory;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3158
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3159
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3160
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3161
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3162
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3163
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3164
// Sets the clock source to use for video timing. If no clock
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3165
// source is set. video encoding will not be synchronized, but
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3166
// will proceed as fast as possible, depending on input data and
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3167
// output buffer availability.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3168
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3169
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3170
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3171
void CAriH264encHwDeviceImpl::SetClockSource( MMMFClockSource* aClock )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3172
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3173
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3174
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3175
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3176
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3177
        ClientFatalError( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3178
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3179
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3180
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3181
    if( !aClock )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3182
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3183
        ClientFatalError( KErrArgument );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3184
        return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3185
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3186
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3187
    PRINT_MSG( LEVEL_LOW, ( " CAriH264encHwDeviceImpl::SetClockSource() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3188
    		"encoder clockSource is %x", ( TInt ) aClock ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3189
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3190
    iClockSource = aClock;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3191
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3192
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3193
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3194
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3195
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3196
// Sets pre-processing options for RGB to YUV color space conversion
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3197
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3198
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3199
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3200
void CAriH264encHwDeviceImpl::SetRgbToYuvOptionsL( TRgbRange /*aRange*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3201
		const TYuvFormat& /*aOutputFormat*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3202
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3203
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3204
	PRINT_ERR( "SetRgbToYuvOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3205
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3206
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3207
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3208
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3209
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3210
// Sets pre-processing options for YUV to YUV data format conversion
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3211
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3212
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3213
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3214
void CAriH264encHwDeviceImpl::SetYuvToYuvOptionsL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3215
		const TYuvFormat& /*aInputFormat*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3216
		const TYuvFormat& /*aOutputFormat*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3217
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3218
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3219
	PRINT_ERR( "SetYuvToYuvOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3220
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3221
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3222
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3223
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3224
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3225
// Sets the pre-processing types to be used in a hardware device
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3226
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3227
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3228
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3229
void CAriH264encHwDeviceImpl::SetPreProcessTypesL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3230
											TUint32 /*aPreProcessTypes*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3231
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3232
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3233
	PRINT_ERR( "SetPreProcessTypesL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3234
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3235
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3236
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3237
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3238
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3239
// Sets pre-processing options for rotation
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3240
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3241
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3242
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3243
void CAriH264encHwDeviceImpl::SetRotateOptionsL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3244
											TRotationType /*aRotationType*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3245
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3246
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3247
	PRINT_ERR( "SetRotateOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3248
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3249
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3250
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3251
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3252
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3253
// Sets pre-processing options for scaling
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3254
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3255
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3256
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3257
void CAriH264encHwDeviceImpl::SetScaleOptionsL( const TSize& /*aTargetSize*/,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3258
											TBool /*aAntiAliasFiltering*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3259
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3260
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3261
	PRINT_ERR( "SetScaleOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3262
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3263
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3264
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3265
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3266
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3267
// Sets pre-processing options for input cropping
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3268
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3269
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3270
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3271
void CAriH264encHwDeviceImpl::SetInputCropOptionsL( const TRect& /*aRect*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3272
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3273
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3274
	PRINT_ERR( "SetInputCropOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3275
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3276
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3277
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3278
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3279
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3280
// Sets pre-processing options for output cropping
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3281
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3282
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3283
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3284
void CAriH264encHwDeviceImpl::SetOutputCropOptionsL( const TRect& /*aRect*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3285
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3286
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3287
	PRINT_ERR( "SetOutputCropOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3288
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3289
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3290
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3291
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3292
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3293
// Sets pre-processing options for output padding
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3294
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3295
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3296
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3297
void CAriH264encHwDeviceImpl::SetOutputPadOptionsL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3298
		const TSize& /*aOutputSize*/, const TPoint& /*aPicturePos*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3299
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3300
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3301
	PRINT_ERR( "SetOutputPadOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3302
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3303
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3304
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3305
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3306
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3307
// Sets color enhancement pre-processing options
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3308
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3309
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3310
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3311
void CAriH264encHwDeviceImpl::SetColorEnhancementOptionsL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3312
								const TColorEnhancementOptions& /*aOptions*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3313
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3314
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3315
	PRINT_ERR( "SetColorEnhancementOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3316
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3317
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3318
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3319
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3320
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3321
// Sets frame stabilisation options
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3322
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3323
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3324
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3325
void CAriH264encHwDeviceImpl::SetFrameStabilisationOptionsL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3326
		const TSize& /*aOutputSize*/, TBool /*aFrameStabilisation*/ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3327
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3328
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3329
	PRINT_ERR( "SetFrameStabilisationOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3330
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3331
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3332
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3333
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3334
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3335
// Sets custom implementation-specific pre-processing options.
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3336
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3337
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3338
void CAriH264encHwDeviceImpl::SetCustomPreProcessOptionsL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3339
												const TDesC8& /*aOptions*/)
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3340
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3341
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3342
	PRINT_ERR( "SetCustomPreProcessOptionsL not supported...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3343
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3344
    User::Leave( KErrNotSupported );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3345
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3346
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3347
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3348
//  Proxy which recieves callbacks from Hw Device
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3349
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3350
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3351
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3352
void CAriH264encHwDeviceImpl::SetProxy( MMMFDevVideoRecordProxy& aProxy )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3353
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3354
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3355
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3356
    if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3357
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3358
        ClientFatalError( KErrPermissionDenied );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3359
        return ;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3360
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3361
    iMMFDevVideoRecordProxy = &aProxy;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3362
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3363
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3364
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3365
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3366
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3367
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3368
// Callback to indicate the input buffer is consumed
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3369
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3370
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3371
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3372
TInt CAriH264encHwDeviceImpl::InputBufferConsumed ( TAny* aInp, TInt aError )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3373
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3374
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3375
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3376
	if( !aInp )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3377
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3378
		return KErrArgument;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3379
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3380
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3381
	TVideoPicture *picture = (TVideoPicture *) aInp;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3382
	if( ( picture->iOptions & TVideoPicture::ETimestamp )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3383
			&& aError != ( KErrCancel ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3384
	    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3385
	    iLastEncodedPictureTimestamp = picture->iTimestamp.Int64();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3386
	    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3387
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3388
	// if custom buffer emabled then add it to queue else return the picture
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3389
	// to client
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3390
	if ( !iInputBufReturnToPreProc )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3391
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3392
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3393
		"::InputBufferConsumed()-return picture back to client" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3394
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3395
	    iMMFDevVideoRecordProxy->MdvrpReturnPicture( picture );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3396
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3397
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3398
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3399
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3400
		"::InputBufferConsumed()-return picture back to Input Device" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3401
	    iInputDevice->ReturnPicture( picture );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3402
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3403
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3404
    if ( iInputEndCalled && ( iEngine->NumInputBuffers() == 0 )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3405
    	&& ( iCodec->IsCurrentPictureSkipped() ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3406
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3407
    	PRINT_MSG( LEVEL_HIGH, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3408
    			"::InputBufferConsumed()::Calling stream end " ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3409
        Stop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3410
        iMMFDevVideoRecordProxy->MdvrpStreamEnd();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3411
        return( KErrNone );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3412
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3413
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3414
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3415
	return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3416
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3417
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3418
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3419
// Callback to indicate the output buffer is ready
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3420
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3421
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3422
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3423
TInt CAriH264encHwDeviceImpl::OutputBufferReady ( TAny* aOup, TInt aError )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3424
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3425
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3426
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3427
    TVideoOutputBuffer *outputBuf = ( TVideoOutputBuffer* ) aOup;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3428
	TInt error = KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3429
	TInt length = outputBuf->iData.Length();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3430
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3431
	if (iFrozen)
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3432
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3433
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::OutputBufferReady() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3434
				"Frozen state, so drop output picture" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3435
		outputBuf->iData.Set( ( TUint8* )outputBuf->iData.Ptr()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3436
														,iOutputBufferSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3437
		iEngine->AddOutput( outputBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3438
		return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3439
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3440
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3441
    if( aError == KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3442
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3443
		if ( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3444
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3445
			error = iInternalOutputBufferQueue.Append( outputBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3446
			if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3447
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3448
				ClientFatalError ( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3449
				return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3450
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3451
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3452
			// get the packet offset infor
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3453
			error = iCodec->GetParam( CONTROL_CMD_GET_PACKET_OFFSET_DATA,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3454
								iFreeBufferQueueForPacketOffsetInfo[0] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3455
			if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3456
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3457
				ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3458
				return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3459
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3460
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3461
			//remove the first element and add it to filled Queue
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3462
			TUint* filledOffsetLengthInfoBuffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3463
				  = iFreeBufferQueueForPacketOffsetInfo[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3464
			iFreeBufferQueueForPacketOffsetInfo.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3465
			error = iFilledBufferQueueForPacketOffsetInfo.Append(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3466
											filledOffsetLengthInfoBuffer );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3467
			if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3468
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3469
				ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3470
				return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3471
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3472
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3473
			if ( !iTotalLengthFilledSoFarInPacketMode )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3474
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3475
				iTotalOutputBufferLengthInPacketMode
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3476
					= iInternalOutputBufferQueue[0]->iData.Length();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3477
				iPacketOffSetCurrentPosition
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3478
					= iFilledBufferQueueForPacketOffsetInfo[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3479
				iPacketsPending	 = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3480
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3481
				while ( iOutputFreeBufferQueue.Count() && iPacketsPending )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3482
					{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3483
					TVideoOutputBuffer *outBuf = iOutputFreeBufferQueue[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3484
					FillVideoSegment( outBuf, iInternalOutputBufferQueue[0] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3485
					iOutputFreeBufferQueue.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3486
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3487
					#ifdef CALCINSTANTBITRATE
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3488
					CalculateInstantBitRate( *outBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3489
					#endif
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3490
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3491
					iMMFDevVideoRecordProxy->MdvrpNewBuffer( outBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3492
					}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3493
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3494
			 TInt ts
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3495
			   = ( TInt ) ( ( outputBuf->iCaptureTimestamp ).Int64() / 1000 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3496
 			iSizePerFrame = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3497
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3498
			else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3499
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3500
				#ifdef CALCINSTANTBITRATE
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3501
				CalculateInstantBitRate( *outputBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3502
				#endif
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3503
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3504
				iSizePerFrame = outputBuf->iData.Length();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3505
				iSizePerFrame = 0 ;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3506
				// inform devvideo record that the new encoded buffer is
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3507
				// avaibable
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3508
				iMMFDevVideoRecordProxy->MdvrpNewBuffer( outputBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3509
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3510
           iNoOfOutputFramesPerSec++;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3511
		   }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3512
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3513
    else if ( aError == KErrCancel )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3514
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3515
        // add the buffer back  to outputQueue
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3516
        outputBuf->iData.Set( ( TUint8* )outputBuf->iData.Ptr(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3517
												iOutputBufferSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3518
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3519
		if ( iH264EncInitParams.iDataUnitType == EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3520
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3521
			error = iInternalOutputBufferQueue.Append( outputBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3522
			if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3523
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3524
				ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3525
				return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3526
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3527
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3528
		else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3529
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3530
			error = iOutputFreeBufferQueue.Append( outputBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3531
			if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3532
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3533
				ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3534
				return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3535
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3536
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3537
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3538
		if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3539
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3540
			ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3541
			return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3542
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3543
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3544
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3545
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3546
		ClientFatalError( aError );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3547
		return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3548
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3549
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3550
    if ( iInputEndCalled && ( iEngine->NumInputBuffers() == 0 ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3551
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3552
    	PRINT_MSG( LEVEL_HIGH, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3553
    			"::OutputBufferReady()::Calling stream end " ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3554
        Stop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3555
        iMMFDevVideoRecordProxy->MdvrpStreamEnd();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3556
        return( KErrNone );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3557
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3558
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3559
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3560
	return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3561
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3562
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3563
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3564
// Callback to indicate the command has been processed
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3565
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3566
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3567
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3568
void CAriH264encHwDeviceImpl::CommandProcessed ( TInt aCmd, TAny* aCmdData,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3569
												TInt aError )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3570
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3571
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3572
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3573
    switch( aCmd )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3574
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3575
        case CONTROL_CMD_SET_RATE_CONTROL_OPTIONS:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3576
        	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3577
            TRateControlOptions *options = ( TRateControlOptions* ) aCmdData;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3578
            delete options;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3579
            }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3580
            break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3581
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3582
        case CONTROL_CMD_SET_FORCED_I_FRAME:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3583
        	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3584
            }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3585
            break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3586
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3587
		case CONTROL_CMD_SET_COMMIT_OPTIONS:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3588
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3589
			TH264EncInitParams *currentParams
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3590
				= ( TH264EncInitParams* ) aCmdData;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3591
			if( ( aError != KErrNone ) || ( aError != KErrCancel ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3592
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3593
				delete currentParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3594
				return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3595
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3596
			else{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3597
				iH264EncInitParams.iBitErrors
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3598
					= currentParams->iBitErrors;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3599
				iH264EncInitParams.iPacketLosses
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3600
					= currentParams->iPacketLosses;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3601
				iH264EncInitParams.iRandomAccessRate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3602
					= currentParams->iRandomAccessRate;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3603
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3604
				delete currentParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3605
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3606
		    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3607
		    break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3608
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3609
		case CONTROL_CMD_SET_COMPLEXITY_LEVEL:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3610
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3611
			TH264EncInitParams *currentParams
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3612
				= ( TH264EncInitParams* ) aCmdData;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3613
			delete currentParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3614
		    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3615
		    break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3616
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3617
		case CONTROL_CMD_SET_CHANNEL_BIT_ERROR_RATE:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3618
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3619
			TReal* currentParams = ( TReal* )aCmdData;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3620
			delete currentParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3621
		    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3622
		    break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3623
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3624
		case CONTROL_CMD_SET_SLICELOSS:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3625
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3626
			TH264EncSliceLoss* currentParams
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3627
					= ( TH264EncSliceLoss* )aCmdData;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3628
			delete currentParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3629
		    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3630
		    break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3631
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3632
        default:
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3633
            break;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3634
        }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3635
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3636
    return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3637
    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3638
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3639
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3640
// Called when a fatal error occurs in process engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3641
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3642
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3643
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3644
void CAriH264encHwDeviceImpl::FatalErrorFromProcessEngine( TInt aError )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3645
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3646
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3647
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3648
    ClientFatalError( aError );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3649
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3650
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3651
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3652
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3653
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3654
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3655
//  Enables inserting H324 pre-defined config data (VOL / SPS / PPS / etc. )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3656
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3657
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3658
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3659
TInt CAriH264encHwDeviceImpl::H324AnnexKDefinedEncoderConfigDataOn()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3660
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3661
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3662
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3663
	if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3664
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3665
    	PRINT_MSG( LEVEL_LOW, ("Not permitted as the encoder is already "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3666
    			"initialised" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3667
        return KErrNotReady;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3668
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3669
	iH264EncInitParams.iVTFastCallSetUp = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3670
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3671
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3672
    return KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3673
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3674
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3675
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3676
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3677
//  2 phase constructor
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3678
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3679
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3680
void CAriH264encHwDeviceImpl::ConstructL()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3681
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3682
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3683
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3684
	TInt error = KErrNone;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3685
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3686
    // Create Array of Supported Input Formats
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3687
    TUncompressedVideoFormat inputFormat;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3688
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3689
    inputFormat.iDataFormat = EYuvRawData;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3690
    inputFormat.iYuvFormat.iCoefficients = EYuvBt709Range0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3691
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3692
    inputFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3693
    inputFormat.iYuvFormat.iYuv2RgbMatrix = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3694
    inputFormat.iYuvFormat.iRgb2YuvMatrix = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3695
    inputFormat.iYuvFormat.iAspectRatioNum = 1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3696
    inputFormat.iYuvFormat.iAspectRatioDenom = 1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3697
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3698
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3699
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3700
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3701
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3702
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3703
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3704
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma2;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3705
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3706
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3707
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3708
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3709
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3710
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3711
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3712
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma3;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3713
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3714
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3715
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3716
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3717
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3718
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3719
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3720
    inputFormat.iYuvFormat.iCoefficients = EYuvBt709Range1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3721
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3722
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3723
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3724
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3725
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3726
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3727
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3728
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3729
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma2;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3730
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3731
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3732
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3733
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3734
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3735
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3736
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3737
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma3;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3738
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3739
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3740
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3741
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3742
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3743
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3744
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3745
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3746
    inputFormat.iYuvFormat.iCoefficients = EYuvBt601Range0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3747
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3748
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3749
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3750
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3751
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3752
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3753
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3754
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3755
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma2;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3756
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3757
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3758
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3759
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3760
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3761
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3762
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3763
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma3;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3764
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3765
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3766
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3767
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3768
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3769
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3770
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3771
    inputFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3772
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3773
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3774
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3775
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3776
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3777
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3778
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3779
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3780
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma2;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3781
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3782
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3783
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3784
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3785
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3786
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3787
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3788
    inputFormat.iYuvFormat.iPattern = EYuv420Chroma3;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3789
    error = iSupportedInputFormats.Append( inputFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3790
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3791
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3792
		PRINT_ERR( "Error while appending input format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3793
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3794
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3795
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3796
    // Create Array of Supported Output Formats
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3797
    CCompressedVideoFormat* compressedVideoFormat =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3798
                    CCompressedVideoFormat::NewL( KH264MimeType );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3799
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3800
	CleanupStack::PushL( compressedVideoFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3801
    error = iSupportedOutputFormats.Append( compressedVideoFormat );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3802
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3803
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3804
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3805
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3806
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3807
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3808
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3809
	// unknown level is set for short mime type - decide in initialize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3810
    error = iLevels.Append( KH264ENCIMPL_LEVEL_UNKNOWN );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3811
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3812
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3813
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3814
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3815
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3816
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3817
	// Level 1
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3818
    CCompressedVideoFormat* compressedVideoFormat2 =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3819
                    CCompressedVideoFormat::NewL( KH264MimeType2 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3820
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3821
	CleanupStack::PushL( compressedVideoFormat2 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3822
    error = iSupportedOutputFormats.Append( compressedVideoFormat2 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3823
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3824
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3825
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3826
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3827
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3828
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3829
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3830
    error = iLevels.Append( KH264ENCIMPL_LEVEL_1 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3831
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3832
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3833
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3834
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3835
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3836
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3837
	// Level 1.1
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3838
    // Bitrate and level will be decided in Initialize
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3839
	CCompressedVideoFormat* compressedVideoFormat3 =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3840
                    CCompressedVideoFormat::NewL( KH264MimeType3 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3841
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3842
	CleanupStack::PushL( compressedVideoFormat3 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3843
    error = iSupportedOutputFormats.Append( compressedVideoFormat3 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3844
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3845
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3846
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3847
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3848
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3849
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3850
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3851
    error = iLevels.Append( KH264ENCIMPL_LEVEL_11 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3852
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3853
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3854
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3855
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3856
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3857
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3858
	// Level 1.2
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3859
	CCompressedVideoFormat* compressedVideoFormat4 =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3860
                    CCompressedVideoFormat::NewL( KH264MimeType4 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3861
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3862
	CleanupStack::PushL( compressedVideoFormat4 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3863
    error = iSupportedOutputFormats.Append( compressedVideoFormat4 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3864
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3865
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3866
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3867
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3868
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3869
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3870
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3871
    error = iLevels.Append( KH264ENCIMPL_LEVEL_12 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3872
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3873
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3874
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3875
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3876
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3877
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3878
	// Level 1.3
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3879
	CCompressedVideoFormat* compressedVideoFormat5 =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3880
                    CCompressedVideoFormat::NewL( KH264MimeType5 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3881
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3882
	CleanupStack::PushL( compressedVideoFormat5 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3883
    error = iSupportedOutputFormats.Append( compressedVideoFormat5 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3884
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3885
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3886
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3887
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3888
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3889
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3890
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3891
    error = iLevels.Append( KH264ENCIMPL_LEVEL_13 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3892
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3893
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3894
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3895
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3896
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3897
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3898
	// Level 2
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3899
    CCompressedVideoFormat* compressedVideoFormat6 =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3900
                    CCompressedVideoFormat::NewL( KH264MimeType6 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3901
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3902
	CleanupStack::PushL( compressedVideoFormat6 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3903
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3904
    error = iSupportedOutputFormats.Append( compressedVideoFormat6 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3905
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3906
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3907
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3908
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3909
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3910
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3911
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3912
	error = iLevels.Append( KH264ENCIMPL_LEVEL_2 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3913
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3914
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3915
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3916
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3917
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3918
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3919
	// Level 2.1
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3920
	CCompressedVideoFormat* compressedVideoFormat7 =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3921
                    CCompressedVideoFormat::NewL( KH264MimeType7 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3922
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3923
	CleanupStack::PushL( compressedVideoFormat7 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3924
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3925
    error = iSupportedOutputFormats.Append( compressedVideoFormat7 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3926
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3927
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3928
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3929
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3930
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3931
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3932
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3933
    error = iLevels.Append( KH264ENCIMPL_LEVEL_21 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3934
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3935
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3936
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3937
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3938
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3939
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3940
	// Level 2.2
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3941
	CCompressedVideoFormat* compressedVideoFormat8 =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3942
                    CCompressedVideoFormat::NewL( KH264MimeType8 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3943
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3944
	CleanupStack::PushL( compressedVideoFormat8 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3945
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3946
    error = iSupportedOutputFormats.Append( compressedVideoFormat8 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3947
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3948
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3949
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3950
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3951
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3952
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3953
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3954
    error = iLevels.Append( KH264ENCIMPL_LEVEL_22 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3955
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3956
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3957
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3958
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3959
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3960
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3961
	// Level 3
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3962
	CCompressedVideoFormat* compressedVideoFormat9 =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3963
                    CCompressedVideoFormat::NewL( KH264MimeType9 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3964
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3965
	CleanupStack::PushL( compressedVideoFormat9 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3966
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3967
    error = iSupportedOutputFormats.Append( compressedVideoFormat9 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3968
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3969
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3970
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3971
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3972
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3973
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3974
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3975
    error = iLevels.Append( KH264ENCIMPL_LEVEL_3 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3976
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3977
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3978
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3979
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3980
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3981
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3982
	// Level 1b
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3983
	CCompressedVideoFormat* compressedVideoFormat10 =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3984
                    CCompressedVideoFormat::NewL( KH264MimeType10 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3985
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3986
	CleanupStack::PushL( compressedVideoFormat10 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3987
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3988
    error = iSupportedOutputFormats.Append( compressedVideoFormat10 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3989
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3990
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3991
		PRINT_ERR( "Error while appending output format...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3992
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3993
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3994
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3995
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3996
    error = iLevels.Append( KH264ENCIMPL_LEVEL_1b );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3997
	if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3998
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3999
		PRINT_ERR( "Error while appending supported level...leaving \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4000
		User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4001
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4002
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4003
	iPeriodicTimer	= CPeriodic::NewL( CActive::EPriorityIdle );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4004
    iOutputFreeBufferQueue.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4005
    iInternalOutputBufferQueue.Reset();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4006
    iEncStateMac = CStateMachine::NewL();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4007
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4008
    PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4009
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4010
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4011
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4012
// Sends the updated time to the codec
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4013
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4014
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4015
TInt CAriH264encHwDeviceImpl::UpdateTime()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4016
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4017
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4018
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4019
    if ( !iClockSource )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4020
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4021
        ClientFatalError( KErrBadHandle );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4022
        return -1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4023
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4024
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4025
    // send the time values to the codec
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4026
    iCodec->SetUpdatedRefernceTime( iTotalTime );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4027
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4028
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4029
    return 1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4030
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4031
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4032
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4033
// Create the output buffers in Coded picture mode
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4034
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4035
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4036
void CAriH264encHwDeviceImpl::CreateCodedOutputBuffersL( TUint aSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4037
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4038
    PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4039
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4040
    if( iH264EncInitParams.iDataUnitType != EDuVideoSegment )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4041
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4042
    	iOutputBufferSize = aSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4043
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4044
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4045
    // Allocate memory for TVideoOutputBuffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4046
    iOutputBuffers  = new ( ELeave ) TVideoOutputBuffer[
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4047
								  iH264EncInitParams.iMinNumOutputBuffers];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4048
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4049
    for ( TInt i = 0; i < iH264EncInitParams.iMinNumOutputBuffers; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4050
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4051
        iOutputBuffers[i].iData.Set( NULL, 0);
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4052
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4053
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4054
    // Create the Buffer and add it to Queue
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4055
    for ( TInt i = 0; i < iH264EncInitParams.iMinNumOutputBuffers; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4056
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4057
        TUint8* ptr = new ( ELeave ) TUint8[aSize];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4058
        CleanupStack::PushL( ptr );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4059
        iOutputBuffers[i].iData.Set( ptr, aSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4060
        CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4061
        InitializeOuputCodedBuffer( iOutputBuffers[i] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4062
        TInt error = iOutputFreeBufferQueue.Append( iOutputBuffers + i );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4063
		if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4064
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4065
			PRINT_ERR( "Error while appending output buffer to the"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4066
					"output buffer queue \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4067
			User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4068
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4069
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4070
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4071
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4072
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4073
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4074
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4075
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4076
// Creates the temporary output buffers
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4077
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4078
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4079
void CAriH264encHwDeviceImpl::CreateInternalOutputBuffersL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4080
													TUint aBufferSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4081
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4082
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4083
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4084
	iOutputBufferSize = aBufferSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4085
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4086
    // Allocate memory for TVideoOutputBuffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4087
    iInternalOutputBuffers  = new ( ELeave ) TVideoOutputBuffer[
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4088
									KH264ENCIMPL_MAXNUM_TEMPOUTPUTBUFFERS];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4089
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4090
    for ( TInt i = 0; i < KH264ENCIMPL_MAXNUM_TEMPOUTPUTBUFFERS; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4091
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4092
        iInternalOutputBuffers[i].iData.Set( NULL, 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4093
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4094
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4095
    // Create the Buffer and add it to Queue
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4096
    for ( TInt i = 0; i < KH264ENCIMPL_MAXNUM_TEMPOUTPUTBUFFERS; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4097
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4098
        TUint8* ptr = new ( ELeave ) TUint8[aBufferSize];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4099
        CleanupStack::PushL( ptr );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4100
        iInternalOutputBuffers[i].iData.Set( ptr, aBufferSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4101
        CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4102
        InitializeOuputCodedBuffer( iInternalOutputBuffers[i] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4103
        TInt error
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4104
			= iInternalOutputBufferQueue.Append( iInternalOutputBuffers + i );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4105
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4106
		if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4107
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4108
			ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4109
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4110
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4111
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4112
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4113
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4114
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4115
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4116
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4117
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4118
// Creates the buffers required to store length and offset
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4119
// info of packets
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4120
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4121
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4122
void CAriH264encHwDeviceImpl::CreatePacketOffsetLengthInfoBuffersL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4123
														TUint aNumOfPackets )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4124
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4125
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4126
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4127
	iPacketOffSetAndLengthInfoBuffers = new ( ELeave )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4128
			( TUint*[KH264ENCIMPL_MAXNUM_TEMPOUTPUTBUFFERS] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4129
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4130
	for ( TInt i = 0; i < KH264ENCIMPL_MAXNUM_TEMPOUTPUTBUFFERS; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4131
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4132
		iPacketOffSetAndLengthInfoBuffers[i] = NULL;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4133
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4134
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4135
	for ( TInt i = 0; i < KH264ENCIMPL_MAXNUM_TEMPOUTPUTBUFFERS; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4136
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4137
		iPacketOffSetAndLengthInfoBuffers[i] = ( TUint* ) ( new ( ELeave )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4138
				TUint8[aNumOfPackets] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4139
		TInt error = iFreeBufferQueueForPacketOffsetInfo.Append(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4140
								iPacketOffSetAndLengthInfoBuffers[i] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4141
		if( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4142
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4143
			PRINT_ERR( "Error while appending packet lengthoffset buffer to "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4144
					"queue \n" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4145
			User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4146
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4147
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4148
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4149
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4150
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4151
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4152
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4153
// decides whether picture can be encoded or not
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4154
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4155
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4156
TBool  CAriH264encHwDeviceImpl::CanEncode( TVideoPicture *aPicture )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4157
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4158
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4159
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4160
	// check with the last encoded picture and decide whether it can be
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4161
	//	processed or skipped
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4162
    if( aPicture->iTimestamp.Int64() < iLastEncodedPictureTimestamp )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4163
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4164
        return EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4165
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4166
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4167
    // check with current clock
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4168
    if( ( aPicture->iTimestamp.Int64() ) < ( ( iClockSource->Time().Int64() -
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4169
    		iTotalTime ) + KH264ENCIMPL_ENCODEAHEAD ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4170
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4171
        return EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4172
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4173
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4174
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4175
    return ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4176
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4177
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4178
//  Skips the Input Picture
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4179
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4180
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4181
void CAriH264encHwDeviceImpl::SkipInputPicture( TVideoPicture *aPicture )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4182
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4183
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4184
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4185
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4186
	// add the buffer back to queue
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4187
	if ( !iInputBufReturnToPreProc )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4188
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4189
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::SkipInputPicture()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4190
				"-return picture back to client" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4191
		iMMFDevVideoRecordProxy->MdvrpReturnPicture( aPicture );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4192
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4193
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4194
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4195
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::SkipInputPicture()-"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4196
				"return picture back to Input Device" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4197
		iInputDevice->ReturnPicture( aPicture );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4198
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4199
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4200
	if ( !iFrozen )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4201
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4202
		iPictureCounters.iPicturesSkippedRateControl++;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4203
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4204
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4205
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4206
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4207
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4208
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4209
// Indicates whether the next frame is to be encoded as an I frame
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4210
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4211
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4212
TBool CAriH264encHwDeviceImpl::IsForcedIFrameRequired(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4213
													TVideoPicture* aPicture )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4214
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4215
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4216
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4217
    if( ( aPicture->iOptions & TVideoPicture::EReqInstantRefresh ) ||
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4218
	   iPictureLoss )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4219
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4220
		PRINT_MSG( LEVEL_HIGH, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4221
				"::IsForcedIFrameRequired() ETrue 1--" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4222
        return ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4223
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4224
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4225
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4226
    return EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4227
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4228
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4229
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4230
//  Extracts 1 packet from a frame and Fills output buffer with the same
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4231
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4232
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4233
void CAriH264encHwDeviceImpl::FillVideoSegment(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4234
		TVideoOutputBuffer* aOutputBuf, TVideoOutputBuffer* aSrcOutputBuf )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4235
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4236
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4237
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4238
	// first time fill all config information in one o/p buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4239
	if ( iIsConfigDataFilledInFirstOutputBuffer )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4240
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4241
		TUint configDataLength = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4242
        TUint* startPtr = iPacketOffSetCurrentPosition;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4243
        TInt noOfConfigParamas = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4244
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4245
#ifdef EMZ_AVC_ENC_CODEC_SEIINFO_ENABLE
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4246
        PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::FillVideoSegment() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4247
        		"SEI enabled" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4248
		noOfConfigParamas= KNumOfConfigParams_SEI;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4249
#else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4250
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::FillVideoSegment() "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4251
				"SEI disabled" ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4252
		noOfConfigParamas= KNumOfConfigParams;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4253
#endif
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4254
		for( TInt i = 0; i < noOfConfigParamas; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4255
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4256
			configDataLength += * ( ++startPtr ) ++;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4257
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4258
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4259
		// copy data into output buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4260
		Mem::Copy( ( TUint8* )( ( TUint8* )aOutputBuf->iData.Ptr() ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4261
				( TUint8* )( aSrcOutputBuf->iData.Ptr() ), configDataLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4262
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4263
		iTotalLengthFilledSoFarInPacketMode += configDataLength;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4264
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4265
		if( iH264EncInitParams.iDataEncapsulation == EDuGenericPayload )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4266
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4267
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4268
			// word boundary calculation
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4269
			TUint32 offset =  ( TUint32 )( ( TUint8* )aOutputBuf->iData.Ptr()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4270
							+ configDataLength	);
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4271
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4272
			if ( offset % KWordLength )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4273
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4274
				offset	=  KWordLength - ( offset % KWordLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4275
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4276
			else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4277
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4278
				offset	=  0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4279
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4280
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4281
			configDataLength += offset;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4282
			TUint8* ptr = ( ( TUint8* )aOutputBuf->iData.Ptr()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4283
							+ configDataLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4284
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4285
			// copy offset and length information
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4286
			Mem::Copy( ptr, ( TUint8* )iPacketOffSetCurrentPosition,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4287
						( noOfConfigParamas*KDoubleWordLength ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4288
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4289
			ptr += ( noOfConfigParamas * KDoubleWordLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4290
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4291
			//put the num of nal units information
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4292
			TUint* nalInfo = ( TUint* )ptr;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4293
			nalInfo[0] = noOfConfigParamas;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4294
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4295
			configDataLength += ( ( noOfConfigParamas*KDoubleWordLength ) +
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4296
								KWordLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4297
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4298
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4299
        // increment the packet offsetpointer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4300
		iPacketOffSetCurrentPosition += ( noOfConfigParamas * 2 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4301
		aOutputBuf->iData.Set( aOutputBuf->iData.Ptr(),configDataLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4302
		iIsConfigDataFilledInFirstOutputBuffer = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4303
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4304
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4305
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4306
		TUint currentPacketLength = *( ++iPacketOffSetCurrentPosition );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4307
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4308
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl::FillVideoSegment()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4309
				" currentPacketLength is %d", ( TInt )currentPacketLength ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4310
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4311
		if ( iTotalLengthFilledSoFarInPacketMode
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4312
				< iTotalOutputBufferLengthInPacketMode )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4313
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4314
			Mem::Copy( ( TUint8* )( aOutputBuf->iData.Ptr() ),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4315
				( TUint8* )( aSrcOutputBuf->iData.Ptr() +
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4316
				iTotalLengthFilledSoFarInPacketMode ), currentPacketLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4317
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4318
			aOutputBuf->iData.Set( aOutputBuf->iData.Ptr(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4319
										currentPacketLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4320
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4321
			iTotalLengthFilledSoFarInPacketMode
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4322
				= iTotalLengthFilledSoFarInPacketMode + currentPacketLength;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4323
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4324
			if ( iH264EncInitParams.iDataEncapsulation == EDuGenericPayload )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4325
				{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4326
				// fill the offset and length information
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4327
				TUint32 offset = ( TUint32 )( aOutputBuf->iData.Ptr()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4328
									+ currentPacketLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4329
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4330
				if ( offset % KWordLength )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4331
					{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4332
					offset = ( KWordLength - ( offset % KWordLength ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4333
					}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4334
				else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4335
					{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4336
					offset	=  0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4337
					}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4338
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4339
				TUint* ptr = ( TUint* ) ( aOutputBuf->iData.Ptr()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4340
							+ currentPacketLength + offset );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4341
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4342
				ptr[0] = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4343
				ptr[1] = *( iPacketOffSetCurrentPosition );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4344
				ptr[2] = 1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4345
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4346
				aOutputBuf->iData.Set( aOutputBuf->iData.Ptr(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4347
							currentPacketLength + offset + KDoubleWordLength
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4348
							+ KWordLength );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4349
				}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4350
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4351
				if ( iTotalLengthFilledSoFarInPacketMode  ==
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4352
							iTotalOutputBufferLengthInPacketMode )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4353
					{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4354
					iTotalLengthFilledSoFarInPacketMode = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4355
					iPacketsPending	 = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4356
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4357
					// remove packet offset info buffer from filled Q and
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4358
					// add it to free Q
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4359
					TUint* freeOffsetLengthInfoBuffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4360
							= iFilledBufferQueueForPacketOffsetInfo[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4361
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4362
					iFilledBufferQueueForPacketOffsetInfo.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4363
					TInt error = iFreeBufferQueueForPacketOffsetInfo.Append(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4364
											freeOffsetLengthInfoBuffer );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4365
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4366
					if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4367
						{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4368
						ClientFatalError( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4369
						return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4370
						}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4371
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4372
					// Remove the internal buffer and add it back to process
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4373
					// engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4374
					if ( iInternalOutputBufferQueue.Count() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4375
						{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4376
						TVideoOutputBuffer* outBuf
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4377
							= iInternalOutputBufferQueue[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4378
						iInternalOutputBufferQueue.Remove( 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4379
						outBuf->iData.Set( ( TUint8* )outBuf->iData.Ptr(),
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4380
														iOutputBufferSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4381
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4382
						// Add the Buffer back to the Process Engine
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4383
						if( ( !iEncStateMac->IsInputEndPending() ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4384
								( !iEncStateMac->IsStopped() ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4385
							{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4386
							iEngine->AddOutput( ( TAny* )outBuf );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4387
							}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4388
						}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4389
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4390
					// Still more encoded packets are available
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4391
					if( iInternalOutputBufferQueue.Count() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4392
						{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4393
						iPacketsPending = ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4394
						iTotalOutputBufferLengthInPacketMode
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4395
							= iInternalOutputBufferQueue[0]->iData.Length();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4396
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4397
						// Get the packet offset info buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4398
						if( iFilledBufferQueueForPacketOffsetInfo.Count() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4399
							{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4400
							iPacketOffSetCurrentPosition
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4401
								= iFilledBufferQueueForPacketOffsetInfo[0];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4402
							}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4403
						}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4404
					}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4405
				else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4406
					{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4407
					++iPacketOffSetCurrentPosition;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4408
					}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4409
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4410
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4411
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4412
    // Update the specific members of the output buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4413
	aOutputBuf->iRequiredSeveralPictures
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4414
		= aSrcOutputBuf->iRequiredSeveralPictures;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4415
    aOutputBuf->iRandomAccessPoint = aSrcOutputBuf->iRandomAccessPoint;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4416
	aOutputBuf->iCaptureTimestamp  = aSrcOutputBuf->iCaptureTimestamp;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4417
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4418
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4419
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4420
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4421
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4422
//  Initializes the members of the output coded buffers created
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4423
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4424
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4425
void CAriH264encHwDeviceImpl::InitializeOuputCodedBuffer(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4426
										TVideoOutputBuffer& aOutputBuffer )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4427
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4428
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4429
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4430
    aOutputBuffer.iOrderNumber = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4431
	aOutputBuffer.iMinErrorProtectionLevel = 1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4432
	aOutputBuffer.iMaxErrorProtectionLevel = 1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4433
    aOutputBuffer.iRequiredThisPicture = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4434
	aOutputBuffer.iLayer = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4435
	aOutputBuffer.iInLayerScalabilityStep = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4436
	aOutputBuffer.iDataPartitionNumber = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4437
    aOutputBuffer.iHrdVbvParams.Set( NULL, 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4438
	aOutputBuffer.iCodingStandardSpecificData.Set( NULL, 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4439
	aOutputBuffer.iImplementationSpecificData.Set( NULL, 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4440
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4441
    // The following members will be modified later during execution
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4442
    aOutputBuffer.iRequiredSeveralPictures = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4443
    aOutputBuffer.iRandomAccessPoint = EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4444
    aOutputBuffer.iCaptureTimestamp = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4445
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4446
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4447
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4448
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4449
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4450
//   Sets level and bitrate based on size information
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4451
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4452
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4453
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4454
void CAriH264encHwDeviceImpl::SetLevelAndBitRate()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4455
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4456
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4457
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4458
	if( (iH264EncInitParams.iPictureSize.iWidth <= KH264ENCIMPL_QCIF_WIDTH )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4459
				&& ( iH264EncInitParams.iPictureSize.iHeight
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4460
								<= KH264ENCIMPL_QCIF_HEIGHT ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4461
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4462
	    iH264EncInitParams.iLevel = KH264ENCIMPL_LEVEL_1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4463
		iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_1;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4464
        iH264EncInitParams.iTargetPictureRate = KPictureRate15;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4465
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4466
	//QVGA
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4467
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4468
		if( ( iH264EncInitParams.iPictureSize.iWidth
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4469
						<= KH264ENCIMPL_QVGA_WIDTH ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4470
							( iH264EncInitParams.iPictureSize.iHeight
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4471
								<= KH264ENCIMPL_QVGA_HEIGHT ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4472
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4473
	    iH264EncInitParams.iLevel = KH264ENCIMPL_LEVEL_12;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4474
		iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_12;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4475
        iH264EncInitParams.iTargetPictureRate = KPictureRate15;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4476
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4477
	//CIF
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4478
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4479
		if( ( iH264EncInitParams.iPictureSize.iWidth
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4480
					<= KH264ENCIMPL_CIF_WIDTH ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4481
						( iH264EncInitParams.iPictureSize.iHeight
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4482
								<= KH264ENCIMPL_CIF_HEIGHT ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4483
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4484
	    iH264EncInitParams.iLevel = KH264ENCIMPL_LEVEL_13;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4485
		iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_13;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4486
        iH264EncInitParams.iTargetPictureRate = KPictureRate30;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4487
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4488
	// VGA
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4489
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4490
		if( ( iH264EncInitParams.iPictureSize.iWidth
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4491
				<= KH264ENCIMPL_VGA_WIDTH ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4492
					( iH264EncInitParams.iPictureSize.iHeight
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4493
							<= KH264ENCIMPL_VGA_HEIGHT ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4494
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4495
	    iH264EncInitParams.iLevel = KH264ENCIMPL_LEVEL_22;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4496
		iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_22;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4497
        iH264EncInitParams.iTargetPictureRate = KPictureRate15;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4498
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4499
	else
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4500
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4501
	    iH264EncInitParams.iLevel = KH264ENCIMPL_LEVEL_3;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4502
		iH264EncInitParams.iBitRate = KH264ENCIMPL_BITRATE_LEVEL_3;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4503
        iH264EncInitParams.iTargetPictureRate = KPictureRate25;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4504
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4505
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4506
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4507
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4508
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4509
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4510
//  Checks if the specified input format is supported or not
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4511
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4512
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4513
TBool CAriH264encHwDeviceImpl::CheckInputFormat(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4514
					const TUncompressedVideoFormat& aFormat )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4515
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4516
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4517
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4518
	// Check if encoder supports the passed input format
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4519
	if ( aFormat.iDataFormat != EYuvRawData )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4520
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4521
		return EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4522
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4523
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4524
	if ( aFormat.iYuvFormat.iDataLayout != EYuvDataPlanar )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4525
	   {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4526
		PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4527
		return EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4528
	   }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4529
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4530
	if ( ( aFormat.iYuvFormat.iCoefficients != EYuvBt709Range0 ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4531
		 ( aFormat.iYuvFormat.iCoefficients != EYuvBt709Range1 ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4532
		 ( aFormat.iYuvFormat.iCoefficients != EYuvBt601Range0 ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4533
		 ( aFormat.iYuvFormat.iCoefficients != EYuvBt601Range1 ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4534
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4535
		return EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4536
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4537
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4538
	if ( ( aFormat.iYuvFormat.iPattern != EYuv420Chroma1 ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4539
		 ( aFormat.iYuvFormat.iPattern != EYuv420Chroma2 ) &&
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4540
		 ( aFormat.iYuvFormat.iPattern != EYuv420Chroma3 ) )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4541
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4542
		return EFalse;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4543
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4544
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4545
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4546
	return ETrue;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4547
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4548
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4549
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4550
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4551
//  Nofities the client that the fatal error happend in Hw device
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4552
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4553
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4554
void CAriH264encHwDeviceImpl::ClientFatalError( TInt aError )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4555
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4556
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4557
	PRINT_MSG( LEVEL_CRITICAL, ("CAriH264encHwDeviceImpl::ClientFatalError()"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4558
			" Error is %d", aError ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4559
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4560
    if( iClockSource )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4561
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4562
        iPeriodicTimer->Cancel();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4563
    	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4564
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4565
	// Stop processing
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4566
	if( !iEncStateMac->IsStopped() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4567
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4568
		if( iEncStateMac->IsInitialized() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4569
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4570
			Stop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4571
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4572
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4573
	iEncStateMac->Transit( CStateMachine::EDeadStateCommand );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4574
	iMMFDevVideoRecordProxy->MdvrpFatalError( this, aError );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4575
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4576
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4577
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4578
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4579
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4580
//  Output buffers are created with the specified size
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4581
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4582
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4583
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4584
void CAriH264encHwDeviceImpl::ReallocSegmentOutputBuffersL( TUint aSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4585
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4586
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4587
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4588
	TInt count = iOutputFreeBufferQueue.Count();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4589
    for ( TInt i = 0; i < count; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4590
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4591
		// dellallocate memory for this buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4592
		TVideoOutputBuffer* ouputBuf = iOutputFreeBufferQueue[i];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4593
        if ( ouputBuf->iData.Ptr() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4594
        	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4595
            delete ( TUint8* )ouputBuf->iData.Ptr();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4596
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4597
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4598
		// and allocate memory and store it in temp Q
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4599
		TUint8* ptr = new ( ELeave ) TUint8[aSize];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4600
		CleanupStack::PushL( ptr );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4601
		ouputBuf->iData.Set( ptr, aSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4602
		CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4603
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4604
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4605
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4606
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4607
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4608
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4609
//  Reallocates single buffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4610
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4611
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4612
void CAriH264encHwDeviceImpl::ReallocateSegmentBufferL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4613
									TVideoOutputBuffer* aBuffer )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4614
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4615
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4616
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4617
	TInt size = iH264EncInitParams.iMaxCodedSegmentSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4618
	if( iH264EncInitParams.iDataEncapsulation == EDuGenericPayload )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4619
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4620
		size += KDoubleWordLength + KWordLength;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4621
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4622
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4623
    if ( aBuffer->iData.Ptr() )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4624
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4625
        delete ( TUint8* )aBuffer->iData.Ptr();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4626
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4627
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4628
	// and allocate memory and store it in temp Q
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4629
	TUint8* ptr = new ( ELeave ) TUint8[size];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4630
	CleanupStack::PushL( ptr );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4631
	aBuffer->iData.Set( ptr, ( size ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4632
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4633
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4634
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4635
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4636
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4637
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4638
//  Creates single buffer for frame mode to packet mode change
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4639
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4640
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4641
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4642
void CAriH264encHwDeviceImpl::CreateCodedBufferForModeChangeL()
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4643
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4644
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4645
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4646
	iCodedBufferForPacketModeChange = new ( ELeave ) TVideoOutputBuffer;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4647
	TUint8* ptr = new ( ELeave ) TUint8[iOutputBufferSize];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4648
	CleanupStack::PushL( ptr );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4649
	iCodedBufferForPacketModeChange->iData.Set( ptr, iOutputBufferSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4650
	CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4651
    InitializeOuputCodedBuffer( *iCodedBufferForPacketModeChange );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4652
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4653
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4654
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4655
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4656
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4657
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4658
//  Creates buffers which are used as output buffers in packet mode. Function
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4659
//  is called only when frame mode - packet mode change occurs while encoding
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4660
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4661
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4662
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4663
void CAriH264encHwDeviceImpl::CreateSegmentOutputBuffersL(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4664
										TUint aNumOfBuffers, TUint aSize )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4665
	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4666
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4667
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4668
	TInt segmentSize = aSize;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4669
	// 4+4 bytes for offset and length
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4670
	if( iH264EncInitParams.iDataEncapsulation == EDuGenericPayload )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4671
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4672
		segmentSize += KDoubleWordLength + KWordLength;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4673
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4674
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4675
    // Allocate memory for TVideoOutputBuffer
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4676
    iSegmentBuffers  = new ( ELeave ) TVideoOutputBuffer[aNumOfBuffers];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4677
    for ( TInt i = 0; i < aNumOfBuffers; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4678
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4679
        iSegmentBuffers[i].iData.Set( NULL, 0 );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4680
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4681
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4682
    // Create the Buffer and add it to Queue
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4683
    for ( TInt i = 0; i < aNumOfBuffers; i++ )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4684
    	{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4685
        TUint8* ptr = new ( ELeave ) TUint8[segmentSize];
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4686
        CleanupStack::PushL( ptr );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4687
        iSegmentBuffers[i].iData.Set( ptr, segmentSize );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4688
		CleanupStack::Pop();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4689
        InitializeOuputCodedBuffer( iSegmentBuffers[i] );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4690
        TInt error = iOutputFreeBufferQueue.Append( iSegmentBuffers + i );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4691
		if ( error != KErrNone )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4692
			{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4693
			PRINT_ERR( "Error while appending segment output buffer to the"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4694
					"segment output buffer queue" );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4695
			User::Leave( error );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4696
			return;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4697
			}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4698
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4699
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4700
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4701
	}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4702
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4703
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4704
//  Calculates the instant bit rate
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4705
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4706
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4707
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4708
void CAriH264encHwDeviceImpl::CalculateInstantBitRate(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4709
							const TVideoOutputBuffer &aOutBuf )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4710
    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4711
	PRINT_ENTRY;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4712
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4713
    TInt size = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4714
	TReal ts = ( ( aOutBuf.iCaptureTimestamp ).Int64() ) / 1000000.0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4715
	size = aOutBuf.iData.Length();
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4716
	TInt32 partInt = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4717
	Math::Int( partInt, ts );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4718
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4719
	// Calculate stream size, averaged per 1 second
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4720
	if ( partInt > iCurrentIntTS )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4721
		{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4722
	#ifdef DEBUG_INFO
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4723
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4724
				"::CalculateInstantBitRate(), Stream size per 1 second:  %d",
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4725
				iStreamSize * 8 ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4726
		PRINT_MSG( LEVEL_LOW, ("CAriH264encHwDeviceImpl"
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4727
				"::CalculateInstantBitRate(), Number of frames per 1 second: "
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4728
				" %d", iNoOfOutputFramesPerSec ) );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4729
	#endif
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4730
		// Reset global stream size
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4731
		iStreamSize = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4732
		iNoOfOutputFramesPerSec = 0;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4733
		iCurrentIntTS = partInt;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4734
		}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4735
    iSizePerFrame = iSizePerFrame + size;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4736
	iStreamSize = iStreamSize + size;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4737
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4738
	PRINT_EXIT;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4739
    }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4740
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4741
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4742
//  The implementation table entry which indicates the 1st function
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4743
// to call when H264 encoder hwdevice plugin is selected
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4744
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4745
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4746
const TImplementationProxy ImplementationTable[] =
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4747
    {
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4748
		{ KUidH264EncoderHwDeviceImplUid,
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4749
				( TProxyNewLPtr )( CAriH264encHwDeviceImpl::NewL ) }
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4750
    };
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4751
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4752
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4753
// Returns the implementation table
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4754
//----------------------------------------------------------------------------
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4755
//
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4756
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4757
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4758
													TInt& aTableCount )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4759
{
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4760
	aTableCount = sizeof( ImplementationTable )
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4761
					/ sizeof( TImplementationProxy );
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4762
	return ImplementationTable;
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4763
}
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4764
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4765
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4766
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4767
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4768
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4769
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4770
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4771
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4772
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4773
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4774
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4775
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4776
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4777
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4778
bb31fbe78861 Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff changeset
  4779