videoeditorengine/h263decoder/inc/h263dext.h
branchRCL_3
changeset 3 e0b5df5c0969
parent 0 951a5db380a0
child 7 4c409de21d23
equal deleted inserted replaced
0:951a5db380a0 3:e0b5df5c0969
     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 for external usage of the services provided by
       
    17 * the Video Decoder Engine.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef _H263DEXT_H_
       
    23 #define _H263DEXT_H_
       
    24 
       
    25 
       
    26 /*
       
    27  * Includes
       
    28  */
       
    29 
       
    30 //#include "renapi.h"
       
    31 #include "epoclib.h"
       
    32 
       
    33 /*
       
    34  * Defines
       
    35  */
       
    36 
       
    37 /* _WIN32_EXPLICIT has to be defined before anything else. */
       
    38 
       
    39 /* Return codes */
       
    40 #define H263D_OK_BUT_NOT_CODED   4     /* not coded frame, 
       
    41                                           copied to output as is, 
       
    42                                           no decoded output generated */  
       
    43 #define H263D_OK_BUT_BIT_ERROR   3     /* Bit errors detected but frame decoded */
       
    44 #define H263D_OK_BUT_FRAME_USELESS \
       
    45                                  2     /* function behaved normally, but no output
       
    46                                           was produced due to too corrupted frame */
       
    47 #define H263D_OK_EOS             1     /* End-of-Stream has been reached */
       
    48 #define H263D_OK                 0     /* the function was successful */
       
    49 #define H263D_ERROR             -1     /* indicates a general error */
       
    50 #define H263D_ERROR_NO_INTRA    -2     /* No INTRA frame has been decoded, 
       
    51                                           decoding cannot be started */
       
    52 #define H263D_ERROR_HALTED      -3     /* no further decoding possible */
       
    53 /* Note: In practice, there is no difference between H263D_ERROR and 
       
    54    H263D_ERROR_HALTED. The caller should react to both error messages
       
    55    in the same way. They both exist due to compatibility with older
       
    56    versions of the decoder. */
       
    57 
       
    58 
       
    59 /* Frame type scope. See h263dFrameType_t (in this file) for descriptions. */
       
    60 #define H263D_FTYPE_ALL       0xffffffff
       
    61 #define H263D_FTYPE_NDEF      0xffffffff
       
    62 #define H263D_FTYPE_DEF       0
       
    63 #define H263D_FTYPE_SIZE      0x00000001
       
    64 #define H263D_FTYPE_SNAPSHOT  0x00000002
       
    65 
       
    66 
       
    67 /* Mode values used in h263dSetStartOrEndCallback to select if the function
       
    68    scope is in the start of the frame (H263D_CB_START) 
       
    69    or in the end the frame (H263D_CB_END),
       
    70    or both (H263D_CB_START | H263D_CB_END). */
       
    71 #define H263D_CB_START     0x00000001
       
    72 #define H263D_CB_END       0x00000002
       
    73 
       
    74 
       
    75 /* H.263 Annex N submodes */
       
    76 #define H263D_BC_MUX_MODE_SEPARATE_CHANNEL   1  /* Separate Logical Channel 
       
    77                                                    submode*/
       
    78 #define H263D_BC_MUX_MODE_VIDEO              2  /* VideoMux submode */
       
    79 
       
    80 
       
    81 /* Error resilience features, see h263dSetErrorResilience for details */
       
    82 #define H263D_ERD_FEATURE_STATUS 1
       
    83 #define H263D_ERD_FEATURE_CHECK_ALL 2
       
    84 #define H263D_ERD_FEATURE_DISCARD_CORRUPTED 3
       
    85 
       
    86 #define H263D_ERD_INTRA_DCT_DOMAIN 0
       
    87 #define H263D_ERD_INTRA_PIXEL_DOMAIN 1
       
    88 
       
    89 #define H263D_ERD_INTER_NO_MOTION_COMPENSATION 0
       
    90 #define H263D_ERD_INTER_MOTION_COMPENSATION 1
       
    91 
       
    92 
       
    93 /* Output types, see h263dSetOutputFile for more information */
       
    94 #define H263D_OUT_FILE_MODE_FRAME_BY_FRAME      1
       
    95 #define H263D_OUT_FILE_MODE_ONE_PER_COMPONENT   2
       
    96 #define H263D_OUT_FILE_MODE_ONE_FOR_ALL         3
       
    97 
       
    98 
       
    99 
       
   100 /* Temporal/computational scalability levels, 
       
   101    see h263dSetTemporalScalabilityLevel for more details */
       
   102 #define H263D_LEVEL_ALL_FRAMES   0
       
   103 #define H263D_LEVEL_INTRA_FRAMES 1
       
   104 
       
   105 
       
   106 /* Calling convention for exported functions */
       
   107 #ifndef H263D_CC
       
   108    #define H263D_CC   
       
   109 #endif
       
   110 
       
   111 
       
   112 /* Calling convention for callback functions declared in the decoder */
       
   113 #ifndef H263D_CALLBACK   
       
   114    #define H263D_CALLBACK
       
   115 #endif
       
   116 
       
   117 
       
   118 /* Declaration specifier for exported functions */
       
   119 #ifndef H263D_DS
       
   120    #define H263D_DS
       
   121 #endif
       
   122 
       
   123 
       
   124 /*
       
   125  * Structs and typedefs
       
   126  */
       
   127 
       
   128 /* size_t */
       
   129    typedef unsigned int size_t;
       
   130 
       
   131 
       
   132 /* {{-output"h263dHInstance_t_info.txt" -ignore"*" -noCR}}
       
   133    h263dHInstance_t is used as a unique identifier of a H.263 Video Decoder
       
   134    instance.
       
   135    The type can be casted to u_int32 or void pointer and then back to
       
   136    h263dHInstance_t without any problems.
       
   137    {{-output"h263dHInstance_t_info.txt"}} */
       
   138 
       
   139 /* {{-output"h263dHInstance_t.txt"}} */
       
   140 typedef void * h263dHInstance_t;
       
   141 /* {{-output"h263dHInstance_t.txt"}} */
       
   142 
       
   143 
       
   144 /* {{-output"h263dFrameType_t_info.txt" -ignore"*" -noCR}}
       
   145    This structure is used to define a frame type scope for some setting
       
   146    functions.
       
   147    Currently, there are three scopes: the default scope (H263D_FTYPE_DEF),
       
   148    the frame size scope (H263D_FTYPE_SIZE) and the snapshot scope 
       
   149    (H263D_FTYPE_SNAPSHOT). If a setting is defined for a particular size, 
       
   150    all frames having that size will be handled according to the setting, 
       
   151    i.e. the frame size scope overrides the default scope. Later on, it may 
       
   152    be possible to add more frame types scopes, like the enchancement layer 
       
   153    number or the snapshot tag (Annex L.8. of the H.263 recommendation). 
       
   154    Then, the scope order must also be defined. For example, if there are 
       
   155    two settings, one for a particular size and one for a particular enhancement 
       
   156    layer. If a frame fulfills both scopes, one has to know which scope has 
       
   157    the priority, e.g. that the frame has to be handled according to the 
       
   158    enchancement layer setting. There can also be a combination of scopes, 
       
   159    e.g. some setting may be defined for a particular frame size and 
       
   160    enhancement layer.
       
   161    {{-output"h263dFrameType_t_info.txt"}} */
       
   162 
       
   163 /* {{-output"h263dFrameType_t.txt"}} */
       
   164 typedef struct {
       
   165    u_int32 scope;       /* the scope of the frame type setting:
       
   166                            H263D_FTYPE_ALL
       
   167                               This setting overrides all previous settings,
       
   168                               i.e. it is valid for all frame types.
       
   169                            H263D_FTYPE_DEF
       
   170                               is used to define a setting for frame types
       
   171                               which do not have a specific setting of their
       
   172                               own.
       
   173                            H263D_FTYPE_SIZE
       
   174                               is used to define a setting for a particular
       
   175                               frame size.
       
   176 
       
   177                            H263D_FTYPE_SNAPSHOT
       
   178                               is used to define a setting for snapshot
       
   179                               frames.
       
   180 
       
   181                            For internal use only:
       
   182                            H263D_FTYPE_NDEF
       
   183                               is used in querying functions to solve the scope
       
   184                               depending on the parameters which are used.
       
   185                               All parameters must be set.
       
   186                         */
       
   187 
       
   188    int width;
       
   189    int height;          /* width and height of the frame which is in the scope
       
   190                            of the setting. These parameters are valid
       
   191                            only if scope indicates H263D_FTYPE_SIZE. */
       
   192    u_char fSnapshot;    /* snapshot flag, valid only if scope is 
       
   193                            H263D_FTYPE_SNAPSHOT */
       
   194 } h263dFrameType_t;
       
   195 /* {{-output"h263dFrameType_t.txt"}} */
       
   196 
       
   197 
       
   198 /* Used in h263dOpen_t to pass a callback function to call when decoding
       
   199    has to stopped. */
       
   200 typedef void (H263D_CALLBACK *h263dDecodingFinishedCallback_t) (void *);
       
   201 
       
   202 
       
   203 
       
   204 /* Prototype for callback function related to h263dSetStartOrEndCallback.
       
   205    See the function description for more details. */
       
   206 typedef void (H263D_CALLBACK *h263dStartOrEndCallback_t) 
       
   207    (u_int32, u_int32, void *);
       
   208 
       
   209 /* Prototype for callback function related to h263dSetStartOrEndSnapshotCallback.
       
   210    See the function description for more details. */
       
   211 typedef void (H263D_CALLBACK *h263dStartOrEndSnapshotCallback_t) (u_int32, u_int32, void *);
       
   212 
       
   213 /* Prototype for callback function related to h263dSetReportPictureSizeCallback.
       
   214    See the function description for more details. */
       
   215 typedef void (H263D_CALLBACK *h263dReportPictureSizeCallback_t) (void *, int, int);
       
   216                               
       
   217 typedef struct {
       
   218    int fExist;          /* 1 or 0 */
       
   219    u_int8 data[255];    /* header data */
       
   220    int length;          /* length of header data */
       
   221 } h263dMPEG4Header_t;
       
   222 
       
   223 /* {{-output"h263dOpen_t_info.txt" -ignore"*" -noCR}}
       
   224    This structure is used with the h263dOpen function to give the necessary
       
   225    data for opening a new H.263 Video Decoder Engine instance.
       
   226    {{-output"h263dOpen_t_info.txt"}} */
       
   227 
       
   228 /* {{-output"h263dOpen_t.txt"}} */
       
   229 typedef struct {
       
   230    int numPreallocatedFrames;    /* Number of preallocated frame memories */
       
   231 
       
   232    int lumWidth;                 /* Size of preallocated frame memories */
       
   233    int lumHeight;
       
   234 
       
   235    int fRPS;                     /* 1 = Reference Picture Selection mode in use */
       
   236 
       
   237    int numReferenceFrames;       /* number of reference frames in RPS mode */
       
   238 
       
   239    h263dDecodingFinishedCallback_t decodingFinishedCallback;
       
   240                                  /* callback function to call when no data has
       
   241                                     been decoded for a while */
       
   242 
       
   243    int decodingFinishedIdleTimeInMSec;
       
   244                                  /* number of milliseconds to go by until
       
   245                                     decodingFinishedCallback is called */
       
   246 
       
   247    h263dMPEG4Header_t mpeg4Header;
       
   248                                  /* MPEG-4 header received via H.245 */
       
   249 
       
   250    size_t freeSpace;             /* Used internally */
       
   251 } h263dOpen_t;
       
   252 /* {{-output"h263dOpen_t.txt"}} */
       
   253 
       
   254 
       
   255 /*
       
   256  * Function prototypes
       
   257  */
       
   258 
       
   259 H263D_DS int H263D_CC h263dFree(
       
   260    void);
       
   261 
       
   262 H263D_DS int H263D_CC h263dLoad(
       
   263    void);
       
   264 
       
   265 H263D_DS int H263D_CC h263dSetStartOrEndCallback(
       
   266    h263dHInstance_t hInstance,
       
   267    u_int32 mode, 
       
   268    h263dFrameType_t *frameType,
       
   269    h263dStartOrEndCallback_t callback, 
       
   270    u_int32 param);
       
   271 
       
   272 
       
   273 H263D_DS int H263D_CC h263dSetReportPictureSizeCallback(
       
   274    h263dHInstance_t hInstance, 
       
   275    h263dReportPictureSizeCallback_t callback);
       
   276 
       
   277 #endif
       
   278 // End of File