159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* ------------------------------------------------------------------
259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Copyright (C) 1998-2009 PacketVideo
359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *
459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Licensed under the Apache License, Version 2.0 (the "License");
559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * you may not use this file except in compliance with the License.
659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * You may obtain a copy of the License at
759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *
859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *      http://www.apache.org/licenses/LICENSE-2.0
959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *
1059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Unless required by applicable law or agreed to in writing, software
1159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * distributed under the License is distributed on an "AS IS" BASIS,
1259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
1359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * express or implied.
1459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * See the License for the specific language governing permissions
1559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * and limitations under the License.
1659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * -------------------------------------------------------------------
1759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong */
1859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifndef _MP4ENC_API_H_
1959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define _MP4ENC_API_H_
2059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
2159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#include <string.h>
2259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
2359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifndef _PV_TYPES_
2459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define _PV_TYPES_
2559f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef unsigned char UChar;
2659f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef char Char;
2759f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef unsigned int UInt;
2859f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef int Int;
2959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef unsigned short UShort;
3059f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef short Short;
3159f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef unsigned int Bool;
3259f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef unsigned long ULong;
3359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
3459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define PV_CODEC_INIT  0
3559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define PV_CODEC_STOP  1
3659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif
3759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
3859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define PV_TRUE  1
3959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define PV_FALSE 0
4059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
4159f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef enum
4259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
4359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    SHORT_HEADER,
4459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    SHORT_HEADER_WITH_ERR_RES,
4559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    H263_MODE,
4659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    H263_MODE_WITH_ERR_RES,
4759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    DATA_PARTITIONING_MODE,
4859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    COMBINE_MODE_NO_ERR_RES,
4959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    COMBINE_MODE_WITH_ERR_RES
5059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
5159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} MP4EncodingMode;
5259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
5359f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef enum
5459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
5559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    CONSTANT_Q,
5659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    CBR_1,
5759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    VBR_1,
5859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    CBR_2,
5959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    VBR_2,
6059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    CBR_LOWDELAY
6159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} MP4RateControlType;
6259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
6359f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef enum
6459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
6559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    PASS1,
6659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    PASS2
6759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} PassNum;
6859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
6959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef enum
7059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
7159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    PV_OFF,
7259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    PV_ON
7359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} ParamEncMode;
7459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
7559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
7659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* {SPL0, SPL1, SPL2, SPL3, CPL1, CPL2, CPL2, CPL2} , SPL0: Simple Profile@Level0 , CPL1: Core Profile@Level1 */
7759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* {SSPL0, SSPL1, SSPL2, SSPL2, CSPL1, CSPL2, CSPL3, CSPL3} , SSPL0: Simple Scalable Profile@Level0, CPL1: Core Scalable Profile@Level1 */
7859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
7959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef enum
8059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
8159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* Non-scalable profile */
8259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    SIMPLE_PROFILE_LEVEL0 = 0,
8359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    SIMPLE_PROFILE_LEVEL1,
8459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    SIMPLE_PROFILE_LEVEL2,
8559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    SIMPLE_PROFILE_LEVEL3,
8659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    CORE_PROFILE_LEVEL1,
8759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    CORE_PROFILE_LEVEL2,
8859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
8959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* Scalable profile */
9059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    SIMPLE_SCALABLE_PROFILE_LEVEL0 = 6,
9159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    SIMPLE_SCALABLE_PROFILE_LEVEL1,
9259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    SIMPLE_SCALABLE_PROFILE_LEVEL2,
9359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
9459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    CORE_SCALABLE_PROFILE_LEVEL1 = 10,
9559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    CORE_SCALABLE_PROFILE_LEVEL2,
9659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    CORE_SCALABLE_PROFILE_LEVEL3
9759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
9859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} ProfileLevelType;
9959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
10059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
10159f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef struct tagMP4HintTrack
10259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
10359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    UChar   MTB;
10459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    UChar   LayerID;
10559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    UChar   CodeType;
10659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    UChar   RefSelCode;
10759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} MP4HintTrack;
10859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
10959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef struct tagvideoEncControls
11059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
11159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    void            *videoEncoderData;
11259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int             videoEncoderInit;
11359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} VideoEncControls;
11459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
11559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
11659f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef struct tagvideoEncFrameIO
11759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
11859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    UChar   *yChan; /* pointer to Y */
11959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    UChar   *uChan; /* pointer to U */
12059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    UChar   *vChan; /* pointer to V */
12159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int     height; /* height for Y */
12259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int     pitch;  /* stride  for Y */
12359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    ULong   timestamp; /* modulo timestamp in millisecond*/
12459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
12559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}   VideoEncFrameIO  ;
12659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
12759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/**
12859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong@brief  Encoding options structure */
12959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef struct tagvideoEncOptions
13059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
13159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Sets the encoding mode, defined by the above enumaration. If there are conflicts between the encoding mode
13259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   and subsequent encoding options, encoding mode take precedent over encoding options. */
13359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    MP4EncodingMode     encMode;
13459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
13559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Sets the number of bytes per packet, only used in DATA_PARTITIONING_MODE or COMBINE_MODE_WITH_ERR_RES mode.
13659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           The resync marker will be inserted as often as the size of the packet.*/
13759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 packetSize;
13859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
13959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Selects MPEG-4/H.263 profile and level, if specified other encoding options must conform with it. */
14059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    ProfileLevelType    profile_level;
14159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
14259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Enables reversible variable length code (RVLC) mode. Normally it is set to PV_OFF.*/
14359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    ParamEncMode        rvlcEnable;
14459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
14559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Set the frequency of GOB header interval */
14659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 gobHeaderInterval;
14759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
14859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Sets the number of bitstream layers: 1 is base only: 2 is base + enhancement */
14959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 numLayers;
15059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
15159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Sets the number of ticks per second used for timing information encoded in MPEG4 bitstream.*/
15259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 timeIncRes;
15359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
15459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Sets the number of ticks in time increment resolution between 2 source frames (equivalent to source frame rate). */
15559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 tickPerSrc;
15659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
15759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Specifies encoded heights in pixels, height[n] represents the n-th layer's height. */
15859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 encHeight[2];
15959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
16059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Specifies encoded widths in pixels, width[n] represents the n-th layer's width.*/
16159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 encWidth[2];
16259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
16359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Specifies target frame rates in frames per second, frameRate[n] represents the n-th layer's target frame rate.*/
16459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    float               encFrameRate[2];
16559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
16659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Specifies target bit rates in bits per second unit, bitRate[n] represents the n-th layer's target bit rate. */
16759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 bitRate[2];
16859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
16959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Specifies default quantization parameters for I-Vop. Iquant[n] represents the n-th layer default quantization parameter. The default is Iquant[0]=12.*/
17059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 iQuant[2];
17159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
17259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Specifies default quantization parameters for P-Vop. Pquant[n] represents the n-th layer default quantization parameter. The default is Pquant[0]=10.*/
17359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 pQuant[2];
17459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
17559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief  specifies quantization mode (H263 mode or MPEG mode) of the encoded base and enhance layer (if any).
17659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           In Simple and Simple Scalable profile, we use only H263 mode.*/
17759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 quantType[2];
17859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
17959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Sets rate control algorithm, one of (CONSTANT_Q, CBR_1, or VBR_1).
18059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           CONSTANT_Q uses the default quantization values to encode the sequence.
18159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           CBR_1 (constant bit rate) controls the output at a desired bit rate
18259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           VBR_1 (variable bit rate) gives better picture quality at the expense of bit rate fluctuation
18359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           Note:   type=CONSTANT_Q produces sequences with arbitrary bit rate.
18459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *                   type=CBR_1 produces sequences suitable for streaming.
18559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *                   type=VBR_1 produces sequences suitable for download. */
18659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    MP4RateControlType  rcType;
18759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
18859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief  Sets the VBV buffer size (in the unit of second delay) used to prevent buffer overflow and underflow
18959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           on the decoder side. This function is redundant to PVSetVBVSize. Either one of them is used at a time. */
19059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    float               vbvDelay;
19159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
19259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief  Specifies whether frame skipping is permitted or not. When rate control type is set to CONSTANT_Q
19359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           frame skipping is automatically banned.  In CBR_1 and VBR_1 rate control, frame skipping is allowed by default.
19459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           However, users can force no frame skipping with this flag, but buffer constraint may be violated.*/
19559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    ParamEncMode        noFrameSkipped;
19659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
19759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Sets the maximum number of P-frames between two I-frames. I-frame mode is periodically forced
19859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           if no I-frame is encoded after the specified period to add error resiliency and help resynchronize in case of errors.
19959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           If scene change detection can add additional I-frame if new scenes are detected.
20059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           intraPeriod is the I frame interval in terms of second.
20159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           intraPeriod =0 indicates I-frame encoding only;
20259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           intraPeriod = -1  indicates I-frame followed by all P-frames; (default)
20359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           intraPeriod = N, indicates the number of P-frames between 2 I-frames.*/
20459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 intraPeriod;
20559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
20659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
20759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief  Specifies the number Intra MBs to be refreshed in a P-frame. */
20859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 numIntraMB;
20959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
21059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
21159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  Specifies whether the scene change detection (SCD) is enabled or disabled.
21259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           With SCD enable, when a new scene is detected, I-Vop mode will be used for the first frame of
21359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           the new scene resulting in better picture quality. An insertion of an I-VOP resets the intraPeriod
21459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           specified by the IntraPeriodAPI().*/
21559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    ParamEncMode        sceneDetect;
21659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
21759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief  Specifies the search range of motion estimation search.  Larger value implies
21859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           larger search range, better motion vector match, but more complexity.
21959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           If searchRange=n, the motion vector search is in the range of [-n,n-1] pixels.
22059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           If half-pel  mode is on, the range is [-n, (n-1)+1/2] pixels. The default value is 16.*/
22159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 searchRange;
22259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
22359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief  Turns on/off 8x8 block motion estimation and compensation.
22459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           If on, four motion vectors may be used for motion estimation and compensation of a macroblock,
22559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           otherwise one motion vector per macroblock is used. When the 8x8 MV is off, the total encoding complexity
22659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           is less but the image quality is also worse. Therefore, it can be used in complexity limited environment.*/
22759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    ParamEncMode        mv8x8Enable;
22859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
22959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
23059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief Set the threshold for using intra DC VLC.
23159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           Value must range from 0-7.*/
23259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int                 intraDCVlcTh;
23359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
23459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /** @brief This flag turns on the use of AC prediction */
23559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Bool                useACPred;
23659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
23759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} VideoEncOptions;
23859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
23959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifdef __cplusplus
24059f566c4ec3dfc097ad8163523e522280b27e5c3James Dongextern "C"
24159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
24259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif
24359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
24459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
24559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* API's */
24659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* Always start with this one !!*/
24759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
24859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  Gets default encoding options. This way users only have to set relevant encoding options and leave the one
24959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           they are unsure of.
25059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @encOption  Pointer to VideoEncOption structure.
25159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @encUseCase This value determines the set of default encoding options, for example, different encoding options
25259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *            are assigned to streaming use-case as compared to download use-case. It can be project dependent too.
25359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
25459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
25559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool PVGetDefaultEncOption(VideoEncOptions *encOption, Int encUseCase);
25659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
25759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
25859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  Verifies the consistency of encoding parameters, allocates memory needed and set necessary internal variables.
25959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
26059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
26159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
26259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVInitVideoEncoder(VideoEncControls *encCtrl, VideoEncOptions *encOption);
26359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
26459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* acquiring encoder info APIs */
26559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
26659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function returns VOL header. It has to be called before the frame is encoded.  If so,
26759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           then the VOL Header is passed back to the application. Then all frames that are encoded do not contain the VOL Header.
26859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           If you do not call the API then the VOL Header is passed within the first frame that is encoded.
26959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           The behavior is unknown if it is called after the first frame is encoded. It is mainly used for MP4 file format authoring.
27059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs.
27159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  volHeader is the Buffer for VOL header.
27259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  size is the size of VOL header in bytes.
27359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  layer is the layer of the requested VOL header.
27459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens.
27559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
27659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVGetVolHeader(VideoEncControls *encCtrl, UChar *volHeader, Int *size, Int layer);
27759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
27859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
27959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function returns the profile and level in H.263 coding when the encoding parameters are set
28059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs.
28159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  profileID is the pointer of the profile ID. Right now we only support profile 0
28259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  levelID is the pointer of the level ID that could be 10-70.
28359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens.
28459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
28559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVGetH263ProfileLevelID(VideoEncControls *encCtrl, Int *profileID, Int *levelID);
28659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
28759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
28859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function returns the profile and level of MPEG4 when the encoding parameters are set
28959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs.
29059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  profile_level is the pointer of the profile enumeration
29159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  nLayer is the index of the layer of interest
29259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens.
29359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
29459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVGetMPEG4ProfileLevelID(VideoEncControls *encCtrl, Int *profile_level, Int nLayer);
29559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
29659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
29759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function returns maximum frame size in bytes
29859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
29959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  maxVideoFrameSize is the pointer of the maximum frame size
30059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
30159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
30259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVGetMaxVideoFrameSize(VideoEncControls *encCtrl, Int *maxVideoFrameSize);
30359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
30459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifndef LIMITED_API
30559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
30659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function returns the total amount of memory (in bytes) allocated by the encoder library.
30759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
30859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
30959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
31059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Int     PVGetEncMemoryUsage(VideoEncControls *encCtrl);
31159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
31259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
31359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function is used by PVAuthor to get the size of the VBV buffer.
31459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
31559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  VBVSize is the pointer of The size of the VBV buffer in bytes.
31659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
31759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
31859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVGetVBVSize(VideoEncControls *encCtrl, Int *VBVSize);
31959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif
32059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
32159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
32259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function encodes a frame in YUV 4:2:0 format from the *video_in input frame and put the result in YUV
32359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           for reconstructed frame and bstream for MPEG4 bitstream. The application is required to allocate memory for
32459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           bitstream buffer.The size of the input bitstream memory and the returned output buffer are specified in the
32559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           size field. The encoded layer is specified by the nLayer field. If the current frame is not encoded, size=0 and nLayer=-1.
32659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           Note: If the allocated buffer size is too small to fit a bitstream of a frame, then those extra bits will be left out
32759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *                 which can cause syntactic error at the decoder side.
32859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
32959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  vid_in is the pointer to VideoEncFrameIO structure containing the YUV input data
33059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  vid_out is the pointer to VideoEncFrameIO structure containing the reconstructed YUV output data after encoding
33159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  nextModTime is the timestamp encoder expects from the next input
33259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  bstream is the pointer to MPEG4 bitstream buffer
33359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  size is the size of bitstream buffer allocated (input) and size of the encoded bitstream (output).
33459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  nLayer is the layer of the encoded frame either 0 for base or 1 for enhancement layer. The value -1 indicates skipped frame due to buffer overflow.
33559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true newfor correct operation; false if error happens
33659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
33759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVEncodeVideoFrame(VideoEncControls *encCtrl, VideoEncFrameIO *vid_in, VideoEncFrameIO *vid_out,
33859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong            ULong *nextModTime, UChar *bstream, Int *size, Int *nLayer);
33959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
34059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
34159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
34259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function is used to query overrun buffer. It is used when PVEncodeVideoFrame.returns size that is
34359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           larger than the input size.
34459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
34559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return Pointer to the overrun buffer. NULL if overrun buffer is not used.
34659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
34759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF UChar* PVGetOverrunBuffer(VideoEncControls *encCtrl);
34859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
34959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifndef NO_SLICE_ENCODE   /* This set of APIs are not working. This functionality has been partially
35059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    replaced by the introduction of overrun buffer. */
35159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
35259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* slice-based coding */
35359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
35459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function sets the input YUV frame and timestamp to be encoded by the slice-based encoding function PVEncodeSlice().
35559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           It also return the memory address the reconstructed frame will be copied to (in advance) and the coded layer number.
35659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           The encoder library processes the timestamp and determine if this frame is to be encoded or not. If the current frame
35759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           is not encoded, nLayer=-1. For frame-based motion estimation, the motion estimation of the entire frame is also performed
35859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           in this function. For MB-based motion estimation, the motion vector is searched while coding each MB in PVEncodeSlice().
35959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
36059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  vid_in is the pointer to VideoEncFrameIO structure containing the YUV input data
36159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  nextModTime is the timestamp encoder expects from the next input if this input is rejected and nLayer is set to -1.
36259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  nLayer is the layer of the encoded frame either 0 for base or 1 for enhancement layer. The value -1 indicates skipped frame due to buffer overflow.
36359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true newfor correct operation; false if error happens
36459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
36559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVEncodeFrameSet(VideoEncControls *encCtrl, VideoEncFrameIO *vid_in, ULong *nextModTime, Int *nLayer);
36659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
36759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function encodes a GOB (short header mode) or a packet (data partitioning mode or combined mode with resync marker)
36859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           and output the reconstructed frame and MPEG4 bitstream. The application is required to allocate memory for the bitstream buffer.
36959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           The size of the input bitstream memory and the returned output buffer are specified in the size field.  If the buffer size is
37059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           smaller than the requested packet size, user has to call PVEncodeSlice again to get the rest of that pending packet before moving
37159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           on to the next packet. For the combined mode without resync marker, the function returns when the buffer is full.
37259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           The end-of-frame flag  indicates the completion of the frame encoding.  Next frame must be sent in with PVEncodeFrameSet().
37359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           At the end-of-frame, the next video input address and the next video modulo timestamp will be set.
37459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
37559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  bstream is the pointer to MPEG4 bitstream buffer.
37659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  size is the size of bitstream buffer allocated (input) and size of the encoded bitstream (output).
37759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  endofFrame is a flag indicating the end-of-frame, '1'. Otherwise, '0'.  When PVSetNoCurrentFrameSkip is OFF,
37859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           end-of-frame '-1' indicates current frame bitstream must be disregarded.
37959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  vid_out is the pointer to VideoEncFrameIO structure containing the reconstructed YUV output data after encoding
38059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  nextModTime is the timestamp encoder expects from the next input
38159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true newfor correct operation; false if error happens
38259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
38359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVEncodeSlice(VideoEncControls *encCtrl, UChar *bstream, Int *size,
38459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                                          Int *endofFrame, VideoEncFrameIO *vid_out, ULong *nextModTime);
38559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif
38659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
38759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
38859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function returns MP4 file format hint track information.
38959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
39059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  info is the structure for MP4 hint track information
39159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
39259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
39359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVGetHintTrack(VideoEncControls *encCtrl, MP4HintTrack *info);
39459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
39559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifndef LIMITED_API
39659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
39759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  updates target frame rates of the encoded base and enhance layer (if any) while encoding operation is ongoing.
39859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
39959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  frameRate is the pointers to array of target frame rates in frames per second,
40059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           frameRate[n] represents the n-th layer's target frame rate.
40159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
40259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
40359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVUpdateEncFrameRate(VideoEncControls *encCtrl, float *frameRate); /* for 2-way */
40459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
40559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
40659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
40759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  updates target bit rates of the encoded base and enhance layer (if any) while encoding operation is ongoing.
40859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
40959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  bitRate is the pointers to array of target bit rates in bits per second unit,
41059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *           bitRate[n] represents the n-th layer's target bit rate.
41159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
41259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
41359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVUpdateBitRate(VideoEncControls *encCtrl, Int *bitRate);           /* for 2-way */
41459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
41559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
41659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
41759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  updates the INTRA frame refresh interval while encoding operation is ongoing.
41859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
41959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  aIFramePeriod is a new value of INTRA frame interval in the unit of number of coded frames.
42059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
42159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
42259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
42359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVUpdateIFrameInterval(VideoEncControls *encCtrl, Int aIFramePeriod);/* for 2-way */
42459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
42559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
42659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  specifies the number Intra MBs to be refreshed
42759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
42859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  numMB is the number of Intra MBs to be refreshed
42959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
43059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
43159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVUpdateNumIntraMBRefresh(VideoEncControls *encCtrl, Int numMB);  /* for 2-way */
43259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
43359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
43459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function is called whenever users want the next base frame to be encoded as an I-Vop.
43559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
43659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
43759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
43859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVIFrameRequest(VideoEncControls *encCtrl);                         /* for 2-way */
43959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
44059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif // LIMITED_API
44159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
44259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /* finishing encoder */
44359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    /**
44459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @brief  This function frees up all the memory allocated by the encoder library.
44559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @param  encCtrl is video encoder control structure that is always passed as input in all APIs
44659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    *   @return true for correct operation; false if error happens
44759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    */
44859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    OSCL_IMPORT_REF Bool    PVCleanUpVideoEncoder(VideoEncControls *encCtrl);
44959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
45059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifdef __cplusplus
45159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong}
45259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif
45359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif /* _MP4ENC_API_H_ */
45459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
455