videoeditorengine/h263decoder/inc/h263dmai.h
changeset 0 951a5db380a0
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     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 h.263 decoder API.               
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef H263DMAIN_H
       
    22 #define H263DMAIN_H
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 
       
    27 /*
       
    28  * Structs and typedefs
       
    29  */
       
    30 /* This structure is used to indicate the operating mode. */
       
    31 
       
    32 /* Time change for merging MPEG-4 clips */
       
    33 typedef struct MPEG4TimeParameter
       
    34 {
       
    35     int modulo_time_base;       /* the time base of the video clip representing one second of duration */
       
    36     int time_inc;           /* the time increment from the synchronization point marked by modulo_time_base */
       
    37 } tMPEG4TimeParameter;
       
    38 
       
    39 /* Editing parameters passed to decoder for compressed domain editing */
       
    40 typedef struct 
       
    41 {
       
    42   TInt aColorEffect;	  /* special color effect (None/B&W/ColorTone) */
       
    43   TInt aColorToneU;       /* color tone value for U */
       
    44   TInt aColorToneV;       /* color tone value for V */
       
    45   TBool aGetVideoMode;    /* true if we need to get mode information from VOL */
       
    46   TBool fModeChanged;     /* true if bitstream mode needs to be changed (transcoding needed within MPEG-4) */ 
       
    47   TBool fHaveDifferentModes;  /* true if different MPEG-4 modes exist within movie */
       
    48   TBool aGetDecodedFrame; /* true if we need to return fully decoded frame */
       
    49   TInt aFrameOperation;   /* type of decoding operation neded: 1=EDecodeAndWrite,2=EDecodeNoWrite, 3=EWriteNoDecode */
       
    50   TInt aVideoClipNumber;  /* the index number of the video clip that this frame is part of */
       
    51   TInt aSMSpeed;          /* slow motion speed (25-100) */
       
    52 
       
    53   TInt *aTrP;             /* time increment value of previous frame */
       
    54   TInt *aTrD;             /* time duration of previous frame */
       
    55   tMPEG4TimeParameter * aMPEG4TimeStamp; /* time stamp of MPEG-4 frame */
       
    56   TInt aMPEG4DurationInMs;               /* time duration of MPEG-4 frame in millisec */
       
    57   TInt *aMPEG4TargetTimeResolution; /* time increment resolution of output video - returned from the decoder */
       
    58   TInt aFirstFrameQp;       /* QP of first frame, used for MPEG4 color toning */
       
    59 
       
    60   TInt aOutputVideoFormat;  /* video format of output movie */
       
    61   TInt iTimeIncrementResolution;  /* time increment resolution for current frame, if MPEG-4 */
       
    62   TInt vosHeaderSize;       /* VOS header size for current clip, if MPEG-4 */
       
    63   TInt streamMode;          /* current bitstream mode (data partition, regular, etc.) */
       
    64 
       
    65 }vdeDecodeParamters_t;
       
    66 
       
    67 /*
       
    68  * Classes 
       
    69  */
       
    70 class MVideoRenderer;
       
    71 
       
    72 /**
       
    73 *  CVedH263Dec abstract class for H.263 decoder
       
    74 *
       
    75 *  @lib vedh263d
       
    76 *  @since
       
    77 */
       
    78 class CVedH263Dec : public CBase
       
    79     {
       
    80 
       
    81     public:  // Constants
       
    82 
       
    83         // post-filter type
       
    84         enum TPostFilter
       
    85         {
       
    86             ENoFilter = 0,
       
    87             EH263AnnexJFilter,
       
    88             EH263TMNFilter,
       
    89             ENokiaFilter
       
    90         };
       
    91         
       
    92         // color effect
       
    93         enum TColorEffect
       
    94         {
       
    95             EColorEffectNone = 0,
       
    96             EColorEffectBlackAndWhite = 1,
       
    97             EColorEffectToning = 2        // ColorToning feature
       
    98         }; 
       
    99 
       
   100         // error codes
       
   101         enum TErrorCode
       
   102         {
       
   103             EInternalAssertionFailure = -10000,
       
   104             EDecoderFailure = -10001,
       
   105             EDecoderNoIntra = -10002,
       
   106             EDecoderCorrupted = -10003
       
   107         };
       
   108 
       
   109 
       
   110     public:
       
   111 
       
   112         /**
       
   113         * Two-phased constructor.
       
   114         * @aFrameSize Indicates the size of the input frames which will be decoded
       
   115         * @aNumReferencePictures indicates the number of reference pictures 
       
   116         */
       
   117 
       
   118         IMPORT_C static CVedH263Dec* NewL(const TSize aFrameSize, const TInt aNumReferencePictures);
       
   119 
       
   120     public:  // new functions        
       
   121 
       
   122         /**
       
   123         * Sets the renderer object to be used
       
   124         * @since
       
   125         * @param aRenderer Pointer to the renderer object
       
   126         * @return void
       
   127         */
       
   128         virtual void SetRendererL(MVideoRenderer* aRenderer) = 0;
       
   129 
       
   130         /**
       
   131         * Sets the post-filter to be used in decoding
       
   132         * @since
       
   133         * @param aFilter filter to be used
       
   134         * @return void
       
   135         */
       
   136         virtual void SetPostFilterL(const TPostFilter aFilter) = 0;
       
   137 
       
   138         /**
       
   139         * Checks if the given frame contains valid data which can be displayed
       
   140         * @since
       
   141         * @param aFrame Frame to be checked
       
   142         * @return TBool ETrue if frame is valid
       
   143         */
       
   144         virtual TBool FrameValid(const TAny* aFrame) = 0;
       
   145 
       
   146         /**
       
   147         * Retrieves pointers to Y/U/V data for the given frame
       
   148         * @since
       
   149         * @param aFrame Pointer to the frame
       
   150         * @param aYFrame top-left corner of the Y frame 
       
   151         * @param aUFrame top-left corner of the U frame
       
   152         * @param aVFrame top-left corner of the V frame
       
   153         * @param aFrameSize
       
   154         * @return TInt error code
       
   155         */
       
   156         virtual TInt GetYUVBuffers(const TAny* aFrame, TUint8*& aYFrame, TUint8*& aUFrame,          
       
   157             TUint8*& aVFrame, TSize& aFrameSize) = 0;
       
   158 
       
   159         /**
       
   160         * Returns the given output frame to the decoder after it is not needed
       
   161         * @since
       
   162         * @param aFrame Frame to be returned
       
   163         * @return void
       
   164         */
       
   165         virtual void FrameRendered(const TAny* aFrame) = 0;
       
   166 
       
   167         /**
       
   168         * Gets a pointer the latest decoded frame (YUV concatenated)
       
   169         * @since
       
   170         * @param aFrame Frame to be returned
       
   171         * @return TUint8* pointer to the frame
       
   172         */
       
   173         virtual TUint8* GetYUVFrame() = 0;
       
   174 
       
   175         /**
       
   176         * Decodes / transcodes a compressed frame
       
   177         * @since
       
   178         * @param aInputBuffer Descriptor for the input bitstream buffer
       
   179         * @param aOutputBuffer Descriptor for the output bitstream buffer
       
   180         * @param aFirstFrame Flag (input/output) for the first frame, non-zero if the first frame is being decoded
       
   181         * @param aBytesDecoded Number of bytes that were decoded to produce the output frame                
       
   182         * @param aColorEffect Color effect to be applied 
       
   183         * @param aGetDecodedFrame ETrue if the output frame needs to be retrieved from the decoder later
       
   184         * @param aFrameOperation Operation to be performed: 1=EDecodeAndWrite,2=EDecodeNoWrite, 3=EWriteNoDecode
       
   185         * @param aTrP 
       
   186         * @param aTrD
       
   187         * @param aVideoClipNumber Number of the video clip
       
   188         * @param aSMSpeed Slow motion speed, max = 1000
       
   189         * @param aDecoderInfo pointer to editing param struct
       
   190 		* @param aDataFormat Format of input/output data: 1 = H.263, 2 = MPEG-4
       
   191         * @return void
       
   192         */
       
   193 
       
   194         virtual void DecodeFrameL(const TPtrC8& aInputBuffer, TPtr8& aOutputBuffer,
       
   195                                   TBool& aFirstFrame, TInt& aBytesDecoded, 
       
   196                                   vdeDecodeParamters_t *aDecoderInfo) = 0;      
       
   197 
       
   198         virtual void DecodeFrameL(const TPtrC8& aInputBuffer, TPtr8& aOutputBuffer,
       
   199                                   TBool& aFirstFrame, TInt& aBytesDecoded, 
       
   200                                   const TColorEffect aColorEffect,
       
   201                                   const TBool aGetDecodedFrame, TInt aFrameOperation,
       
   202                                   TInt* aTrP, TInt* aTrD, TInt aVideoClipNumber, TInt aSMSpeed, 
       
   203                                   TInt aDataFormat) = 0;
       
   204         
       
   205         
       
   206         /**
       
   207         * Decodes a compressed frame
       
   208         * @since
       
   209         * @param aInputBuffer Descriptor for the input bitstream buffer
       
   210         * @param aFirstFrame Flag for the first frame, non-zero if the first frame is being decoded
       
   211         * @param aBytesDecoded Number of bytes that were decoded to produce the output frame        
       
   212 		* @param aDataFormat Format of input/output data: 1 = H.263, 2 = MPEG-4
       
   213         * @return void
       
   214         */
       
   215         virtual void DecodeFrameL(const TPtrC8& aInputBuffer, TBool& aFirstFrame, TInt& aBytesDecoded, 
       
   216                     TInt aDataFormat) = 0;
       
   217 
       
   218         /**
       
   219         * Check the VOS header of one frame
       
   220         * @since
       
   221         * @param aInputBuffer Descriptor for the input bitstream buffer
       
   222         * @return TBool ETrue the buffer is changed
       
   223         */
       
   224         virtual TBool CheckVOSHeaderL(TPtrC8& aInputBuffer) = 0;
       
   225 
       
   226 };
       
   227 
       
   228 /**
       
   229 *  MVideoRenderer Renderer interface for the H.263 decoder
       
   230 *
       
   231 *  @lib vedh263d
       
   232 *  @since
       
   233 */
       
   234 
       
   235 class MVideoRenderer
       
   236 {
       
   237 
       
   238 public:    
       
   239     virtual TInt RenderFrame(TAny* aFrame) = 0;
       
   240 
       
   241 };
       
   242 
       
   243 
       
   244 #endif
       
   245 
       
   246 // End of File