inc/FrameTable.h
changeset 0 71ca22bcf22a
child 12 2eb3b066cc7d
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Telephony Multimedia Service
       
    15  *
       
    16  */
       
    17 
       
    18 
       
    19 #ifndef CFRAMETABLE_H
       
    20 #define CFRAMETABLE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class MFrameTableEventObserver;
       
    27 
       
    28 // CLASS DEFINITIONS
       
    29 
       
    30 /**
       
    31  *  This class provides AAC utility functions.
       
    32  *
       
    33  *  @lib AACAudioControllerUtility.lib
       
    34  *  @since 3.0
       
    35  */
       
    36 class CFrameTable : public CBase
       
    37     {
       
    38 public:
       
    39     // Constructors and destructor
       
    40 
       
    41     enum TFrameTableEvent
       
    42         {
       
    43         EPosReached,
       
    44         EDecodeInterval,
       
    45         EPlayWindowEndPosReached
       
    46         };
       
    47 
       
    48     /**
       
    49      * Two-phased constructor.
       
    50      */
       
    51     IMPORT_C static CFrameTable* NewL();
       
    52 
       
    53     /**
       
    54      * Destructor.
       
    55      */
       
    56     IMPORT_C virtual ~CFrameTable();
       
    57 
       
    58 public:
       
    59     // New functions
       
    60 
       
    61     IMPORT_C TInt InitFrameTable(TInt aSampleRate, TInt aSamplesPerFrame);
       
    62     IMPORT_C TInt SubmitTableEntry(TUint aPos);
       
    63 
       
    64     IMPORT_C TInt FindFramePosFromTime(TUint& aTimeMs, TUint& aPos);
       
    65     IMPORT_C TInt FindFrameTimeFromPos(TUint& aTimeMs, TUint& aPos);
       
    66     IMPORT_C TInt LastFramePos(TUint& aPos);
       
    67     IMPORT_C TInt LastFrameTime(TUint& aTimeMs);
       
    68 
       
    69     IMPORT_C void ShrinkTable();
       
    70     IMPORT_C void ResetTable();
       
    71 
       
    72     IMPORT_C TInt SetSourceReference(TUint aTimeMs, TUint aPos);
       
    73 
       
    74     IMPORT_C TInt RegisterForEvent(TFrameTableEvent aEvent,
       
    75             MFrameTableEventObserver* aObserver, TUint aParam);
       
    76     IMPORT_C TInt UnRegisterForEvent(TFrameTableEvent aEvent,
       
    77             MFrameTableEventObserver* aObserver);
       
    78     IMPORT_C TInt Bitrate();
       
    79     IMPORT_C TInt IsSeeking(TBool& aIsSeeking);
       
    80     IMPORT_C TInt GetLastPosEvent(TUint& aPos);
       
    81 
       
    82 private:
       
    83 
       
    84     class TBufRefPosEntry
       
    85         {
       
    86 public:
       
    87         TUint iPos;
       
    88         TUint iFrameNum;
       
    89         };
       
    90 
       
    91     /**
       
    92      * C++ default constructor.
       
    93      */
       
    94     CFrameTable();
       
    95 
       
    96     /**
       
    97      * By default Symbian 2nd phase constructor is private.
       
    98      */
       
    99     void ConstructL();
       
   100 
       
   101     TUint CalcFrameFromTimeMs(TUint aTimeMs);
       
   102     TInt SubmitLowResTableEntry(TBufRefPosEntry& aEntry);
       
   103 
       
   104 private:
       
   105     // Data
       
   106 
       
   107     RArray<TBufRefPosEntry> iFrameTable;
       
   108     RArray<TBufRefPosEntry> iLowResFrameTable;
       
   109     TUint iSampleRate;
       
   110     TUint iSamplesPerFrame;
       
   111     TUint iMsecPerFrame;
       
   112     TUint iLastBytePos;
       
   113     TUint iAvgBitrate;
       
   114     TUint iOffset;
       
   115     TUint iTimeRefMs;
       
   116     TUint iBufCnt;
       
   117     TUint iPosEventMs;
       
   118     TUint iPlayWindowEndPosEventMs;
       
   119     TInt iIntervalRef;
       
   120     TUint iIntervalEvent;
       
   121     MFrameTableEventObserver* iObserver;
       
   122     TUint iEventPos;
       
   123     TUint iCurrentFrameCount;
       
   124     TUint iFramesPerLowResInterval;
       
   125     TUint iLowResIntervalMs;
       
   126     TUint iFrameNum;
       
   127     TBool iOkToShrink;
       
   128     };
       
   129 
       
   130 class MFrameTableEventObserver
       
   131     {
       
   132 public:
       
   133     virtual TInt
       
   134             HandleFrameTableEvent(CFrameTable::TFrameTableEvent aEvent) = 0;
       
   135     };
       
   136 
       
   137 #endif 		// CFRAMETABLE_H
       
   138 // End of File