videoeditorengine/avcedit/inc/vedavcedit.h
changeset 9 d87d32eab1a9
parent 0 951a5db380a0
equal deleted inserted replaced
0:951a5db380a0 9:d87d32eab1a9
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "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 * Ixonos Plc
       
    14 *
       
    15 * Description:  
       
    16 * A header file defining the AVC editing API.
       
    17 *                
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef VEDAVCEDIT_H
       
    24 #define VEDAVCEDIT_H
       
    25 
       
    26 #include <e32base.h>
       
    27 
       
    28 /**
       
    29 *  CVedAVCEdit abstract base class for AVC editing class
       
    30 *
       
    31 *  @lib vedAVCEdit
       
    32 *  @since
       
    33 */
       
    34 class CVedAVCEdit : public CBase
       
    35     {
       
    36 
       
    37     public:  // Constants
       
    38 
       
    39     public:  // Constructors and destructor        	
       
    40 
       
    41         /**
       
    42         * Two-phased constructor.
       
    43         *
       
    44         */
       
    45         IMPORT_C static CVedAVCEdit* NewL();
       
    46         
       
    47         /**
       
    48         * Destructor.
       
    49         */
       
    50         virtual ~CVedAVCEdit();
       
    51 
       
    52     public:  // New functions
       
    53     
       
    54     	/*
       
    55         * Add MDF specific NAL headers to input AVC frame
       
    56         * 
       
    57         * @param aBuf Input/output buffer
       
    58         * @param aFrameLen Input/output frame length
       
    59         * @param aDecInfoSize Decoder specific info size
       
    60         * @param aFirstFrame ETrue for first frame in sequence
       
    61         */                
       
    62 	    virtual void ProcessAVCBitStreamL(TDes8& aBuf, TInt& aFrameLen, TInt aDecInfoSize, TBool aFirstFrame) = 0;		
       
    63 
       
    64  	    /*
       
    65         * Calculate default value for no. of buffered frames according to 
       
    66         * H.264 spec Annex A
       
    67         * 
       
    68         * @param aLevel AVC level
       
    69         * @param aResolution Video resolution        
       
    70         */
       
    71 	    virtual TInt GetMaxAVCFrameBuffering(TInt aLevel, TSize aResolution) = 0;
       
    72 	    
       
    73 	    /*
       
    74         * Get input bitstream level from SPS. Note: SPS Nal unit must be at the 
       
    75         * beginning of the input buffer
       
    76         * 
       
    77         * @param aBuf Input buffer containing SPS
       
    78         * @param aLevel Output: Baseline profile level
       
    79         */        
       
    80         virtual TInt GetLevel(TDesC8& aBuf, TInt& aLevel) = 0;
       
    81                 
       
    82         /*
       
    83         * Get input bitstream video resolution from SPS. Note: SPS Nal unit must 
       
    84         * be at the beginning of the input buffer
       
    85         * 
       
    86         * @param aBuf        Input buffer containing SPS
       
    87         * @param aResolution Output: Resolution
       
    88         */        
       
    89         virtual TInt GetResolution(TDesC8& aBuf, TSize& aResolution) = 0;
       
    90      
       
    91 #ifdef VIDEOEDITORENGINE_AVC_EDITING
       
    92 
       
    93         /*
       
    94         * Convert AVC specific decoder config info to AVCDecoderConfigurationRecord -format
       
    95         * 
       
    96         * @param aSrcBuf Source buffer containing SPS/PPS NAL units in AVC MDF buffer format
       
    97         * @param aDstBuf Destination buffer for AVCDecoderConfigurationRecord        
       
    98         */        
       
    99         virtual void ConvertAVCHeaderL(TDesC8& aSrcBuf, TDes8& aDstBuf ) = 0;	    
       
   100 
       
   101 	    /*
       
   102         * Save SPS/PPS NAL units from AVCDecoderConfigurationRecord
       
   103         * for later use
       
   104         *  
       
   105         * @param aBuf Input buffer containing AVCDecoderConfigurationRecord        
       
   106         */                
       
   107 	    virtual void SaveAVCDecoderConfigurationRecordL(TDes8& aBuf, TBool aFromEncoder) = 0;	    
       
   108 	    
       
   109 	    /*
       
   110         * Update slice header information: frame number and PPS id        
       
   111         * 
       
   112         * @param aBuf Buffer containing input frame
       
   113         * @param aContainsDCR ETrue if AVC decoder config. record is included
       
   114         * @param aFromEncoder ETrue if frame comes from the encoder
       
   115         */	    
       
   116         virtual TInt ParseFrame(HBufC8*& aBuf, TBool aContainsDCR, TBool aFromEncoder) = 0;
       
   117         
       
   118         /*
       
   119         * Constructs AVCDecoderConfigurationRecord for the whole sequence, taking
       
   120         * into account all input DCR's        
       
   121         *  
       
   122         * @param aDstBuf Destination buffer for AVCDecoderConfigurationRecord        
       
   123         * @param aLevel Level output sequence    
       
   124         */      
       
   125         virtual void ConstructAVCDecoderConfigurationRecordL( TDes8& aDstBuf ) = 0;
       
   126 
       
   127         /*
       
   128         * Set length of NAL size field of output sequence
       
   129         * 
       
   130         * @param aSize Length of size field in bytes        
       
   131         */	    
       
   132         virtual void SetNALLengthSize( TInt aSize ) = 0;
       
   133         
       
   134         /*
       
   135         * Set output level for constructing AVCDecoderConfigurationRecord
       
   136         * 
       
   137         * @param aLevel Output level
       
   138         */	   
       
   139         virtual void SetOutputLevel(TInt aLevel) = 0;
       
   140         
       
   141         /*
       
   142         * Check if encoding is required until the next IDR unit
       
   143         * 
       
   144         */	   
       
   145         virtual TBool EncodeUntilIDR() = 0;
       
   146         
       
   147         /*
       
   148         * Check if NAL unit is an IDR NAL
       
   149         * 
       
   150         * @param aNalBuf buffer containing NAL unit
       
   151         */	   
       
   152         virtual TBool IsNALUnitIDR( TDes8& aNalBuf ) = 0;
       
   153         
       
   154         /*
       
   155         * Store PPS id from the current slice
       
   156         * 
       
   157         * @param aNalBuf buffer containing NAL unit
       
   158         */	   
       
   159 		virtual void StoreCurrentPPSId( TDes8& aNalBuf ) = 0;
       
   160 
       
   161         /*
       
   162         * Generate a not coded frame
       
   163         * 
       
   164         * @param aNalBuf buffer containing NAL unit
       
   165         */	   
       
   166 		virtual TInt GenerateNotCodedFrame( TDes8& aNalBuf, TUint aFrameNumber ) = 0;
       
   167 
       
   168         /*
       
   169         * Modify the frame number of the NAL unit
       
   170         * 
       
   171         * @param aNalBuf buffer containing NAL unit
       
   172         */	   
       
   173 		virtual void ModifyFrameNumber( TDes8& aNalBuf, TUint aFrameNumber ) = 0;
       
   174 #endif
       
   175 
       
   176 };
       
   177 
       
   178 
       
   179 #endif
       
   180 
       
   181 // End of File